From d05151a9335517c74e9a992b952016a01efb9a50 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Oct 2020 12:32:33 -0700 Subject: [PATCH] Store program to persist in buildinfo and clean it as part of cleanResolutions --- src/compiler/builder.ts | 486 +++++- src/compiler/program.ts | 35 +- src/compiler/resolutionCache.ts | 2 +- src/compiler/types.ts | 26 +- src/compiler/watchPublic.ts | 8 +- src/services/services.ts | 2 +- .../unittests/tsbuild/persistResolutions.ts | 36 + src/testRunner/unittests/tsbuild/sample.ts | 18 +- .../unittests/tsc/persistResolutions.ts | 23 + ...nd-uses-it-for-new-program-with-outFile.js | 1268 ++++++++++++-- ...-resolution-and-uses-it-for-new-program.js | 1368 +++++++++++++-- .../initial-build/persistResolutions.js | 1512 ++++++++++++++++- ...er-resolutions-are-cleaned-with-outFile.js | 830 +++++++-- ...can-build-after-resolutions-are-cleaned.js | 949 +++++++++-- ...-saved-in-tsbuildinfo-file-with-outFile.js | 788 +++++++-- ...ons-have-been-saved-in-tsbuildinfo-file.js | 868 ++++++++-- ...nd-uses-it-for-new-program-with-outFile.js | 768 +++++++-- ...-resolution-and-uses-it-for-new-program.js | 848 +++++++-- ...nd-uses-it-for-new-program-with-outFile.js | 1414 +++++++++++++-- ...-resolution-and-uses-it-for-new-program.js | 1312 ++++++++++++-- ...er-resolutions-are-cleaned-with-outFile.js | 601 ++++++- ...can-build-after-resolutions-are-cleaned.js | 691 +++++++- ...-saved-in-tsbuildinfo-file-with-outFile.js | 791 ++++++++- ...ons-have-been-saved-in-tsbuildinfo-file.js | 660 ++++++- ...nd-uses-it-for-new-program-with-outFile.js | 601 ++++++- ...-resolution-and-uses-it-for-new-program.js | 601 ++++++- 26 files changed, 14845 insertions(+), 1661 deletions(-) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 8492b796f9f76..a13599c89b7ef 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -74,6 +74,22 @@ namespace ts { * true if semantic diagnostics are ReusableDiagnostic instead of Diagnostic */ hasReusableDiagnostic?: true; + persistedProgramInfo?: PersistedProgramState; + } + + export interface PersistedProgramState { + files: readonly SourceFileOfProgramFromBuildInfo[]; + rootFileNames: readonly string[]; + filesByName: ESMap; + fileIncludeReasons: MultiMap; + sourceFileFromExternalLibraryPath: Set | undefined; + redirectTargetsMap: MultiMap; + sourceFileToPackageName: ESMap; + projectReferences: readonly ProjectReference[] | undefined; + resolvedProjectReferences: readonly (ResolvedProjectReferenceOfProgramFromBuildInfo | undefined)[] | undefined; + missingPaths: readonly Path[]; + resolvedTypeReferenceDirectives: ESMap; + fileProcessingDiagnostics: FilePreprocessingDiagnostic[] | undefined; } export const enum BuilderFileEmit { @@ -159,6 +175,7 @@ namespace ts { * true if program has been emitted */ programEmitComplete?: true; + persistedProgramInfo?: PersistedProgramState; } function hasSameKeys(map1: ReadonlyCollection | undefined, map2: ReadonlyCollection | undefined): boolean { @@ -257,7 +274,11 @@ namespace ts { state.seenAffectedFiles = state.seenAffectedFiles || new Set(); } - state.buildInfoEmitPending = !!state.changedFilesSet.size; + if (oldState && newProgram.structureIsReused === StructureIsReused.Completely) { + state.persistedProgramInfo = oldState.persistedProgramInfo; + } + + state.buildInfoEmitPending = !!state.changedFilesSet.size || !!compilerOptions.persistResolutions && newProgram.structureIsReused !== StructureIsReused.Completely; return state; } @@ -298,10 +319,75 @@ namespace ts { */ function releaseCache(state: BuilderProgramState) { BuilderState.releaseCache(state); - // TODO:: If persistResolutions, cache program + createPersistedProgramInfo(state); state.program = undefined; } + function createPersistedProgramInfo(state: BuilderProgramState) { + if (!state.program || !state.compilerOptions.persistResolutions || state.persistedProgramInfo) return; + const filesByName = mapEntries(state.program.getFilesByNameMap(), (key, value) => [key, value ? value.path : value as SourceFileOfProgramFromBuildInfo | Path | typeof missingSourceOfProjectReferenceRedirect | typeof missingFile]); + let sourceFileFromExternalLibraryPath: Set | undefined; + const files = mapToReadonlyArray(state.program.getSourceFiles(), mapSourceFile); + state.persistedProgramInfo = { + files, + rootFileNames: state.program.getRootFileNames(), + filesByName, + fileIncludeReasons: state.program.getFileIncludeReasons(), + sourceFileFromExternalLibraryPath, + redirectTargetsMap: state.program.redirectTargetsMap, + sourceFileToPackageName: state.program.sourceFileToPackageName, + projectReferences: state.program.getProjectReferences(), + resolvedProjectReferences: state.program.getResolvedProjectReferences()?.map(mapResolvedProjectReference), + missingPaths: state.program.getMissingFilePaths(), + resolvedTypeReferenceDirectives: state.program.getResolvedTypeReferenceDirectives(), + fileProcessingDiagnostics: state.program.getFileProcessingDiagnostics(), + }; + + function mapSourceFile(sourceFile: SourceFile): SourceFileOfProgramFromBuildInfo { + if (state.program!.isSourceFileFromExternalLibraryPath(sourceFile.path)) (sourceFileFromExternalLibraryPath ||= new Set()).add(sourceFile.path); + const file: SourceFileOfProgramFromBuildInfo = { + fileName: sourceFile.fileName, + originalFileName: sourceFile.originalFileName, + path: sourceFile.path, + resolvedPath: sourceFile.resolvedPath, + flags: sourceFile.flags, + version: sourceFile.version, + typeReferenceDirectives: mapToReadonlyArray(sourceFile.typeReferenceDirectives, mapFileReference), + libReferenceDirectives: mapToReadonlyArray(sourceFile.libReferenceDirectives, mapFileReference), + referencedFiles: mapToReadonlyArray(sourceFile.referencedFiles, mapFileReference), + imports: mapToReadonlyArray(sourceFile.imports, mapStringLiteral), + moduleAugmentations: mapToReadonlyArray(sourceFile.moduleAugmentations, mapStringLiteralOrIdentifier), + ambientModuleNames: sourceFile.ambientModuleNames, + hasNoDefaultLib: sourceFile.hasNoDefaultLib, + resolvedModules: sourceFile.resolvedModules, + resolvedTypeReferenceDirectiveNames: sourceFile.resolvedTypeReferenceDirectiveNames, + redirectInfo: sourceFile.redirectInfo && { redirectTarget: { path: sourceFile.redirectInfo.redirectTarget.path } } + }; + + if (state.program!.getFilesByNameMap().get(file.path) === sourceFile) filesByName.set(file.path, file); + if (state.program!.getFilesByNameMap().get(file.resolvedPath) === sourceFile) filesByName.set(file.resolvedPath, file); + return file; + } + function mapResolvedProjectReference(ref: ResolvedProjectReference | undefined): ResolvedProjectReferenceOfProgramFromBuildInfo | undefined { + return ref && { + commandLine: { projectReferences: ref.commandLine.projectReferences }, + sourceFile: { version: ref.sourceFile.version, path: ref.sourceFile.path }, + references: ref.references?.map(mapResolvedProjectReference) + }; + } + function mapStringLiteral(name: StringLiteralLike): StringLiteralLikeOfProgramFromBuildInfo { + return { kind: name.kind, text: name.text }; + } + + function mapStringLiteralOrIdentifier(name: StringLiteralLike | Identifier): ModuleNameOfProgramFromBuildInfo { + return isIdentifier(name) ? { kind: name.kind, escapedText: name.escapedText } : mapStringLiteral(name); + } + + function mapFileReference(f: FileReference) { + return f.fileName; + } + } + /** * Creates a clone of the state */ @@ -694,6 +780,71 @@ namespace ts { export type ProgramBuildInfoDiagnostic = string | [string, readonly ReusableDiagnostic[]]; export type ProgramBuilderInfoFilePendingEmit = [string, BuilderFileEmit]; + export type ResolutionWithoutFailedLookupLocations = Omit; + export type PersistedProgramResolution = ResolutionWithoutFailedLookupLocations & + ResolutionWithoutFailedLookupLocations & { + failedLookupLocations?: readonly string[]; + }; + export interface PersistedProgramSourceFile { + fileName: string; + originalFileName: string; + path: string; + resolvedPath: string; + // This currently is set to sourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags but cant be set in type + // Change this if it changes in reusing program + flags: NodeFlags; + version: string; + + typeReferenceDirectives?: readonly string[]; + libReferenceDirectives?: readonly string[]; + referencedFiles?: readonly string[]; + imports?: readonly StringLiteralLikeOfProgramFromBuildInfo[]; + moduleAugmentations?: readonly ModuleNameOfProgramFromBuildInfo[]; + ambientModuleNames?: readonly string[]; + hasNoDefaultLib?: true; + + resolvedModules?: MapLike; + resolvedTypeReferenceDirectiveNames?: MapLike; + redirectInfo?: { readonly redirectTarget: { readonly path: string }; }; + + includeReasons: readonly PersistedProgramFileIncludeReason[]; + isSourceFileFromExternalLibraryPath?: true; + redirectTargets?: readonly string[]; + packageName?: string; + }; + + export interface ResolutionWithFailedLookupLocations { + serializationIndex?: number; + } + export interface ResolvedModuleWithFailedLookupLocations extends ResolutionWithFailedLookupLocations { } + export interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations extends ResolutionWithFailedLookupLocations { } + export interface PersistedProgramReferencedFile { + kind: ReferencedFileKind; + file: string; + index: number; + } + export type PersistedProgramFileIncludeReason = + RootFile | + LibFile | + ProjectReferenceFile | + PersistedProgramReferencedFile | + AutomaticTypeDirectiveFile; + export interface PersistedProgramResolvedProjectReference { + commandLine: Pick; + sourceFile: { version: string; path: string; }; + references: readonly (PersistedProgramResolvedProjectReference | undefined)[] | undefined; + }; + export interface PersistedProgram { + files: readonly PersistedProgramSourceFile[] | undefined; + rootFileNames: readonly string[] | undefined; + filesByName: MapLike | undefined; + projectReferences: readonly ProjectReference[] | undefined; + resolvedProjectReferences: readonly (PersistedProgramResolvedProjectReference | undefined)[] | undefined; + missingPaths: readonly string[] | undefined; + resolvedTypeReferenceDirectives: MapLike | undefined; + fileProcessingDiagnostics: readonly ReusableFilePreprocessingDiagnostic[] | undefined; + resolutions: readonly PersistedProgramResolution[] | undefined; + } export interface ProgramBuildInfo { fileInfos: MapLike; options: CompilerOptions; @@ -701,6 +852,7 @@ namespace ts { exportedModulesMap?: MapLike; semanticDiagnosticsPerFile?: ProgramBuildInfoDiagnostic[]; affectedFilesPendingEmit?: ProgramBuilderInfoFilePendingEmit[]; + peristedProgram?: PersistedProgram; } /** @@ -708,7 +860,8 @@ namespace ts { */ function getProgramBuildInfo(state: Readonly, getCanonicalFileName: GetCanonicalFileName): ProgramBuildInfo | undefined { if (outFileWithoutPersistResolutions(state.compilerOptions)) return undefined; - const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory(); + const program = Debug.checkDefined(state.program); + const currentDirectory = program.getCurrentDirectory(); const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions)!, currentDirectory)); const fileInfos: MapLike = {}; state.fileInfos.forEach((value, key) => { @@ -769,8 +922,147 @@ namespace ts { result.affectedFilesPendingEmit = affectedFilesPendingEmit; } + let resolutions: (ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations)[] | undefined; + let programFilesByName: ESMap; + if (state.compilerOptions.persistResolutions) { + // persist program + programFilesByName = new Map(program.getFilesByNameMap()); + const files = mapToReadonlyArrayOrUndefined(program.getSourceFiles(), mapSourceFile); + let filesByName: MapLike | undefined; + for (const key of arrayFrom(programFilesByName.keys()).sort(compareStringsCaseSensitive)) { + const value = program.getFilesByNameMap().get(key)!; + (filesByName ||= {})[relativeToBuildInfo(key)] = value ? relativeToBuildInfo(value.path) : value; + } + result.peristedProgram = { + files, + rootFileNames: mapToReadonlyArrayOrUndefined(program.getRootFileNames(), relativeToBuildInfoEnsuringAbsolutePath), + filesByName, + projectReferences: program.getProjectReferences()?.map(mapProjectReference), + resolvedProjectReferences: program.getResolvedProjectReferences()?.map(mapResolvedProjectReference), + missingPaths: mapToReadonlyArrayOrUndefined(program.getMissingFilePaths(), relativeToBuildInfo), + resolvedTypeReferenceDirectives: mapResolutionWithFailedLookupMap(program.getResolvedTypeReferenceDirectives()), + fileProcessingDiagnostics: mapToReadonlyArrayOrUndefined(program.getFileProcessingDiagnostics(), mapFileProcessingDiagnostic), + resolutions: mapToReadonlyArrayOrUndefined(resolutions, mapResolution), + }; + } + return result; + function mapSourceFile(sourceFile: SourceFile): PersistedProgramSourceFile { + if (programFilesByName.get(sourceFile.path) === sourceFile) programFilesByName.delete(sourceFile.path); + if (programFilesByName.get(sourceFile.resolvedPath) === sourceFile) programFilesByName.delete(sourceFile.resolvedPath); + const resolvedPath = relativeToBuildInfo(sourceFile.resolvedPath); + return { + fileName: relativeToBuildInfoEnsuringAbsolutePath(sourceFile.fileName), + originalFileName: relativeToBuildInfoEnsuringAbsolutePath(sourceFile.originalFileName), + path: relativeToBuildInfo(sourceFile.path), + resolvedPath, + version: sourceFile.version, + flags: sourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags, + typeReferenceDirectives: mapToReadonlyArrayOrUndefined(sourceFile.typeReferenceDirectives, mapFileReference), + libReferenceDirectives: mapToReadonlyArrayOrUndefined(sourceFile.libReferenceDirectives, mapFileReference), + referencedFiles: mapToReadonlyArrayOrUndefined(sourceFile.referencedFiles, mapFileReference), + imports: mapToReadonlyArrayOrUndefined(sourceFile.imports, mapStringLiteral), + moduleAugmentations: mapToReadonlyArrayOrUndefined(sourceFile.moduleAugmentations, mapStringLiteralOrIdentifier), + ambientModuleNames: sourceFile.ambientModuleNames.length ? sourceFile.ambientModuleNames : undefined, + hasNoDefaultLib: sourceFile.hasNoDefaultLib ? true : undefined, + redirectInfo: sourceFile.redirectInfo && { redirectTarget: { path: relativeToBuildInfo(sourceFile.redirectInfo.redirectTarget.path) } }, + resolvedModules: mapResolutionWithFailedLookupMap(sourceFile.resolvedModules), + resolvedTypeReferenceDirectiveNames: mapResolutionWithFailedLookupMap(sourceFile.resolvedTypeReferenceDirectiveNames), + redirectTargets: mapToReadonlyArrayOrUndefined(program.redirectTargetsMap.get(sourceFile.path), relativeToBuildInfoEnsuringAbsolutePath), + includeReasons: program.getFileIncludeReasons().get(sourceFile.path)!.map(mapFileIncludeReason), + isSourceFileFromExternalLibraryPath: program.isSourceFileFromExternalLibraryPath(sourceFile.path) ? true : undefined, + packageName: program.sourceFileToPackageName.get(sourceFile.path), + }; + } + + function mapFileIncludeReason(reason: FileIncludeReason): PersistedProgramFileIncludeReason { + return isReferencedFile(reason) ? + { ...reason, file: relativeToBuildInfo(reason.file) } : + reason; + } + + function mapFileProcessingDiagnostic(d: FilePreprocessingDiagnostic): ReusableFilePreprocessingDiagnostic { + const result: ReusableFilePreprocessingDiagnostic = { + ...d, + diagnostic: d.diagnostic.key as keyof typeof Diagnostics, + }; + if ((d as FilePreprocessingFileExplainingDiagnostic).file) { + (result as ReusableFilePreprocessingFileExplainingDiagnostic).file = relativeToBuildInfo((d as FilePreprocessingFileExplainingDiagnostic).file!); + } + return result; + } + + function mapResolvedProjectReference(ref: ResolvedProjectReference | undefined): PersistedProgramResolvedProjectReference | undefined { + return ref && { + commandLine: { projectReferences: mapToReadonlyArrayOrUndefined(ref.commandLine.projectReferences, mapProjectReference) }, + sourceFile: { version: ref.sourceFile.version, path: relativeToBuildInfo(ref.sourceFile.path) }, + references: mapToReadonlyArrayOrUndefined(ref.references, mapResolvedProjectReference) + }; + } + + function mapProjectReference(ref: ProjectReference): ProjectReference { + return { + path: relativeToBuildInfoEnsuringAbsolutePath(ref.path), + originalPath: ref.originalPath, + prepend: ref.prepend, + circular: ref.circular + }; + } + + function isResolvedModule(r: ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations): r is ResolvedModuleWithFailedLookupLocations { + return !!(r as ResolvedModuleWithFailedLookupLocations).resolvedModule; + } + + function mapResolution(r: ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations): PersistedProgramResolution { + const resolvedModule = isResolvedModule(r) ? r.resolvedModule : undefined; + const resolvedTypeReferenceDirective = isResolvedModule(r) ? undefined : r.resolvedTypeReferenceDirective; + // Reset serializing index + r.serializationIndex = undefined; + return { + resolvedModule: resolvedModule && { + resolvedFileName: relativeToBuildInfoEnsuringAbsolutePath(resolvedModule.resolvedFileName), + isExternalLibraryImport: resolvedModule.isExternalLibraryImport ? true : undefined, + originalPath: resolvedModule.originalPath && relativeToBuildInfoEnsuringAbsolutePath(resolvedModule.originalPath), + extension: resolvedModule.extension, + packageId: resolvedModule.packageId, + }, + resolvedTypeReferenceDirective: resolvedTypeReferenceDirective && { + resolvedFileName: resolvedTypeReferenceDirective.resolvedFileName && relativeToBuildInfoEnsuringAbsolutePath(resolvedTypeReferenceDirective.resolvedFileName), + primary: resolvedTypeReferenceDirective.primary, + isExternalLibraryImport: resolvedTypeReferenceDirective.isExternalLibraryImport ? true : undefined, + packageId: resolvedTypeReferenceDirective.packageId + }, + failedLookupLocations: mapToReadonlyArrayOrUndefined(r.failedLookupLocations, relativeToBuildInfoEnsuringAbsolutePath), + }; + } + + function mapResolutionWithFailedLookupMap(resolutionMap: ESMap | undefined) { + if (!resolutionMap || !resolutionMap.size) return undefined; + const mappedResult: MapLike = {}; + resolutionMap.forEach((resolution, key) => { + if (resolution.serializationIndex === undefined) { + (resolutions ||= []).push(resolution); + resolution.serializationIndex = resolutions.length - 1; + } + mappedResult[key] = resolution.serializationIndex; + }); + return mappedResult; + } + + function mapStringLiteral(name: StringLiteralLike): StringLiteralLikeOfProgramFromBuildInfo { + return { kind: name.kind, text: name.text }; + } + + function mapStringLiteralOrIdentifier(name: StringLiteralLike | Identifier): ModuleNameOfProgramFromBuildInfo { + return isIdentifier(name) ? { kind: name.kind, escapedText: name.escapedText } : mapStringLiteral(name); + } + + + function mapFileReference(f: FileReference) { + return relativeToBuildInfoEnsuringAbsolutePath(f.fileName); + } + function relativeToBuildInfoEnsuringAbsolutePath(path: string) { return relativeToBuildInfo(getNormalizedAbsolutePath(path, currentDirectory)); } @@ -780,6 +1072,10 @@ namespace ts { } } + function mapToReadonlyArrayOrUndefined(array: readonly T[] | undefined, map: (value: T) => U): readonly U[] | undefined { + return array?.length ? array.map(map) : undefined; + } + function convertToReusableCompilerOptions(options: CompilerOptions, relativeToBuildInfo: (path: string) => string) { const result: CompilerOptions = {}; const { optionsNameMap } = getOptionsNameMap(); @@ -1207,14 +1503,14 @@ namespace ts { affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, value => toPath(value[0]), value => value[1]), affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0, }; + let programFromBuildInfo: ProgramFromBuildInfo | false | undefined; return { getState: () => state, backupState: noop, restoreState: noop, getProgram: notImplemented, getProgramOrUndefined: returnUndefined, - // TODO:: - getProgramOrProgramFromBuildInfoOrUndefined: returnUndefined, + getProgramOrProgramFromBuildInfoOrUndefined, releaseProgram: noop, getCompilerOptions: () => state.compilerOptions, getSourceFile: notImplemented, @@ -1234,6 +1530,142 @@ namespace ts { close: noop, }; + function getProgramOrProgramFromBuildInfoOrUndefined() { + if (programFromBuildInfo !== undefined) return programFromBuildInfo || undefined; + + if (!program.peristedProgram) { + programFromBuildInfo = false; + return undefined; + } + + const filesByName = new Map(); + const fileIncludeReasons = createMultiMap(); + let sourceFileFromExternalLibraryPath: Set | undefined; + const redirectTargetsMap = createMultiMap(); + const sourceFileToPackageName = new Map(); + if (program.peristedProgram.filesByName) { + for (const key in program.peristedProgram.filesByName) { + if (hasProperty(program.peristedProgram.filesByName, key)) { + const value = program.peristedProgram.filesByName[key]; + filesByName.set(toPath(key), isString(value) ? toPath(value) : value); + } + } + } + const resolutions = mapToReadonlyArray(program.peristedProgram.resolutions, mapResolution); + const files = mapToReadonlyArray(program.peristedProgram.files, mapSourceFile); + state.persistedProgramInfo = { + files, + rootFileNames: mapToReadonlyArray(program.peristedProgram.rootFileNames, toAbsolutePath), + filesByName, + fileIncludeReasons, + sourceFileFromExternalLibraryPath, + redirectTargetsMap, + sourceFileToPackageName, + projectReferences: program.peristedProgram.projectReferences?.map(mapProjectReference), + resolvedProjectReferences: program.peristedProgram.resolvedProjectReferences?.map(mapResolvedProjectReference), + missingPaths: mapToReadonlyArray(program.peristedProgram.missingPaths, toPath), + resolvedTypeReferenceDirectives: getResolutionMap(program.peristedProgram.resolvedTypeReferenceDirectives) || new Map(), + fileProcessingDiagnostics: map(program.peristedProgram.fileProcessingDiagnostics, mapFileProcessingDiagnostic), + }; + return programFromBuildInfo = createProgramFromBuildInfo(state.persistedProgramInfo, state.compilerOptions); + + function mapSourceFile(file: PersistedProgramSourceFile): SourceFileOfProgramFromBuildInfo { + const path = toPath(file.path); + const resolvedPath = toPath(file.resolvedPath); + + fileIncludeReasons.set(path, file.includeReasons.map(mapFileIncludeReason)); + if (file.isSourceFileFromExternalLibraryPath) (sourceFileFromExternalLibraryPath ||= new Set()).add(path); + if (file.redirectTargets) redirectTargetsMap.set(path, file.redirectTargets.map(toAbsolutePath)); + if (file.packageName) sourceFileToPackageName.set(path, file.packageName); + + const sourceFile: SourceFileOfProgramFromBuildInfo = { + fileName: toAbsolutePath(file.fileName), + originalFileName: toAbsolutePath(file.originalFileName), + path, + resolvedPath, + flags: file.flags, + version: file.version, + typeReferenceDirectives: mapToReadonlyArray(file.typeReferenceDirectives, toAbsolutePath), + libReferenceDirectives: mapToReadonlyArray(file.libReferenceDirectives, toAbsolutePath), + referencedFiles: mapToReadonlyArray(file.referencedFiles, toAbsolutePath), + imports: file.imports || emptyArray, + moduleAugmentations: file.moduleAugmentations || emptyArray, + ambientModuleNames: file.ambientModuleNames || emptyArray, + hasNoDefaultLib: file.hasNoDefaultLib || false, + resolvedModules: getResolutionMap(file.resolvedModules), + resolvedTypeReferenceDirectiveNames: getResolutionMap(file.resolvedTypeReferenceDirectiveNames), + redirectInfo: file.redirectInfo && { redirectTarget: { path: toPath(file.redirectInfo.redirectTarget.path) } } + }; + + if (!filesByName.has(path)) filesByName.set(path, sourceFile); + if (!filesByName.has(resolvedPath)) filesByName.set(resolvedPath, sourceFile); + return sourceFile; + } + + function getResolutionMap(resolutionMap: MapLike | undefined) { + if (!resolutionMap) return undefined; + const result = new Map(); + for (const key in resolutionMap) { + if (hasProperty(resolutionMap, key)) { + result.set(key, resolutions[resolutionMap[key]]); + } + } + return result; + } + } + + function mapFileIncludeReason(reason: PersistedProgramFileIncludeReason): FileIncludeReason { + return isReferencedFile(reason) ? + { ...reason, file: toPath(reason.file) } : + reason; + } + + function mapResolution({ resolvedModule, resolvedTypeReferenceDirective, failedLookupLocations }: PersistedProgramResolution): ResolvedModuleWithFailedLookupLocations & ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + return { + resolvedModule: resolvedModule && { + resolvedFileName: toAbsolutePath(resolvedModule.resolvedFileName), + isExternalLibraryImport: resolvedModule.isExternalLibraryImport ? true : undefined, + originalPath: resolvedModule.originalPath && toAbsolutePath(resolvedModule.originalPath), + extension: resolvedModule.extension, + packageId: resolvedModule.packageId, + }, + resolvedTypeReferenceDirective: resolvedTypeReferenceDirective && { + resolvedFileName: resolvedTypeReferenceDirective.resolvedFileName && toAbsolutePath(resolvedTypeReferenceDirective.resolvedFileName), + primary: resolvedTypeReferenceDirective.primary, + isExternalLibraryImport: resolvedTypeReferenceDirective.isExternalLibraryImport ? true : undefined, + packageId: resolvedTypeReferenceDirective.packageId + }, + failedLookupLocations: failedLookupLocations ? failedLookupLocations.map(toAbsolutePath) : [] + }; + } + + function mapProjectReference(ref: ProjectReference): ProjectReference { + return { + path: toAbsolutePath(ref.path), + originalPath: ref.originalPath, + prepend: ref.prepend, + circular: ref.circular + }; + } + + function mapResolvedProjectReference(ref: PersistedProgramResolvedProjectReference | undefined): ResolvedProjectReferenceOfProgramFromBuildInfo | undefined { + return ref && { + commandLine: { projectReferences: ref.commandLine.projectReferences?.map(mapProjectReference) }, + sourceFile: { version: ref.sourceFile.version, path: toPath(ref.sourceFile.path) }, + references: ref.references?.map(mapResolvedProjectReference) + }; + } + + function mapFileProcessingDiagnostic(d: ReusableFilePreprocessingDiagnostic) { + return { + ...d, + diagnostic: Diagnostics[d.diagnostic], + file: (d as ReusableFilePreprocessingFileExplainingDiagnostic).file ? + toPath((d as ReusableFilePreprocessingFileExplainingDiagnostic).file!) : + undefined, + }; + } + function toPath(path: string) { return ts.toPath(path, buildInfoDirectory, getCanonicalFileName); } @@ -1243,15 +1675,42 @@ namespace ts { } } - export function createRedirectedBuilderProgram(getState: () => { program: Program | undefined; compilerOptions: CompilerOptions; }, configFileParsingDiagnostics: readonly Diagnostic[]): BuilderProgram { + function mapToReadonlyArray(array: readonly T[] | undefined, map: (value: T) => U): readonly U[] { + return array?.length ? array.map(map) : emptyArray; + } + + function createProgramFromBuildInfo(persistedProgramInfo: PersistedProgramState, compilerOptions: CompilerOptions): ProgramFromBuildInfo { + return { + programFromBuildInfo: true, + getCompilerOptions: () => compilerOptions, + getRootFileNames: () => persistedProgramInfo.rootFileNames, + getSourceFiles: () => persistedProgramInfo.files, + getSourceFileByPath: path => { + const file = persistedProgramInfo.filesByName.get(path); + return file && !isString(file) ? file : undefined; + }, + getProjectReferences: () => persistedProgramInfo.projectReferences, + getResolvedProjectReferences: () => persistedProgramInfo.resolvedProjectReferences, + getMissingFilePaths: () => persistedProgramInfo.missingPaths, + getFileIncludeReasons: () => persistedProgramInfo.fileIncludeReasons, + getResolvedTypeReferenceDirectives: () => persistedProgramInfo.resolvedTypeReferenceDirectives, + getFilesByNameMap: () => persistedProgramInfo.filesByName, + isSourceFileFromExternalLibraryPath: path => !!persistedProgramInfo.sourceFileFromExternalLibraryPath?.has(path), + getFileProcessingDiagnostics: () => persistedProgramInfo.fileProcessingDiagnostics, + redirectTargetsMap: persistedProgramInfo.redirectTargetsMap, + sourceFileToPackageName: persistedProgramInfo.sourceFileToPackageName, + }; + } + + export function createRedirectedBuilderProgram(getState: () => Pick, configFileParsingDiagnostics: readonly Diagnostic[]): BuilderProgram { + let programFromBuildInfo: ProgramFromBuildInfo | false | undefined; return { getState: notImplemented, backupState: noop, restoreState: noop, getProgram, getProgramOrUndefined: () => getState().program, - // TODO:: - getProgramOrProgramFromBuildInfoOrUndefined: () => getState().program, + getProgramOrProgramFromBuildInfoOrUndefined, releaseProgram: () => getState().program = undefined, getCompilerOptions: () => getState().compilerOptions, getSourceFile: fileName => getProgram().getSourceFile(fileName), @@ -1272,5 +1731,16 @@ namespace ts { function getProgram() { return Debug.checkDefined(getState().program); } + + function getProgramOrProgramFromBuildInfoOrUndefined() { + const state = getState(); + if (state.program) return state.program; + if (programFromBuildInfo !== undefined) return programFromBuildInfo || undefined; + if (!state.persistedProgramInfo) { + programFromBuildInfo = false; + return undefined; + } + return programFromBuildInfo = createProgramFromBuildInfo(state.persistedProgramInfo, state.compilerOptions); + } } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 92f60738b6b28..a695e3a121ae8 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -597,7 +597,11 @@ namespace ts { } /*@internal*/ - export function isReferencedFile(reason: FileIncludeReason | undefined): reason is ReferencedFile { + export function isReferencedFile(reason: FileIncludeReason | undefined): reason is ReferencedFile; + /*@internal*/ + export function isReferencedFile(reason: FileIncludeReason | PersistedProgramFileIncludeReason | undefined): reason is PersistedProgramReferencedFile; + /*@internal*/ + export function isReferencedFile(reason: FileIncludeReason | PersistedProgramFileIncludeReason | undefined): reason is ReferencedFile | PersistedProgramReferencedFile { switch (reason?.kind) { case FileIncludeKind.Import: case FileIncludeKind.ReferenceFile: @@ -832,7 +836,7 @@ namespace ts { const cachedDeclarationDiagnosticsForFile: DiagnosticCache = {}; let resolvedTypeReferenceDirectives = new Map(); - let fileProcessingDiagnostics: FilePreprocessingDiagnostics[] | undefined; + let fileProcessingDiagnostics: FilePreprocessingDiagnostic[] | undefined; // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. // This works as imported modules are discovered recursively in a depth first manner, specifically: @@ -1677,7 +1681,7 @@ namespace ts { newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } } - const oldFilesByNameMap = oldProgram.getFilesByNameMap() as ESMap; + const oldFilesByNameMap = oldProgram.getFilesByNameMap() as ESMap; oldFilesByNameMap.forEach((oldFile, path) => { if (!oldFile) { filesByName.set(path, oldFile as false | 0); @@ -1696,25 +1700,7 @@ namespace ts { files = newSourceFiles; fileReasons = oldProgram.getFileIncludeReasons(); - if (!isProgramFromBuildInfo(oldProgram)) { - fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - } - else { - const reusableDiagnostics = oldProgram.getFileProcessingDiagnostics(); - if (reusableDiagnostics) { - const toPath = getToPathForBuildInfoFilePath(options, currentDirectory, getCanonicalFileName); - fileProcessingDiagnostics = map(reusableDiagnostics, reusable => ({ - ...reusable, - diagnostic: Diagnostics[reusable.diagnostic], - file: (reusable as ReusableFilePreprocessingFileExplainingDiagnostic).file !== undefined ? - toPath((reusable as ReusableFilePreprocessingFileExplainingDiagnostic).file!) : - undefined - })); - } - else { - fileProcessingDiagnostics = undefined; - } - } + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); sourceFileToPackageName = oldProgram.sourceFileToPackageName; @@ -2882,7 +2868,8 @@ namespace ts { function processTypeReferenceDirectives(file: SourceFile) { // We lower-case all type references because npm automatically lowercases all packages. See GH#9824. const typeDirectives = map(file.typeReferenceDirectives, ref => toFileNameLowerCase(ref.fileName)); - if (!typeDirectives) { + if (!typeDirectives?.length) { + file.resolvedTypeReferenceDirectiveNames = undefined; return; } @@ -2902,7 +2889,7 @@ namespace ts { resolved: ResolvedTypeReferenceDirectiveWithFailedLookupLocations, reason: FileIncludeReason ): void { - tracing?.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined }); + tracing?.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolved.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined }); processTypeReferenceDirectiveWorker(typeReferenceDirective, resolved, reason); tracing?.pop(); } diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 314163a2a580d..d8883b353029e 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -27,7 +27,7 @@ namespace ts { clear(): void; } - interface ResolutionWithFailedLookupLocations { + export interface ResolutionWithFailedLookupLocations { readonly failedLookupLocations: string[]; isInvalidated?: boolean; refCount?: number; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 42bbbaf87663f..741fd564a6ccb 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3485,7 +3485,7 @@ namespace ts { // It is used to resolve module names in the checker. // Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead /* @internal */ resolvedModules?: ESMap; - /* @internal */ resolvedTypeReferenceDirectiveNames: ESMap; + /* @internal */ resolvedTypeReferenceDirectiveNames?: ESMap; /* @internal */ imports: readonly StringLiteralLike[]; // Identifier only if `declare global` /* @internal */ moduleAugmentations: readonly (StringLiteral | Identifier)[]; @@ -3769,7 +3769,7 @@ namespace ts { } /*@internal*/ - export type FilePreprocessingDiagnostics = FilePreprocessingReferencedDiagnostic | FilePreprocessingFileExplainingDiagnostic; + export type FilePreprocessingDiagnostic = FilePreprocessingReferencedDiagnostic | FilePreprocessingFileExplainingDiagnostic; /*@internal*/ export const missingSourceOfProjectReferenceRedirect = false; @@ -3847,7 +3847,7 @@ namespace ts { getInstantiationCount(): number; getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; - /* @internal */ getFileProcessingDiagnostics(): FilePreprocessingDiagnostics[] | undefined; + /* @internal */ getFileProcessingDiagnostics(): FilePreprocessingDiagnostic[] | undefined; /* @internal */ getResolvedTypeReferenceDirectives(): ESMap; isSourceFileFromExternalLibrary(file: SourceFile): boolean; /* @internal */ isSourceFileFromExternalLibraryPath(path: Path): boolean; @@ -3903,14 +3903,13 @@ namespace ts { /*@internal*/ export interface IdentifierOfProgramFromBuildInfo { kind: SyntaxKind.Identifier; - escapedText: string; + escapedText: __String; } /*@internal*/ export interface StringLiteralLikeOfProgramFromBuildInfo { kind: SyntaxKind.StringLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; text: string; - escapedText: string; } /*@internal*/ @@ -3922,6 +3921,8 @@ namespace ts { originalFileName: string; path: Path; resolvedPath: Path; + // This currently is set to sourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags but cant be set in type + // Change this if it changes in reusing program flags: NodeFlags; version: string; @@ -3929,12 +3930,12 @@ namespace ts { libReferenceDirectives: readonly string[]; referencedFiles: readonly string[]; imports: readonly StringLiteralLikeOfProgramFromBuildInfo[]; - moduleAugmentations: ModuleNameOfProgramFromBuildInfo[]; + moduleAugmentations: readonly ModuleNameOfProgramFromBuildInfo[]; ambientModuleNames: readonly string[]; hasNoDefaultLib: boolean; resolvedModules?: ESMap; - resolvedTypeReferenceDirectiveNames: ESMap; + resolvedTypeReferenceDirectiveNames?: ESMap; redirectInfo?: RedirectInfoOfProgramFromBuildInfo; } @@ -3944,20 +3945,19 @@ namespace ts { getCompilerOptions(): CompilerOptions; getRootFileNames(): readonly string[]; - getSourceFiles(): SourceFileOfProgramFromBuildInfo[]; + getSourceFiles(): readonly SourceFileOfProgramFromBuildInfo[]; getSourceFileByPath(path: Path): SourceFileOfProgramFromBuildInfo | undefined; getProjectReferences(): readonly ProjectReference[] | undefined; - getResolvedProjectReferences(): readonly ResolvedProjectReferenceOfProgramFromBuildInfo[] | undefined; + getResolvedProjectReferences(): readonly (ResolvedProjectReferenceOfProgramFromBuildInfo | undefined)[] | undefined; getMissingFilePaths(): readonly Path[]; getFileIncludeReasons(): MultiMap; getResolvedTypeReferenceDirectives(): ESMap; - getFilesByNameMap(): ESMap; + getFilesByNameMap(): ESMap; isSourceFileFromExternalLibraryPath(path: Path): boolean; - getFileProcessingDiagnostics(): readonly ReusableFilePreprocessingDiagnostics[] | undefined; + getFileProcessingDiagnostics(): FilePreprocessingDiagnostic[] | undefined; redirectTargetsMap: MultiMap; sourceFileToPackageName: ESMap; - structureIsReused?: StructureIsReused; } /*@internal*/ @@ -3978,7 +3978,7 @@ namespace ts { } /*@internal*/ - export type ReusableFilePreprocessingDiagnostics = ReusableFilePreprocessingReferencedDiagnostic | ReusableFilePreprocessingFileExplainingDiagnostic; + export type ReusableFilePreprocessingDiagnostic = ReusableFilePreprocessingReferencedDiagnostic | ReusableFilePreprocessingFileExplainingDiagnostic; /* @internal */ export type RedirectTargetsMap = ReadonlyESMap; diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 620410eb95f01..f112650baba97 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -28,13 +28,13 @@ namespace ts { if (!content) return emitSkippedWithNoDiagnostics; const buildInfo = getBuildInfo(content); if (buildInfo.version !== version) return emitSkippedWithNoDiagnostics; - if (!buildInfo.program) return emitSkippedWithNoDiagnostics; - // TODO:: Clean the actual program - let newContent = content; + if (!buildInfo.program?.peristedProgram) return emitSkippedWithNoDiagnostics; + const { program: { peristedProgram, ...program } } = buildInfo; + buildInfo.program = program; // Actual writeFile with new program const emitDiagnostics = createDiagnosticCollection(); - writeFile(host, emitDiagnostics, buildInfoPath, newContent, /*writeByteOrderMark*/ false); + writeFile(host, emitDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false); return { emitSkipped: false, diagnostics: emitDiagnostics.getDiagnostics(), diff --git a/src/services/services.ts b/src/services/services.ts index 21a7a13b6cabb..e413a18feca07 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -639,7 +639,7 @@ namespace ts { public identifiers!: ESMap; public nameTable: UnderscoreEscapedMap | undefined; public resolvedModules: ESMap | undefined; - public resolvedTypeReferenceDirectiveNames!: ESMap; + public resolvedTypeReferenceDirectiveNames: ESMap | undefined; public imports!: readonly StringLiteralLike[]; public moduleAugmentations!: StringLiteral[]; private namedDeclarations: ESMap | undefined; diff --git a/src/testRunner/unittests/tsbuild/persistResolutions.ts b/src/testRunner/unittests/tsbuild/persistResolutions.ts index 7b609f8065d74..01256c8ac3a01 100644 --- a/src/testRunner/unittests/tsbuild/persistResolutions.ts +++ b/src/testRunner/unittests/tsbuild/persistResolutions.ts @@ -46,6 +46,22 @@ namespace ts { subScenario: "Write file that could not be resolved", buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "export function something2() { return 20; }"), + // when doing clean build, fileNotFound.ts would be resolved so the output order in outFile.js would change + // In build mode the out is generated only when there are no errors + // Outputs are generated, buildinfo is updated to report no errors + cleanBuildDiscrepancies: () => new Map([ + [`/src/project/src/filePresent.js`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/filePresent.d.ts`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/fileNotFound.js`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/fileNotFound.d.ts`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/anotherFileReusingResolution.js`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/anotherFileReusingResolution.d.ts`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/main.js`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/main.d.ts`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/newFile.js`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/src/newFile.d.ts`, CleanBuildDescrepancy.CleanFilePresent], + [`/src/project/tsconfig.tsbuildinfo`, CleanBuildDescrepancy.CleanFileTextDifferent], + ]), }, { subScenario: "Clean resolutions", @@ -53,6 +69,12 @@ namespace ts { modifyFs: noop, commandLineArgs: ["--b", "src/project", "--cleanPersistedProgram"] }, + { + subScenario: "Clean resolutions again", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: noop, + commandLineArgs: ["--b", "src/project", "--cleanPersistedProgram"] + }, noChangeRun, { subScenario: "Modify main file", @@ -87,6 +109,14 @@ namespace ts { subScenario: "Write file that could not be resolved", buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "export function something2() { return 20; }"), + // when doing clean build, fileNotFound.ts would be resolved so the output order in outFile.js would change + // In build mode the out is generated only when there are no errors + cleanBuildDiscrepancies: () => new Map([ + ["/src/project/outFile.tsbuildinfo", CleanBuildDescrepancy.CleanFileTextDifferent], + ["/src/project/outFile.js", CleanBuildDescrepancy.CleanFilePresent], + ["/src/project/outFile.d.ts", CleanBuildDescrepancy.CleanFilePresent], + ["/src/project/outFile.tsbuildinfo.baseline.txt", CleanBuildDescrepancy.CleanFilePresent], + ]), }, { subScenario: "Clean resolutions", @@ -94,6 +124,12 @@ namespace ts { modifyFs: noop, commandLineArgs: ["--b", "src/project", "--cleanPersistedProgram"] }, + { + subScenario: "Clean resolutions again", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: noop, + commandLineArgs: ["--b", "src/project", "--cleanPersistedProgram"] + }, noChangeRun, { subScenario: "Modify main file", diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index a3151b5e2de1e..aa205353e26a9 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -516,13 +516,19 @@ class someClass2 { }`), subScenario: "persistResolutions", baselinePrograms: true, fs: () => projFs, - modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", JSON.stringify({ - compilerOptions: { - composite: true, - skipDefaultLibCheck: true, - persistResolutions: true, + modifyFs: fs => { + persistResolutions("/src/core/tsconfig.json"); + persistResolutions("/src/logic/tsconfig.json"); + persistResolutions("/src/tests/tsconfig.json"); + function persistResolutions(file: string) { + const content = JSON.parse(fs.readFileSync(file, "utf-8")); + content.compilerOptions = { + ...content.compilerOptions || {}, + persistResolutions: true + }; + fs.writeFileSync(file, JSON.stringify(content, /*replacer*/ undefined, 4)); } - })), + }, commandLineArgs: ["--b", "/src/tests"], incrementalScenarios: [ ...coreChanges, diff --git a/src/testRunner/unittests/tsc/persistResolutions.ts b/src/testRunner/unittests/tsc/persistResolutions.ts index 621e9e3ebcd2c..729761b123edf 100644 --- a/src/testRunner/unittests/tsc/persistResolutions.ts +++ b/src/testRunner/unittests/tsc/persistResolutions.ts @@ -46,6 +46,10 @@ namespace ts { subScenario: "Write file that could not be resolved", buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "export function something2() { return 20; }"), + // when doing clean build, fileNotFound.ts would be resolved so the output order in outFile.js would change + cleanBuildDiscrepancies: () => new Map([ + [`/src/project/tsconfig.tsbuildinfo`, CleanBuildDescrepancy.CleanFileTextDifferent] + ]), }, { subScenario: "Clean resolutions", @@ -53,6 +57,12 @@ namespace ts { modifyFs: noop, commandLineArgs: ["--p", "src/project", "--cleanPersistedProgram"] }, + { + subScenario: "Clean resolutions again", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: noop, + commandLineArgs: ["--p", "src/project", "--cleanPersistedProgram"] + }, noChangeRun, { subScenario: "Modify main file", @@ -87,6 +97,13 @@ namespace ts { subScenario: "Write file that could not be resolved", buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "export function something2() { return 20; }"), + // when doing clean build, fileNotFound.ts would be resolved so the output order in outFile.js would change + cleanBuildDiscrepancies: () => new Map([ + ["/src/project/outFile.tsbuildinfo", CleanBuildDescrepancy.CleanFileTextDifferent], + ["/src/project/outFile.js", CleanBuildDescrepancy.CleanFileTextDifferent], + ["/src/project/outFile.d.ts", CleanBuildDescrepancy.CleanFileTextDifferent], + ["/src/project/outFile.tsbuildinfo.baseline.txt", CleanBuildDescrepancy.CleanFileTextDifferent] + ]), }, { subScenario: "Clean resolutions", @@ -94,6 +111,12 @@ namespace ts { modifyFs: noop, commandLineArgs: ["--p", "src/project", "--cleanPersistedProgram"] }, + { + subScenario: "Clean resolutions again", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: noop, + commandLineArgs: ["--p", "src/project", "--cleanPersistedProgram"] + }, noChangeRun, { subScenario: "Modify main file", diff --git a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 729b1ab996b17..eacb735913d7b 100644 --- a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -122,7 +122,136 @@ No cached semantic diagnostics in the builder:: "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -135,24 +264,6 @@ Input:: Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -169,7 +280,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -192,24 +303,9 @@ import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -226,7 +322,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -281,7 +377,136 @@ No cached semantic diagnostics in the builder:: "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -302,28 +527,15 @@ export function foo() { return 20; } Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -340,7 +552,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -402,7 +614,167 @@ No cached semantic diagnostics in the builder:: "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -416,6 +788,367 @@ export function something2() { return 20; } +Output:: +/lib/tsc --b src/project +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} +Program structureReused: SafeModules +Program files:: +/lib/lib.d.ts +/src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts +/src/project/src/fileNotFound.ts +/src/project/src/newFile.ts +/src/project/src/main.ts + +No cached semantic diagnostics in the builder:: + + +//// [/src/project/outFile.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts", + "./src/main.ts" + ] + }, + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "outFile": "./outFile.js", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions +Input:: + + +Output:: +/lib/tsc --b src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + +//// [/src/project/outFile.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts", + "./src/main.ts" + ] + }, + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "outFile": "./outFile.js", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {} + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions again +Input:: + + +Output:: +/lib/tsc --b src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + + + +Change:: no-change-run +Input:: + + Output:: /lib/tsc --b src/project ======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== @@ -574,7 +1307,189 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -636,29 +1551,6 @@ declare module "src/main" { } -Change:: Clean resolutions -Input:: - - -Output:: -/lib/tsc --b src/project --cleanPersistedProgram -exitCode:: ExitStatus.Success - - -//// [/src/project/outFile.tsbuildinfo] file written with same contents - - -Change:: no-change-run -Input:: - - -Output:: -/lib/tsc --b src/project -exitCode:: ExitStatus.Success - - - - Change:: Modify main file Input:: //// [/src/project/src/main.ts] @@ -670,28 +1562,14 @@ import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/fileNotFound.ts'. exitCode:: ExitStatus.Success Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -814,7 +1692,189 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js index f52dfd28c2f95..b2a2e5e098810 100644 --- a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js @@ -165,7 +165,136 @@ Semantic diagnostics in builder refreshed for:: "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -178,24 +307,6 @@ Input:: Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -212,7 +323,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -235,24 +346,9 @@ import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -269,7 +365,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -364,7 +460,136 @@ Semantic diagnostics in builder refreshed for:: "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -385,28 +610,15 @@ export function foo() { return 20; } Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -423,7 +635,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -531,7 +743,167 @@ Semantic diagnostics in builder refreshed for:: "./src/newfile.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -545,6 +917,466 @@ export function something2() { return 20; } +Output:: +/lib/tsc --b src/project +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} +Program structureReused: SafeModules +Program files:: +/lib/lib.d.ts +/src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts +/src/project/src/fileNotFound.ts +/src/project/src/newFile.ts +/src/project/src/main.ts + +Semantic diagnostics in builder refreshed for:: +/src/project/src/fileNotFound.ts + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-13705775197-export declare function something2(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "signature": "-3405156953-export declare function foo(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/filenotfound.ts", + "./src/filepresent.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/newfile.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filenotfound.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ], + [ + "./src/newfile.ts", + 1 + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions +Input:: + + +Output:: +/lib/tsc --b src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-13705775197-export declare function something2(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "signature": "-3405156953-export declare function foo(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/filenotfound.ts", + "./src/filepresent.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/newfile.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filenotfound.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ], + [ + "./src/newfile.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions again +Input:: + + +Output:: +/lib/tsc --b src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + + + +Change:: no-change-run +Input:: + + Output:: /lib/tsc --b src/project ======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== @@ -578,7 +1410,6 @@ Program files:: /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: -/src/project/src/fileNotFound.ts /src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts @@ -709,36 +1540,195 @@ define(["require", "exports"], function (require, exports) { "./src/filepresent.ts", "./src/main.ts", "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -Change:: Clean resolutions -Input:: - - -Output:: -/lib/tsc --b src/project --cleanPersistedProgram -exitCode:: ExitStatus.Success - - -//// [/src/project/tsconfig.tsbuildinfo] file written with same contents - - -Change:: no-change-run -Input:: - - -Output:: -/lib/tsc --b src/project -exitCode:: ExitStatus.Success - - - - Change:: Modify main file Input:: //// [/src/project/src/main.ts] @@ -750,28 +1740,14 @@ import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/fileNotFound.ts'. exitCode:: ExitStatus.Success Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -855,7 +1831,189 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "./src/filepresent.ts", "./src/main.ts", "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/persistResolutions.js b/tests/baselines/reference/tsbuild/sample1/initial-build/persistResolutions.js index 27a699900b820..3dfd108430ffa 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/persistResolutions.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/persistResolutions.js @@ -29,7 +29,15 @@ declare const dts: any; //// [/src/core/tsconfig.json] -{"compilerOptions":{"composite":true,"skipDefaultLibCheck":true,"persistResolutions":true}} +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "persistResolutions": true + } +} //// [/src/logic/index.ts] import * as c from '../core/index'; @@ -41,20 +49,22 @@ export const m = mod; //// [/src/logic/tsconfig.json] -{ - "compilerOptions": { - "composite": true, - "declaration": true, - "sourceMap": true, - "forceConsistentCasingInFileNames": true, - "skipDefaultLibCheck": true - }, - "references": [ - { "path": "../core" } - ] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "persistResolutions": true + }, + "references": [ + { + "path": "../core" + } + ] } - //// [/src/tests/index.ts] import * as c from '../core/index'; import * as logic from '../logic/index'; @@ -67,18 +77,25 @@ export const m = mod; //// [/src/tests/tsconfig.json] -{ - "references": [ - { "path": "../core" }, - { "path": "../logic" } - ], - "files": ["index.ts"], - "compilerOptions": { - "composite": true, - "declaration": true, - "forceConsistentCasingInFileNames": true, - "skipDefaultLibCheck": true - } +{ + "references": [ + { + "path": "../core" + }, + { + "path": "../logic" + } + ], + "files": [ + "index.ts" + ], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "persistResolutions": true + } } //// [/src/ui/index.ts] @@ -93,7 +110,7 @@ Output:: /lib/tsc --b /src/tests exitCode:: ExitStatus.Success Program root files: ["/src/core/anotherModule.ts","/src/core/index.ts","/src/core/some_decl.d.ts"] -Program options: {"composite":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -108,7 +125,7 @@ Semantic diagnostics in builder refreshed for:: /src/core/some_decl.d.ts Program root files: ["/src/logic/index.ts"] -Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/logic/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/logic/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -123,7 +140,7 @@ Semantic diagnostics in builder refreshed for:: /src/logic/index.ts Program root files: ["/src/tests/index.ts"] -Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/tests/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/tests/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -142,7 +159,10 @@ Semantic diagnostics in builder refreshed for:: //// [/src/core/anotherModule.d.ts] export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} //// [/src/core/anotherModule.js] "use strict"; @@ -155,7 +175,10 @@ exports.World = "hello"; export declare const someString: string; export declare function leftPad(s: string, n: number): string; export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} //// [/src/core/index.js] "use strict"; @@ -179,12 +202,12 @@ exports.multiply = multiply; }, "./anothermodule.ts": { "version": "-2676574883-export const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", - "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "./some_decl.d.ts": { @@ -195,6 +218,8 @@ exports.multiply = multiply; }, "options": { "composite": true, + "declaration": true, + "declarationMap": true, "skipDefaultLibCheck": true, "persistResolutions": true, "configFilePath": "./tsconfig.json" @@ -206,7 +231,72 @@ exports.multiply = multiply; "./anothermodule.ts", "./index.ts", "./some_decl.d.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./anotherModule.ts", + "originalFileName": "./anotherModule.ts", + "path": "./anothermodule.ts", + "resolvedPath": "./anothermodule.ts", + "version": "-2676574883-export const World = \"hello\";\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./some_decl.d.ts", + "originalFileName": "./some_decl.d.ts", + "path": "./some_decl.d.ts", + "resolvedPath": "./some_decl.d.ts", + "version": "-9253692965-declare const dts: any;\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./anotherModule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + } }, "version": "FakeTSVersion" } @@ -243,13 +333,13 @@ exports.m = mod; "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n", - "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n", + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { @@ -264,6 +354,7 @@ exports.m = mod; "sourceMap": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -282,7 +373,117 @@ exports.m = mod; "../core/anothermodule.d.ts", "../core/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 0, + "../core/anotherModule": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -314,13 +515,13 @@ exports.m = mod; "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n", - "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n", + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "../logic/index.d.ts": { @@ -339,6 +540,7 @@ exports.m = mod; "declaration": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -365,7 +567,189 @@ exports.m = mod; "../core/index.d.ts", "../logic/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "../logic/index.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./index.ts", + "index": 2 + } + ] + }, + { + "fileName": "../logic/index.d.ts", + "originalFileName": "../logic/index.ts", + "path": "../logic/index.ts", + "resolvedPath": "../logic/index.d.ts", + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/anotherModule": 0 + }, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../logic/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 1, + "../logic/index": 2, + "../core/anotherModule": 3 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json", + "../logic/tsconfig.json": "../logic/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + }, + { + "path": "../logic", + "originalPath": "../logic" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + }, + { + "commandLine": { + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ] + }, + "sourceFile": { + "path": "../logic/tsconfig.json" + }, + "references": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ] + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../logic/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -387,8 +771,8 @@ Output:: /lib/tsc --b /src/tests exitCode:: ExitStatus.Success Program root files: ["/src/core/anotherModule.ts","/src/core/index.ts","/src/core/some_decl.d.ts"] -Program options: {"composite":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} -Program structureReused: Not +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/core/anotherModule.ts @@ -399,8 +783,8 @@ Semantic diagnostics in builder refreshed for:: /src/core/index.ts Program root files: ["/src/logic/index.ts"] -Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/logic/tsconfig.json"} -Program structureReused: Not +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/logic/tsconfig.json"} +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/core/index.d.ts @@ -412,8 +796,8 @@ Semantic diagnostics in builder refreshed for:: /src/logic/index.ts Program root files: ["/src/tests/index.ts"] -Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/tests/tsconfig.json"} -Program structureReused: Not +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/tests/tsconfig.json"} +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/core/index.d.ts @@ -432,7 +816,10 @@ export declare function leftPad(s: string, n: number): string; export declare function multiply(a: number, b: number): number; export declare class someClass { } +//# sourceMappingURL=index.d.ts.map +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI"} //// [/src/core/index.js] "use strict"; @@ -462,12 +849,12 @@ exports.someClass = someClass; }, "./anothermodule.ts": { "version": "-2676574883-export const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", - "signature": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "./some_decl.d.ts": { @@ -478,6 +865,8 @@ exports.someClass = someClass; }, "options": { "composite": true, + "declaration": true, + "declarationMap": true, "skipDefaultLibCheck": true, "persistResolutions": true, "configFilePath": "./tsconfig.json" @@ -489,7 +878,72 @@ exports.someClass = someClass; "./anothermodule.ts", "./index.ts", "./some_decl.d.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./anotherModule.ts", + "originalFileName": "./anotherModule.ts", + "path": "./anothermodule.ts", + "resolvedPath": "./anothermodule.ts", + "version": "-2676574883-export const World = \"hello\";\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./some_decl.d.ts", + "originalFileName": "./some_decl.d.ts", + "path": "./some_decl.d.ts", + "resolvedPath": "./some_decl.d.ts", + "version": "-9253692965-declare const dts: any;\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./anotherModule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + } }, "version": "FakeTSVersion" } @@ -507,13 +961,13 @@ exports.someClass = someClass; "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", - "signature": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { @@ -528,6 +982,7 @@ exports.someClass = someClass; "sourceMap": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -546,7 +1001,117 @@ exports.someClass = someClass; "../core/anothermodule.d.ts", "../core/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 0, + "../core/anotherModule": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -563,13 +1128,13 @@ exports.someClass = someClass; "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", - "signature": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "../logic/index.d.ts": { @@ -588,6 +1153,7 @@ exports.someClass = someClass; "declaration": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -614,7 +1180,189 @@ exports.someClass = someClass; "../core/index.d.ts", "../logic/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "../logic/index.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./index.ts", + "index": 2 + } + ] + }, + { + "fileName": "../logic/index.d.ts", + "originalFileName": "../logic/index.ts", + "path": "../logic/index.ts", + "resolvedPath": "../logic/index.d.ts", + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/anotherModule": 0 + }, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../logic/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 1, + "../logic/index": 2, + "../core/anotherModule": 3 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json", + "../logic/tsconfig.json": "../logic/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + }, + { + "path": "../logic", + "originalPath": "../logic" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + }, + { + "commandLine": { + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ] + }, + "sourceFile": { + "path": "../logic/tsconfig.json" + }, + "references": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ] + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../logic/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -637,8 +1385,8 @@ Output:: /lib/tsc --b /src/tests exitCode:: ExitStatus.Success Program root files: ["/src/core/anotherModule.ts","/src/core/index.ts","/src/core/some_decl.d.ts"] -Program options: {"composite":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} -Program structureReused: Not +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/core/anotherModule.ts @@ -650,6 +1398,7 @@ Semantic diagnostics in builder refreshed for:: //// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] file written with same contents //// [/src/core/index.js] "use strict"; exports.__esModule = true; @@ -683,12 +1432,12 @@ var someClass2 = /** @class */ (function () { }, "./anothermodule.ts": { "version": "-2676574883-export const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { "version": "-11293323834-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nclass someClass2 { }", - "signature": "-14636110300-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "./some_decl.d.ts": { @@ -699,6 +1448,8 @@ var someClass2 = /** @class */ (function () { }, "options": { "composite": true, + "declaration": true, + "declarationMap": true, "skipDefaultLibCheck": true, "persistResolutions": true, "configFilePath": "./tsconfig.json" @@ -710,7 +1461,72 @@ var someClass2 = /** @class */ (function () { "./anothermodule.ts", "./index.ts", "./some_decl.d.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./anotherModule.ts", + "originalFileName": "./anotherModule.ts", + "path": "./anothermodule.ts", + "resolvedPath": "./anothermodule.ts", + "version": "-2676574883-export const World = \"hello\";\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-11293323834-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nclass someClass2 { }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./some_decl.d.ts", + "originalFileName": "./some_decl.d.ts", + "path": "./some_decl.d.ts", + "resolvedPath": "./some_decl.d.ts", + "version": "-9253692965-declare const dts: any;\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./anotherModule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + } }, "version": "FakeTSVersion" } @@ -726,9 +1542,173 @@ Output:: exitCode:: ExitStatus.Success -//// [/src/core/tsconfig.tsbuildinfo] file written with same contents -//// [/src/logic/tsconfig.tsbuildinfo] file written with same contents -//// [/src/tests/tsconfig.tsbuildinfo] file written with same contents +//// [/src/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-11293323834-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nclass someClass2 { }", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "persistResolutions": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "persistResolutions": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "../logic/index.d.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "persistResolutions": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + Change:: Modify core @@ -747,7 +1727,7 @@ Output:: /lib/tsc --b /src/tests exitCode:: ExitStatus.Success Program root files: ["/src/core/anotherModule.ts","/src/core/index.ts","/src/core/some_decl.d.ts"] -Program options: {"composite":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/core/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -759,7 +1739,7 @@ Semantic diagnostics in builder refreshed for:: /src/core/index.ts Program root files: ["/src/logic/index.ts"] -Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/logic/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/logic/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -772,7 +1752,7 @@ Semantic diagnostics in builder refreshed for:: /src/logic/index.ts Program root files: ["/src/tests/index.ts"] -Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"configFilePath":"/src/tests/tsconfig.json"} +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"persistResolutions":true,"configFilePath":"/src/tests/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts @@ -792,7 +1772,10 @@ export declare function leftPad(s: string, n: number): string; export declare function multiply(a: number, b: number): number; export declare class someClassNew { } +//# sourceMappingURL=index.d.ts.map +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,YAAY;CAAI"} //// [/src/core/index.js] "use strict"; @@ -827,12 +1810,12 @@ var someClass2 = /** @class */ (function () { }, "./anothermodule.ts": { "version": "-2676574883-export const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { "version": "-22243974128-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClassNew { }\nclass someClass2 { }", - "signature": "-11313403026-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n", + "signature": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "./some_decl.d.ts": { @@ -843,6 +1826,8 @@ var someClass2 = /** @class */ (function () { }, "options": { "composite": true, + "declaration": true, + "declarationMap": true, "skipDefaultLibCheck": true, "persistResolutions": true, "configFilePath": "./tsconfig.json" @@ -854,7 +1839,72 @@ var someClass2 = /** @class */ (function () { "./anothermodule.ts", "./index.ts", "./some_decl.d.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./anotherModule.ts", + "originalFileName": "./anotherModule.ts", + "path": "./anothermodule.ts", + "resolvedPath": "./anothermodule.ts", + "version": "-2676574883-export const World = \"hello\";\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-22243974128-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClassNew { }\nclass someClass2 { }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./some_decl.d.ts", + "originalFileName": "./some_decl.d.ts", + "path": "./some_decl.d.ts", + "resolvedPath": "./some_decl.d.ts", + "version": "-9253692965-declare const dts: any;\r\n", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./anotherModule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + } }, "version": "FakeTSVersion" } @@ -872,13 +1922,13 @@ var someClass2 = /** @class */ (function () { "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "-11313403026-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n", - "signature": "-11313403026-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n", + "version": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "./index.ts": { @@ -893,6 +1943,7 @@ var someClass2 = /** @class */ (function () { "sourceMap": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -911,7 +1962,117 @@ var someClass2 = /** @class */ (function () { "../core/anothermodule.d.ts", "../core/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 0, + "../core/anotherModule": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -928,13 +2089,13 @@ var someClass2 = /** @class */ (function () { "affectsGlobalScope": true }, "../core/index.d.ts": { - "version": "-11313403026-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n", - "signature": "-11313403026-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n", + "version": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", "affectsGlobalScope": false }, "../core/anothermodule.d.ts": { - "version": "-8396256275-export declare const World = \"hello\";\r\n", - "signature": "-8396256275-export declare const World = \"hello\";\r\n", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", "affectsGlobalScope": false }, "../logic/index.d.ts": { @@ -953,6 +2114,7 @@ var someClass2 = /** @class */ (function () { "declaration": true, "forceConsistentCasingInFileNames": true, "skipDefaultLibCheck": true, + "persistResolutions": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -979,7 +2141,189 @@ var someClass2 = /** @class */ (function () { "../core/index.d.ts", "../logic/index.d.ts", "./index.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "../core/index.d.ts", + "originalFileName": "../core/index.ts", + "path": "../core/index.ts", + "resolvedPath": "../core/index.d.ts", + "version": "-9469451737-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClassNew {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 0 + } + ] + }, + { + "fileName": "../core/anotherModule.d.ts", + "originalFileName": "../core/anotherModule.ts", + "path": "../core/anothermodule.ts", + "resolvedPath": "../core/anothermodule.d.ts", + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "../logic/index.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./index.ts", + "index": 2 + } + ] + }, + { + "fileName": "../logic/index.d.ts", + "originalFileName": "../logic/index.ts", + "path": "../logic/index.ts", + "resolvedPath": "../logic/index.d.ts", + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/anotherModule": 0 + }, + "includeReasons": [ + { + "kind": 3, + "file": "./index.ts", + "index": 1 + } + ] + }, + { + "fileName": "./index.ts", + "originalFileName": "./index.ts", + "path": "./index.ts", + "resolvedPath": "./index.ts", + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "../core/index" + }, + { + "kind": 10, + "text": "../logic/index" + }, + { + "kind": 10, + "text": "../core/anotherModule" + } + ], + "resolvedModules": { + "../core/index": 1, + "../logic/index": 2, + "../core/anotherModule": 3 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + } + ], + "rootFileNames": [ + "./index.ts" + ], + "filesByName": { + "../core/tsconfig.json": "../core/tsconfig.json", + "../logic/tsconfig.json": "../logic/tsconfig.json" + }, + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + }, + { + "path": "../logic", + "originalPath": "../logic" + } + ], + "resolvedProjectReferences": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + }, + { + "commandLine": { + "projectReferences": [ + { + "path": "../core", + "originalPath": "../core" + } + ] + }, + "sourceFile": { + "path": "../logic/tsconfig.json" + }, + "references": [ + { + "commandLine": {}, + "sourceFile": { + "path": "../core/tsconfig.json" + } + } + ] + } + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../logic/index.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "../core/anotherModule.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js index 87004ce816473..1efe9605d14c1 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js @@ -110,7 +110,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:33 AM] Found 2 errors. Watching for file changes. +[12:00:36 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json @@ -149,6 +149,187 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/myproject/outFile.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/main.ts" + ] + }, + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "outFile": "./outFile.js", + "watch": true, + "extendedDiagnostics": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts" + ] + }, + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } + }, + "version": "FakeTSVersion" +} + Change:: Modify main file @@ -162,26 +343,11 @@ import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:36 AM] File change detected. Starting incremental compilation... +[12:00:39 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -192,13 +358,13 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:40 AM] Found 2 errors. Watching for file changes. +[12:00:43 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -272,7 +438,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -295,31 +590,18 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:45 AM] File change detected. Starting incremental compilation... +[12:00:48 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -330,13 +612,13 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:49 AM] Found 2 errors. Watching for file changes. +[12:00:52 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -419,7 +701,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -435,39 +877,37 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:52 AM] File change detected. Starting incremental compilation... +[12:00:55 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:01:00 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:59 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -501,29 +941,11 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", - "./src/fileNotFound.ts", "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 1038, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 310, - "kind": "text" - } - ] - } + ] }, "program": { "fileInfos": { @@ -535,14 +957,14 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false @@ -564,64 +986,190 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/outFile.js] -define("src/filePresent", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); -define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); -define("src/newFile", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); -define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/filePresent" { - export function something(): number; -} -declare module "src/fileNotFound" { - export function something2(): number; -} -declare module "src/anotherFileReusingResolution" { } -declare module "src/newFile" { - export function foo(): number; -} -declare module "src/main" { } - - diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js index 80dc6165fc85d..ace7c05ea1abe 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js @@ -149,7 +149,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:33 AM] Found 2 errors. Watching for file changes. +[12:00:36 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json @@ -188,6 +188,226 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-13601649692-export declare function something(): number;\n", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "watch": true, + "extendedDiagnostics": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/filepresent.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 127, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } + }, + "version": "FakeTSVersion" +} + Change:: Modify main file @@ -201,26 +421,11 @@ import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:36 AM] File change detected. Starting incremental compilation... +[12:00:39 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -231,13 +436,13 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:40 AM] Found 2 errors. Watching for file changes. +[12:00:43 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -351,7 +556,136 @@ exitCode:: ExitStatus.undefined "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -374,31 +708,18 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:45 AM] File change detected. Starting incremental compilation... +[12:00:48 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -409,13 +730,13 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:49 AM] Found 2 errors. Watching for file changes. +[12:00:52 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -544,7 +865,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -560,76 +1041,42 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:52 AM] File change detected. Starting incremental compilation... +[12:00:55 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/filePresent.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/main.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/main.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/newFile.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:16 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:59 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts -/user/username/projects/myproject/src/anotherFileReusingResolution.ts -/user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: @@ -667,16 +1114,16 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", @@ -699,11 +1146,9 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] @@ -711,78 +1156,234 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", - "./src/anotherfilereusingresolution.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", - "./src/main.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/newfile.ts" - ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filenotfound.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ], + [ + "./src/newfile.ts", + 1 + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); - - -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/filePresent.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); - - -//// [/user/username/projects/myproject/src/filePresent.d.ts] -export declare function something(): number; - - -//// [/user/username/projects/myproject/src/main.js] -define(["require", "exports", "./filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/src/main.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/newFile.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); - - -//// [/user/username/projects/myproject/src/newFile.d.ts] -export declare function foo(): number; - - -//// [/user/username/projects/myproject/src/fileNotFound.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); - - -//// [/user/username/projects/myproject/src/fileNotFound.d.ts] -export declare function something2(): number; - - diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js index 963062063e36d..70b2bcfa74c02 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js @@ -72,7 +72,136 @@ interface Array { length: number; [n: number]: T; } "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -82,24 +211,6 @@ interface Array { length: number; [n: number]: T; } Output:: [12:00:29 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -122,7 +233,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 2 Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -164,24 +275,9 @@ FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: W Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json [12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -198,7 +294,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -272,7 +368,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -298,28 +523,15 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src [12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -336,7 +548,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -419,7 +631,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -438,36 +810,34 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:00:57 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:53 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -501,29 +871,11 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", - "./src/fileNotFound.ts", "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 1038, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 310, - "kind": "text" - } - ] - } + ] }, "program": { "fileInfos": { @@ -535,14 +887,14 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false @@ -564,64 +916,190 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/outFile.js] -define("src/filePresent", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); -define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); -define("src/newFile", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); -define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/filePresent" { - export function something(): number; -} -declare module "src/fileNotFound" { - export function something2(): number; -} -declare module "src/anotherFileReusingResolution" { } -declare module "src/newFile" { - export function foo(): number; -} -declare module "src/main" { } - - diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js index 6e3a6ccdbfad8..7460b1f354424 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js @@ -111,7 +111,136 @@ interface Array { length: number; [n: number]: T; } "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -121,24 +250,6 @@ interface Array { length: number; [n: number]: T; } Output:: [12:00:29 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -161,7 +272,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 2 Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -203,24 +314,9 @@ FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: W Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json [12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -237,7 +333,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -351,7 +447,136 @@ exitCode:: ExitStatus.undefined "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -377,28 +602,15 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src [12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -415,7 +627,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -544,7 +756,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -563,73 +935,39 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/filePresent.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/main.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/main.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/newFile.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:13 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:53 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts -/user/username/projects/myproject/src/anotherFileReusingResolution.ts -/user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: @@ -667,16 +1005,16 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", @@ -699,11 +1037,9 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] @@ -711,78 +1047,234 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", - "./src/anotherfilereusingresolution.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", - "./src/main.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/newfile.ts" - ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filenotfound.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ], + [ + "./src/newfile.ts", + 1 + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); - - -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/filePresent.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); - - -//// [/user/username/projects/myproject/src/filePresent.d.ts] -export declare function something(): number; - - -//// [/user/username/projects/myproject/src/main.js] -define(["require", "exports", "./filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/src/main.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/newFile.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); - - -//// [/user/username/projects/myproject/src/newFile.d.ts] -export declare function foo(): number; - - -//// [/user/username/projects/myproject/src/fileNotFound.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); - - -//// [/user/username/projects/myproject/src/fileNotFound.d.ts] -export declare function something2(): number; - - diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 0c12c57caf4a0..3bfe522afd3e2 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -146,7 +146,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -166,24 +295,9 @@ FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: W Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json [12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -200,7 +314,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -274,7 +388,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -300,28 +543,15 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src [12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -338,7 +568,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -421,7 +651,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -440,36 +830,34 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:00:57 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:53 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -503,29 +891,11 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", - "./src/fileNotFound.ts", "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 1038, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 310, - "kind": "text" - } - ] - } + ] }, "program": { "fileInfos": { @@ -537,14 +907,14 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false @@ -566,64 +936,190 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/outFile.js] -define("src/filePresent", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); -define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); -define("src/newFile", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); -define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/filePresent" { - export function something(): number; -} -declare module "src/fileNotFound" { - export function something2(): number; -} -declare module "src/anotherFileReusingResolution" { } -declare module "src/newFile" { - export function foo(): number; -} -declare module "src/main" { } - - diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js index 0b7033e4e0677..58186607af2fd 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js @@ -189,7 +189,136 @@ exitCode:: ExitStatus.undefined "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -209,24 +338,9 @@ FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: W Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json [12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -243,7 +357,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -357,7 +471,136 @@ exitCode:: ExitStatus.undefined "./src/main.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -383,28 +626,15 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src [12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -421,7 +651,7 @@ Resolution for module './fileNotFound' was found in cache from location '/user/u Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -550,7 +780,167 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts", 1 ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -569,73 +959,39 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/filePresent.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/main.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/main.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/newFile.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:13 AM] Found 0 errors. Watching for file changes. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:53 AM] Found 2 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts -/user/username/projects/myproject/src/anotherFileReusingResolution.ts -/user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: @@ -673,16 +1029,16 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", @@ -705,11 +1061,9 @@ exitCode:: ExitStatus.undefined }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] @@ -717,78 +1071,234 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", - "./src/anotherfilereusingresolution.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", - "./src/main.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/newfile.ts" - ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], + [ + "./src/filenotfound.ts", + 1 + ], + [ + "./src/filepresent.ts", + 1 + ], + [ + "./src/main.ts", + 1 + ], + [ + "./src/newfile.ts", + 1 + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } -//// [/user/username/projects/myproject/src/filePresent.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; -}); - - -//// [/user/username/projects/myproject/src/filePresent.d.ts] -export declare function something(): number; - - -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); - - -//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/main.js] -define(["require", "exports", "./filePresent"], function (require, exports, filePresent_1) { - "use strict"; - exports.__esModule = true; - filePresent_1.something(); -}); - - -//// [/user/username/projects/myproject/src/main.d.ts] -export {}; - - -//// [/user/username/projects/myproject/src/newFile.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.foo = void 0; - function foo() { return 20; } - exports.foo = foo; -}); - - -//// [/user/username/projects/myproject/src/newFile.d.ts] -export declare function foo(): number; - - -//// [/user/username/projects/myproject/src/fileNotFound.js] -define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); - - -//// [/user/username/projects/myproject/src/fileNotFound.d.ts] -export declare function something2(): number; - - diff --git a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 553668e90d075..6cd160d0daf20 100644 --- a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -167,7 +167,136 @@ define("src/main", ["require", "exports"], function (require, exports) { "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -214,24 +343,6 @@ Input:: Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -248,7 +359,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -275,24 +386,9 @@ import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -309,7 +405,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -403,7 +499,136 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -459,28 +684,15 @@ export function foo() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -497,7 +709,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -615,7 +827,167 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -676,33 +1048,34 @@ export function something2() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -exitCode:: ExitStatus.Success +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts -/src/project/src/fileNotFound.ts /src/project/src/anotherFileReusingResolution.ts +/src/project/src/fileNotFound.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -713,10 +1086,10 @@ No cached semantic diagnostics in the builder:: declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/fileNotFound" { export function something2(): number; } -declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -731,6 +1104,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -738,10 +1115,6 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -762,8 +1135,8 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", - "./src/fileNotFound.ts", "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -796,14 +1169,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false @@ -824,16 +1197,189 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -850,6 +1396,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -857,10 +1407,6 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; -}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -882,10 +1428,10 @@ text: (0-321) declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/fileNotFound" { export function something2(): number; } -declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -904,7 +1450,97 @@ Output:: exitCode:: ExitStatus.Success -//// [/src/project/outFile.tsbuildinfo] file written with same contents +//// [/src/project/outFile.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts", + "./src/main.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 1068, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 321, + "kind": "text" + } + ] + } + }, + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "outFile": "./outFile.js", + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {} + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions again +Input:: + + +Output:: +/lib/tsc --p src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + Change:: no-change-run @@ -946,10 +1582,372 @@ Program files:: No cached semantic diagnostics in the builder:: -//// [/src/project/outFile.d.ts] file written with same contents -//// [/src/project/outFile.js] file written with same contents -//// [/src/project/outFile.tsbuildinfo] file written with same contents -//// [/src/project/outFile.tsbuildinfo.baseline.txt] file written with same contents +//// [/src/project/outFile.d.ts] +declare module "src/filePresent" { + export function something(): number; +} +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } +declare module "src/newFile" { + export function foo(): number; +} +declare module "src/main" { } + + +//// [/src/project/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); +define("src/fileNotFound", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something2 = void 0; + function something2() { return 20; } + exports.something2 = something2; +}); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); +define("src/newFile", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.foo = void 0; + function foo() { return 20; } + exports.foo = foo; +}); +define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { + "use strict"; + exports.__esModule = true; + filePresent_1.something(); +}); + + +//// [/src/project/outFile.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", + "./src/newFile.ts", + "./src/main.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 1068, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 321, + "kind": "text" + } + ] + } + }, + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "outFile": "./outFile.js", + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/project/outFile.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/project/outFile.js +---------------------------------------------------------------------- +text: (0-1068) +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); +define("src/fileNotFound", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something2 = void 0; + function something2() { return 20; } + exports.something2 = something2; +}); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); +define("src/newFile", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.foo = void 0; + function foo() { return 20; } + exports.foo = foo; +}); +define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { + "use strict"; + exports.__esModule = true; + filePresent_1.something(); +}); + +====================================================================== +====================================================================== +File:: /src/project/outFile.d.ts +---------------------------------------------------------------------- +text: (0-321) +declare module "src/filePresent" { + export function something(): number; +} +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } +declare module "src/newFile" { + export function foo(): number; +} +declare module "src/main" { } + +====================================================================== + Change:: Modify main file @@ -963,28 +1961,14 @@ import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/fileNotFound.ts'. exitCode:: ExitStatus.Success Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -1108,7 +2092,189 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js index 6c341e45dbc53..17c4038791011 100644 --- a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js @@ -188,7 +188,136 @@ define(["require", "exports"], function (require, exports) { } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -201,24 +330,6 @@ Input:: Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -235,7 +346,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -258,24 +369,9 @@ import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -292,7 +388,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -383,7 +479,136 @@ define(["require", "exports", "./filePresent"], function (require, exports, file } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -404,28 +629,15 @@ export function foo() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' does not exist. -File '/src/project/src/fileNotFound.tsx' does not exist. -File '/src/project/src/fileNotFound.d.ts' does not exist. -File '/src/project/src/fileNotFound.js' does not exist. -File '/src/project/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was not resolved. ======== src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound"; @@ -442,7 +654,7 @@ Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -549,7 +761,167 @@ define(["require", "exports"], function (require, exports) { ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -565,44 +937,41 @@ export function something2() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -exitCode:: ExitStatus.Success +Reusing resolution of module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was not resolved. +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: SafeModules Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts -/src/project/src/fileNotFound.ts /src/project/src/anotherFileReusingResolution.ts +/src/project/src/fileNotFound.ts /src/project/src/newFile.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: /src/project/src/fileNotFound.ts -/src/project/src/anotherFileReusingResolution.ts -/src/project/src/main.ts -//// [/src/project/src/anotherFileReusingResolution.d.ts] file written with same contents -//// [/src/project/src/anotherFileReusingResolution.js] file written with same contents //// [/src/project/src/fileNotFound.d.ts] export declare function something2(): number; @@ -617,8 +986,6 @@ define(["require", "exports"], function (require, exports) { }); -//// [/src/project/src/main.d.ts] file written with same contents -//// [/src/project/src/main.js] file written with same contents //// [/src/project/tsconfig.tsbuildinfo] { "program": { @@ -633,16 +1000,291 @@ define(["require", "exports"], function (require, exports) { "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-13705775197-export declare function something2(): number;\r\n", "affectsGlobalScope": false }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "signature": "-3405156953-export declare function foo(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/filenotfound.ts", + "./src/filepresent.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/newfile.ts" + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } + }, + "version": "FakeTSVersion" +} + + + +Change:: Clean resolutions +Input:: + + +Output:: +/lib/tsc --p src/project --cleanPersistedProgram +exitCode:: ExitStatus.Success + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-13705775197-export declare function something2(): number;\r\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-3405156953-export declare function foo(): number;\r\n", @@ -664,11 +1306,9 @@ define(["require", "exports"], function (require, exports) { }, "referencedMap": { "./src/anotherfilereusingresolution.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts" ], "./src/main.ts": [ - "./src/filenotfound.ts", "./src/filepresent.ts", "./src/newfile.ts" ] @@ -676,10 +1316,34 @@ define(["require", "exports"], function (require, exports) { "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", - "./src/anotherfilereusingresolution.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", - "./src/main.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 159, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/newfile.ts" ] }, @@ -688,7 +1352,7 @@ define(["require", "exports"], function (require, exports) { -Change:: Clean resolutions +Change:: Clean resolutions again Input:: @@ -697,7 +1361,6 @@ Output:: exitCode:: ExitStatus.Success -//// [/src/project/tsconfig.tsbuildinfo] file written with same contents Change:: no-change-run @@ -737,8 +1400,263 @@ Program files:: /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: +/src/project/src/anotherFileReusingResolution.ts +/src/project/src/main.ts +//// [/src/project/src/anotherFileReusingResolution.d.ts] file written with same contents +//// [/src/project/src/anotherFileReusingResolution.js] file written with same contents +//// [/src/project/src/main.d.ts] file written with same contents +//// [/src/project/src/main.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-13705775197-export declare function something2(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/newfile.ts": { + "version": "4428918903-export function foo() { return 20; }", + "signature": "-3405156953-export declare function foo(): number;\r\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts", + "./src/newfile.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", + "./src/filenotfound.ts", + "./src/filepresent.ts", + "./src/main.ts", + "./src/newfile.ts" + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } + }, + "version": "FakeTSVersion" +} + Change:: Modify main file @@ -752,28 +1670,14 @@ import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/src/project/src'. -======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. -======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== +Reusing resolution of module './newFile' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/newFile.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/src/project/src/main.ts' of old program, it was successfully resolved to '/src/project/src/fileNotFound.ts'. exitCode:: ExitStatus.Success Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts @@ -858,7 +1762,189 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "./src/filepresent.ts", "./src/main.ts", "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../lib/lib.d.ts", + "originalFileName": "../../lib/lib.d.ts", + "path": "../../lib/lib.d.ts", + "resolvedPath": "../../lib/lib.d.ts", + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 1 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 3 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/fileNotFound.ts", + "extension": ".ts" + } + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js index aca62567e856c..94bd6e616bddc 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js @@ -277,7 +277,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -438,7 +567,136 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -639,7 +897,167 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -847,7 +1265,182 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js index 8455ce6b50d03..488fb3c6fa9a3 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js @@ -187,7 +187,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr 3 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:45 AM] Found 2 errors. Watching for file changes. +[12:00:48 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory @@ -226,6 +226,213 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-13601649692-export declare function something(): number;\n", + "affectsGlobalScope": false + }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + } + }, + "options": { + "module": 2, + "composite": true, + "persistResolutions": true, + "traceResolution": true, + "project": "./", + "watch": true, + "extendedDiagnostics": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], + "./src/main.ts": [ + "./src/filepresent.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], + "./src/filepresent.ts", + [ + "./src/main.ts", + [ + { + "file": "./src/main.ts", + "start": 127, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } + }, + "version": "FakeTSVersion" +} + Change:: Modify main file @@ -240,7 +447,7 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:48 AM] File change detected. Starting incremental compilation... +[12:00:51 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: @@ -259,7 +466,7 @@ Reusing resolution of module './fileNotFound' from '/user/username/projects/mypr 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:58 AM] Found 2 errors. Watching for file changes. +[12:01:01 AM] Found 2 errors. Watching for file changes. @@ -379,7 +586,136 @@ define(["require", "exports", "./filePresent"], function (require, exports, file } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -404,7 +740,7 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:01:03 AM] File change detected. Starting incremental compilation... +[12:01:06 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program @@ -437,7 +773,7 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:17 AM] Found 2 errors. Watching for file changes. +[12:01:20 AM] Found 2 errors. Watching for file changes. @@ -561,7 +897,167 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -592,7 +1088,7 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:20 AM] File change detected. Starting incremental compilation... +[12:01:23 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program @@ -622,7 +1118,7 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec 3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:28 AM] Found 2 errors. Watching for file changes. +[12:01:31 AM] Found 2 errors. Watching for file changes. @@ -752,7 +1248,182 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js index e17094c1e3167..d99afad1f3678 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js @@ -117,7 +117,136 @@ declare module "src/main" { } "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -133,31 +262,10 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? @@ -178,7 +286,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -190,14 +298,14 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} FsWatches:: @@ -277,7 +385,136 @@ exitCode:: ExitStatus.undefined "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -333,14 +570,14 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} FsWatches:: @@ -438,7 +675,136 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -509,14 +875,14 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/newfile.ts: {"fileName":"/user/username/projects/myproject/src/newFile.ts","pollingInterval":250} @@ -639,7 +1005,167 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -700,14 +1226,14 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/newfile.ts: {"fileName":"/user/username/projects/myproject/src/newFile.ts","pollingInterval":250} /user/username/projects/myproject/src/filenotfound.ts: @@ -847,7 +1373,182 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js index 77806acaa1af9..adc2db0e71e6c 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js @@ -134,7 +134,136 @@ export {}; } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -150,31 +279,10 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. -File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. -======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. -======== Module name './fileNotFound' was not resolved. ======== -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? @@ -195,7 +303,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -Program structureReused: Not +Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts @@ -207,14 +315,14 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} FsWatches:: @@ -278,14 +386,14 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} FsWatches:: @@ -379,7 +487,136 @@ define(["require", "exports", "./filePresent"], function (require, exports, file } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -458,14 +695,14 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/newfile.ts: {"fileName":"/user/username/projects/myproject/src/newFile.ts","pollingInterval":250} @@ -561,7 +798,167 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -643,14 +1040,14 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} -/user/username/projects/myproject/src/anotherfilereusingresolution.ts: - {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: {"fileName":"/user/username/projects/myproject/src/main.ts","pollingInterval":250} -/a/lib/lib.d.ts: - {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} /user/username/projects/myproject/src/newfile.ts: {"fileName":"/user/username/projects/myproject/src/newFile.ts","pollingInterval":250} /user/username/projects/myproject/src/filenotfound.ts: @@ -752,7 +1149,182 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js index f5d6072914d3f..815f107f57836 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -206,7 +206,136 @@ declare module "src/main" { } "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -367,7 +496,136 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "./src/filepresent.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -568,7 +826,167 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -776,7 +1194,182 @@ declare module "src/main" { } "./src/newfile.ts" ] }, - "exportedModulesMap": {} + "exportedModulesMap": {}, + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } diff --git a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js index 2e0178c5270fe..7c3495e3fad17 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js @@ -227,7 +227,136 @@ export {}; } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -385,7 +514,136 @@ define(["require", "exports", "./filePresent"], function (require, exports, file } ] ] - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + } + ] + } }, "version": "FakeTSVersion" } @@ -567,7 +825,167 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 3 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 2 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" } @@ -758,7 +1176,182 @@ exitCode:: ExitStatus.undefined ] ], "./src/newfile.ts" - ] + ], + "peristedProgram": { + "files": [ + { + "fileName": "../../../../a/lib/lib.d.ts", + "originalFileName": "../../../../a/lib/lib.d.ts", + "path": "../../../../a/lib/lib.d.ts", + "resolvedPath": "../../../../a/lib/lib.d.ts", + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "flags": 0, + "hasNoDefaultLib": true, + "includeReasons": [ + { + "kind": 6 + } + ] + }, + { + "fileName": "./src/filePresent.ts", + "originalFileName": "./src/filePresent.ts", + "path": "./src/filepresent.ts", + "resolvedPath": "./src/filepresent.ts", + "version": "11598859296-export function something() { return 10; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/anotherfilereusingresolution.ts", + "index": 0 + }, + { + "kind": 0, + "index": 2 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 1 + }, + { + "kind": 3, + "file": "./src/main.ts", + "index": 2 + } + ] + }, + { + "fileName": "./src/anotherFileReusingResolution.ts", + "originalFileName": "./src/anotherFileReusingResolution.ts", + "path": "./src/anotherfilereusingresolution.ts", + "resolvedPath": "./src/anotherfilereusingresolution.ts", + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 0 + } + ] + }, + { + "fileName": "./src/fileNotFound.ts", + "originalFileName": "./src/fileNotFound.ts", + "path": "./src/filenotfound.ts", + "resolvedPath": "./src/filenotfound.ts", + "version": "-497034637-export function something2() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 0, + "index": 1 + } + ] + }, + { + "fileName": "./src/newFile.ts", + "originalFileName": "./src/newFile.ts", + "path": "./src/newfile.ts", + "resolvedPath": "./src/newfile.ts", + "version": "4428918903-export function foo() { return 20; }", + "flags": 0, + "includeReasons": [ + { + "kind": 3, + "file": "./src/main.ts", + "index": 0 + }, + { + "kind": 0, + "index": 4 + } + ] + }, + { + "fileName": "./src/main.ts", + "originalFileName": "./src/main.ts", + "path": "./src/main.ts", + "resolvedPath": "./src/main.ts", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "flags": 0, + "imports": [ + { + "kind": 10, + "text": "./newFile" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./filePresent" + }, + { + "kind": 10, + "text": "./fileNotFound" + } + ], + "resolvedModules": { + "./newFile": 2, + "./filePresent": 0, + "./fileNotFound": 1 + }, + "includeReasons": [ + { + "kind": 0, + "index": 3 + } + ] + } + ], + "rootFileNames": [ + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", + "./src/filePresent.ts", + "./src/main.ts", + "./src/newFile.ts" + ], + "resolutions": [ + { + "resolvedModule": { + "resolvedFileName": "./src/filePresent.ts", + "extension": ".ts" + } + }, + { + "failedLookupLocations": [ + "./src/fileNotFound.ts", + "./src/fileNotFound.tsx", + "./src/fileNotFound.d.ts", + "./src/fileNotFound.js", + "./src/fileNotFound.jsx" + ] + }, + { + "resolvedModule": { + "resolvedFileName": "./src/newFile.ts", + "extension": ".ts" + } + } + ] + } }, "version": "FakeTSVersion" }