diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 6d7c86afb1ef0..19325f520037d 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1895,17 +1895,18 @@ namespace ts { } } - function createGetProgramOrOldBuildInfoProgramUndefined(state: ReusableBuilderProgramState): () => Program | OldBuildInfoProgram | undefined { - let oldProgram: OldBuildInfoProgram | undefined; - return () => state.program ?? oldProgram ?? (oldProgram = memoize(() => createOldBuildInfoProgram( + function createGetProgramOrOldBuildInfoProgramUndefined(state: ReusableBuilderProgramState): () => Program | OldBuildInfoProgramConstructor | undefined { + return () => state.program ?? (host => createOldBuildInfoProgram( + host, state.compilerOptions, state.cacheResolutions, // Prefer cached resolutions over serialized format !state.cacheResolutions ? state.resuableCacheResolutions : undefined, - ))()); + )); } export function createOldBuildInfoProgram( + host: OldBuildInfoProgramHost, compilerOptions: CompilerOptions, cacheResolutions: ReusableBuilderProgramState["cacheResolutions"], resuableCacheResolutions: ReusableBuilderProgramState["resuableCacheResolutions"], @@ -1929,8 +1930,7 @@ namespace ts { return { getCompilerOptions: () => compilerOptions, - getResolvedModule: (host, dirPath, name, mode, redirectedReference) => getResolvedFromCache( - host, + getResolvedModule: (dirPath, name, mode, redirectedReference) => getResolvedFromCache( cacheResolutions?.modules, resuableCacheResolutions?.cache.modules, decodedResolvedModules, @@ -1941,8 +1941,7 @@ namespace ts { cacheResolutions?.moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap, ), - getResolvedTypeReferenceDirective: (host, dirPath, name, mode, redirectedReference) => getResolvedFromCache( - host, + getResolvedTypeReferenceDirective: (dirPath, name, mode, redirectedReference) => getResolvedFromCache( cacheResolutions?.typeRefs, resuableCacheResolutions?.cache.typeRefs, decodedResolvedTypeRefs, @@ -1953,24 +1952,15 @@ namespace ts { /*moduleNameToDirectoryMap*/ undefined, /*decodedModuleNameToDirectoryMap*/ undefined, ), - clearRedirectsMap: () => { - cacheResolutions?.modules?.clearRedirectsMap(); - cacheResolutions?.typeRefs?.clearRedirectsMap(); - cacheResolutions?.moduleNameToDirectoryMap.clearRedirectsMap(); - decodedResolvedModules.clearRedirectsMap(); - decodedResolvedTypeRefs.clearRedirectsMap(); - decodedModuleNameToDirectoryMap.clearRedirectsMap(); - } }; - function fileExists(host: OldBuildInfoProgramResolutionHost, fileName: string) { + function fileExists(fileName: string) { let result = fileExistsMap.get(fileName); if (result === undefined) fileExistsMap.set(fileName, result = host.fileExists(fileName)); return result; } function affectingLocationsSame( - host: OldBuildInfoProgramResolutionHost, fileName: string, expected: PackageJsonInfoCacheEntry | string | undefined ): boolean { @@ -1990,7 +1980,6 @@ namespace ts { } function getResolvedFromCache( - host: OldBuildInfoProgramResolutionHost, cache: CacheWithRedirects> | undefined, reusableCache: ProgramBuildInfoResolutionCacheWithRedirects | undefined, decodedReusableCache: DecodedResolvedMap, @@ -2006,14 +1995,11 @@ namespace ts { moduleNameToDirectoryMap?.getMapOfCacheRedirects(redirectedReference)?.get(getModeAwareCacheKey(name, mode))?.get(dirPath); if (fromCache) { return fileExists( - host, (fromCache as ResolvedModuleWithFailedLookupLocations).resolvedModule?.resolvedFileName || (fromCache as ResolvedTypeReferenceDirectiveWithFailedLookupLocations).resolvedTypeReferenceDirective!.resolvedFileName! ) && every( fromCache.affectingLocations, - fileName => affectingLocationsSame( - host, fileName, cacheResolutions!.packageJsonCache?.getPackageJsonInfo(fileName) - ) + fileName => affectingLocationsSame(fileName, cacheResolutions!.packageJsonCache?.getPackageJsonInfo(fileName)) ) ? fromCache as Resolution : undefined; } if (!reusableCache) return undefined; @@ -2043,7 +2029,7 @@ namespace ts { const resolutionId = decodedReusableCache.getMapOfCacheRedirects(redirectedReference)?.get(dirPath)?.get(name, mode) || decodedModuleNameToDirectoryMap?.getMapOfCacheRedirects(redirectedReference)?.get(getModeAwareCacheKey(name, mode))?.get(dirPath); - return resolutionId ? toResolution(host, resolutionId) : undefined; + return resolutionId ? toResolution(resolutionId) : undefined; } function setBuildInfoResolutionEntries( @@ -2116,16 +2102,16 @@ namespace ts { )); } - function toAffectingFileLocation(host: OldBuildInfoProgramResolutionHost, fileId: ProgramBuildInfoAbsoluteFileId) { + function toAffectingFileLocation(fileId: ProgramBuildInfoAbsoluteFileId) { if (!decodedHashes && resuableCacheResolutions!.cache.hash) { decodedHashes = arrayToMap(resuableCacheResolutions!.cache.hash, hash => isArray(hash) ? hash[0] : hash, hash => isArray(hash) ? hash[1] : undefined); } const hash = decodedHashes?.get(fileId); const file = resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId); - return affectingLocationsSame(host, file, hash) ? file : undefined; + return affectingLocationsSame(file, hash) ? file : undefined; } - function toResolution(host: OldBuildInfoProgramResolutionHost, resolutionId: ProgramBuildInfoResolutionId): Resolution | undefined { + function toResolution(resolutionId: ProgramBuildInfoResolutionId): Resolution | undefined { const existing = resolutions?.[resolutionId - 1]; if (existing !== undefined) return existing || undefined; resolutions ??= new Array(resuableCacheResolutions!.cache.resolutions.length); @@ -2134,8 +2120,8 @@ namespace ts { resolution.resolvedModule?.resolvedFileName || resolution.resolvedTypeReferenceDirective!.resolvedFileName ); let affectingLocations: string[] | undefined; - if (fileExists(host, resolvedFileName) && every(resolution.affectingLocations, fileId => { - const file = toAffectingFileLocation(host, fileId); + if (fileExists(resolvedFileName) && every(resolution.affectingLocations, fileId => { + const file = toAffectingFileLocation(fileId); if (file) (affectingLocations ??= []).push(file); return !!file; })) { diff --git a/src/compiler/builderPublic.ts b/src/compiler/builderPublic.ts index 36e13bc37252e..eff361f6ea27d 100644 --- a/src/compiler/builderPublic.ts +++ b/src/compiler/builderPublic.ts @@ -51,7 +51,7 @@ namespace ts { * Returns current program that could be undefined if the program was released, or cached build info program (currently module and type ref cache) */ /*@internal*/ - getProgramOrOldBuildInfoProgramUndefined(): Program | OldBuildInfoProgram | undefined; + getProgramOrOldBuildInfoProgramUndefined(): Program | OldBuildInfoProgramConstructor | undefined; /** * Releases reference to the program, making all the other operations that need program to fail. */ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 24e69cbe33e2d..51452b173a0a1 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1724,6 +1724,11 @@ namespace ts { /** Does nothing. */ export function noop(_?: unknown): void { } + export const noopPush: Push = { + push: noop, + length: 0 + }; + /** Do nothing and return false */ export function returnFalse(): false { return false; diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 3bfba1009d05e..8ac63fd48e411 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -131,7 +131,7 @@ namespace ts { resultFromCache?: ResolvedModuleWithFailedLookupLocations; packageJsonInfoCache: PackageJsonInfoCache | undefined; features: NodeResolutionFeatures; - conditions: string[]; + conditions: readonly string[]; requestContainingDirectory: string | undefined; reportResolutionDiagnostic: (d: ResolutionDiagnostic) => void; } @@ -506,18 +506,7 @@ namespace ts { host: ModuleResolutionHost, cache: ModuleResolutionCache | undefined, ): PackageJsonInfo | undefined { - const moduleResolutionState: ModuleResolutionState = { - compilerOptions: options, - host, - traceEnabled: isTraceEnabled(options, host), - failedLookupLocations: [], - affectingLocations: [], - packageJsonInfoCache: cache?.getPackageJsonInfoCache(), - conditions: emptyArray, - features: NodeResolutionFeatures.None, - requestContainingDirectory: containingDirectory, - reportResolutionDiagnostic: noop - }; + const moduleResolutionState = getTemporaryModuleResolutionState(cache?.getPackageJsonInfoCache(), host, options); return forEachAncestorDirectory(containingDirectory, ancestorDirectory => { if (getBaseFileName(ancestorDirectory) !== "node_modules") { @@ -1440,8 +1429,8 @@ namespace ts { } function node16ModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, - host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, - resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations { + host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, + resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations { return nodeNextModuleNameResolverWorker( NodeResolutionFeatures.Node16Default, moduleName, @@ -1455,8 +1444,8 @@ namespace ts { } function nodeNextModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, - host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, - resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations { + host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, + resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations { return nodeNextModuleNameResolverWorker( NodeResolutionFeatures.NodeNextDefault, moduleName, @@ -1861,18 +1850,9 @@ namespace ts { let entrypoints: string[] | undefined; const extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; const features = getDefaultNodeResolutionFeatures(options); - const requireState: ModuleResolutionState = { - compilerOptions: options, - host, - traceEnabled: isTraceEnabled(options, host), - failedLookupLocations: [], - affectingLocations: [], - packageJsonInfoCache: cache?.getPackageJsonInfoCache(), - conditions: ["node", "require", "types"], - features, - requestContainingDirectory: packageJsonInfo.packageDirectory, - reportResolutionDiagnostic: noop - }; + const requireState = getTemporaryModuleResolutionState(cache?.getPackageJsonInfoCache(), host, options); + requireState.conditions = ["node", "require", "types"]; + requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; const requireResolution = loadNodeModuleFromDirectoryWorker( extensions, packageJsonInfo.packageDirectory, @@ -1958,6 +1938,22 @@ namespace ts { } } + /*@internal*/ + export function getTemporaryModuleResolutionState(packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleResolutionState { + return { + host, + compilerOptions: options, + traceEnabled: isTraceEnabled(options, host), + failedLookupLocations: noopPush, + affectingLocations: noopPush, + packageJsonInfoCache, + features: NodeResolutionFeatures.None, + conditions: emptyArray, + requestContainingDirectory: undefined, + reportResolutionDiagnostic: noop + }; + } + /*@internal*/ interface PackageJsonInfo { packageDirectory: string; @@ -1972,31 +1968,7 @@ namespace ts { * A function for locating the package.json scope for a given path */ /*@internal*/ - export function getPackageScopeForPath(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): PackageJsonInfo | undefined { - const state: { - host: ModuleResolutionHost; - compilerOptions: CompilerOptions; - traceEnabled: boolean; - failedLookupLocations: Push; - affectingLocations: Push; - resultFromCache?: ResolvedModuleWithFailedLookupLocations; - packageJsonInfoCache: PackageJsonInfoCache | undefined; - features: number; - conditions: never[]; - requestContainingDirectory: string | undefined; - reportResolutionDiagnostic: (d: ResolutionDiagnostic) => void; - } = { - host, - compilerOptions: options, - traceEnabled: isTraceEnabled(options, host), - failedLookupLocations: [], - affectingLocations: [], - packageJsonInfoCache, - features: 0, - conditions: [], - requestContainingDirectory: undefined, - reportResolutionDiagnostic: noop - }; + export function getPackageScopeForPath(fileName: Path, state: ModuleResolutionState): PackageJsonInfo | undefined { const parts = getPathComponents(fileName); parts.pop(); while (parts.length > 0) { @@ -2175,7 +2147,7 @@ namespace ts { function loadModuleFromSelfNameReference(extensions: Extensions, moduleName: string, directory: string, state: ModuleResolutionState, cache: ModuleResolutionCache | undefined, redirectedReference: ResolvedProjectReference | undefined): SearchResult { const useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; const directoryPath = toPath(combinePaths(directory, "dummy"), state.host.getCurrentDirectory?.(), createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); - const scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions); + const scope = getPackageScopeForPath(directoryPath, state); if (!scope || !scope.packageJsonContent.exports) { return undefined; } @@ -2237,7 +2209,7 @@ namespace ts { } const useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; const directoryPath = toPath(combinePaths(directory, "dummy"), state.host.getCurrentDirectory?.(), createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); - const scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions); + const scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { trace(state.host, Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2c704376e0d55..b21fbdd14e794 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -870,9 +870,8 @@ namespace ts { return undefined; } function lookupFromPackageJson(): NonNullable { - const scope = getPackageScopeForPath(fileName, packageJsonInfoCache, host, options); + const scope = getPackageScopeForPath(fileName, getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)); return scope?.packageJsonContent.type === "module" ? ModuleKind.ESNext : ModuleKind.CommonJS; - } } @@ -983,7 +982,7 @@ namespace ts { return optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions); } - function createCreateProgramOptions(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program | OldBuildInfoProgram, configFileParsingDiagnostics?: readonly Diagnostic[]): CreateProgramOptionsWithOldBuildInfoProgram { + function createCreateProgramOptions(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program | OldBuildInfoProgramConstructor, configFileParsingDiagnostics?: readonly Diagnostic[]): CreateProgramOptionsWithOldBuildInfoProgramConstructor { return { rootNames, options, @@ -993,10 +992,6 @@ namespace ts { }; } - function isOldBuildInfoProgram(program: Program | OldBuildInfoProgram | undefined): program is OldBuildInfoProgram { - return !!(program as OldBuildInfoProgram | undefined)?.getResolvedModule; - } - /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -1009,7 +1004,7 @@ namespace ts { */ export function createProgram(createProgramOptions: CreateProgramOptions): Program; /*@internal*/ - export function createProgram(createProgramOptions: CreateProgramOptionsWithOldBuildInfoProgram): Program; // eslint-disable-line @typescript-eslint/unified-signatures + export function createProgram(createProgramOptions: CreateProgramOptionsWithOldBuildInfoProgramConstructor): Program; // eslint-disable-line @typescript-eslint/unified-signatures /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -1025,12 +1020,10 @@ namespace ts { * @returns A 'Program' object. */ export function createProgram(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: readonly Diagnostic[]): Program; - export function createProgram(rootNamesOrOptions: readonly string[] | CreateProgramOptionsWithOldBuildInfoProgram, _options?: CompilerOptions, _host?: CompilerHost, _oldProgram?: Program, _configFileParsingDiagnostics?: readonly Diagnostic[]): Program { + export function createProgram(rootNamesOrOptions: readonly string[] | CreateProgramOptionsWithOldBuildInfoProgramConstructor, _options?: CompilerOptions, _host?: CompilerHost, _oldProgram?: Program, _configFileParsingDiagnostics?: readonly Diagnostic[]): Program { const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options!, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217 const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions; - let { oldProgram: oldProgramOrOldBuildInfoProgram } = createProgramOptions; - let oldProgram = isOldBuildInfoProgram(oldProgramOrOldBuildInfoProgram) ? undefined : oldProgramOrOldBuildInfoProgram; - let oldBuildInfoProgram = isOldBuildInfoProgram(oldProgramOrOldBuildInfoProgram) ? oldProgramOrOldBuildInfoProgram : undefined; + let { oldProgram: oldProgramOrOldBuildInfoProgramConstructor } = createProgramOptions; let processingDefaultLibFiles: SourceFile[] | undefined; let processingOtherFiles: SourceFile[] | undefined; @@ -1178,35 +1171,26 @@ namespace ts { loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader); } - let oldBuildInfoProgramResolutionHost: OldBuildInfoProgramResolutionHost | undefined; - if (oldBuildInfoProgram) { - const state: ModuleResolutionState = { - host, - compilerOptions: options, - traceEnabled: isTraceEnabled(options, host), - failedLookupLocations: [], - affectingLocations: [], - packageJsonInfoCache: moduleResolutionCache?.getPackageJsonInfoCache(), - features: 0, - conditions: [], - requestContainingDirectory: undefined, - reportResolutionDiagnostic: noop - }; - oldBuildInfoProgramResolutionHost = { + let oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined; + let oldBuildInfoProgram: OldBuildInfoProgram | undefined; + if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") { + const state = getTemporaryModuleResolutionState(moduleResolutionCache?.getPackageJsonInfoCache(), host, options); + oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({ fileExists: fileName => host.fileExists(fileName), createHash: maybeBind(host, host.createHash), getPackageJsonInfo: fileName => getPackageJsonInfo(getDirectoryPath(fileName), /*onlyRecordFailures*/ false, state), - }; - // Ensure redirected references are verified before using existing cache - oldBuildInfoProgram.clearRedirectsMap(); - moduleResolutionCache?.setOldResolutionCache({ - getResolved: (dirPath, name, mode, redirectedReference) => - oldBuildInfoProgram?.getResolvedModule(oldBuildInfoProgramResolutionHost!, dirPath, name, mode, redirectedReference) - }); - typeReferenceDirectiveResolutionCache?.setOldResolutionCache({ - getResolved: (dirPath, name, mode, redirectedReference) => - oldBuildInfoProgram?.getResolvedTypeReferenceDirective(oldBuildInfoProgramResolutionHost!, dirPath, name, mode, redirectedReference) }); + if (oldBuildInfoProgram) { + // Ensure redirected references are verified before using existing cache + moduleResolutionCache?.setOldResolutionCache({ + getResolved: (dirPath, name, mode, redirectedReference) => + oldBuildInfoProgram?.getResolvedModule(dirPath, name, mode, redirectedReference) + }); + typeReferenceDirectiveResolutionCache?.setOldResolutionCache({ + getResolved: (dirPath, name, mode, redirectedReference) => + oldBuildInfoProgram?.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference) + }); + } } // Map from a stringified PackageId to the source file with that id. @@ -1380,7 +1364,7 @@ namespace ts { // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; oldBuildInfoProgram = undefined; - oldProgramOrOldBuildInfoProgram = undefined; + oldProgramOrOldBuildInfoProgramConstructor = undefined; const program: Program = { getRootFileNames: () => rootNames, @@ -1650,7 +1634,6 @@ namespace ts { const oldResolution = !oldBuildInfoProgram ? oldSourceFile?.resolvedModules?.get(moduleName, mode) : oldBuildInfoProgram.getResolvedModule( - oldBuildInfoProgramResolutionHost!, getDirectoryPath(file.path), moduleName, mode, @@ -1824,7 +1807,6 @@ namespace ts { const oldResolution = !oldBuildInfoProgram ? (containingSourceFile ? oldSourceFile?.resolvedTypeReferenceDirectiveNames : oldProgram?.getAutomaticTypeDirectiveResolutions())?.get(typeDirectiveName, mode) : oldBuildInfoProgram.getResolvedTypeReferenceDirective( - oldBuildInfoProgramResolutionHost!, getDirectoryPath(containingSourceFile? containingSourceFile.path : toPath(inferredTypeFile!)), typeDirectiveName, mode, @@ -1913,13 +1895,13 @@ namespace ts { function tryReuseStructureFromOldProgram(): StructureIsReused { // check properties that can affect structure of the program or module resolution strategy // if any of these properties has changed - structure cannot be reused - const oldOptions = oldProgramOrOldBuildInfoProgram?.getCompilerOptions(); + const oldOptions = oldProgram?.getCompilerOptions() || oldBuildInfoProgram?.getCompilerOptions(); if (!oldOptions || changesAffectModuleResolution(oldOptions, options)) { return StructureIsReused.Not; } const result = tryReuseStructureFromOldProgramWorker(); - return options.cacheResolutions && oldProgramOrOldBuildInfoProgram && result === StructureIsReused.Not ? + return options.cacheResolutions && (oldProgram || oldBuildInfoProgram) && result === StructureIsReused.Not ? StructureIsReused.SafeModuleCache : result; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5260d44b06e6e..8439c9fd9975f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6607,7 +6607,7 @@ namespace ts { } /*@internal*/ - export interface OldBuildInfoProgramResolutionHost { + export interface OldBuildInfoProgramHost { fileExists(fileName: string): boolean; createHash?(data: string): string; getPackageJsonInfo(fileName: string): PackageJsonInfoCacheEntry | undefined; @@ -6615,16 +6615,13 @@ namespace ts { /*@internal*/ export interface OldBuildInfoProgram { getCompilerOptions(): CompilerOptions; - clearRedirectsMap(): void; getResolvedModule( - host: OldBuildInfoProgramResolutionHost, dirPath: Path, name: string, mode: ResolutionMode, redirectedReference: ResolvedProjectReference | undefined, ): ResolvedModuleWithFailedLookupLocations | undefined; getResolvedTypeReferenceDirective( - host: OldBuildInfoProgramResolutionHost, dirPath: Path, name: string, mode: ResolutionMode, @@ -6633,7 +6630,10 @@ namespace ts { } /*@internal*/ - export type CreateProgramOptionsWithOldBuildInfoProgram = Omit & { oldProgram?: OldBuildInfoProgram | Program; }; + export type OldBuildInfoProgramConstructor = (host: OldBuildInfoProgramHost) => OldBuildInfoProgram | undefined; + + /*@internal*/ + export type CreateProgramOptionsWithOldBuildInfoProgramConstructor = Omit & { oldProgram?: Program | OldBuildInfoProgramConstructor; }; /* @internal */ export interface CommandLineOptionBase { diff --git a/src/server/session.ts b/src/server/session.ts index 8dfa54a3645c8..fe6125c3abc3c 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1378,7 +1378,7 @@ namespace ts.server { const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex); const packageJsonCache = project.getModuleResolutionCache()?.getPackageJsonInfoCache(); const compilerOptions = project.getCompilationSettings(); - const packageJson = getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions); + const packageJson = getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); if (!packageJson) return undefined; // Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext - // Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be diff --git a/src/services/services.ts b/src/services/services.ts index 19547cb9d112f..c76ac74100efb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1272,7 +1272,7 @@ namespace ts { return sourceFile; } - function getOldProgram(options: CompilerOptions, compilerHost: CompilerHost): Program | OldBuildInfoProgram | undefined { + function getOldProgram(options: CompilerOptions, compilerHost: CompilerHost): Program | OldBuildInfoProgramConstructor | undefined { if (program) return program; if (!options.cacheResolutions) return undefined; const buildInfoResult = readBuildInfoForProgram(options, compilerHost); @@ -1283,11 +1283,12 @@ namespace ts { convertToOptionsWithAbsolutePaths(buildInfoResult.buildInfo.program.options, buildInfoFilePathDecoder.toAbsolutePath) : {}; compilerOptions.configFilePath = options.configFilePath; - return createOldBuildInfoProgram( + return host => createOldBuildInfoProgram( + host, compilerOptions, /*cacheResolutions*/ undefined, { - cache: buildInfoResult.buildInfo.program.cacheResolutions, + cache: buildInfoResult.buildInfo.program!.cacheResolutions!, getProgramBuildInfoFilePathDecoder: () => buildInfoFilePathDecoder, }, ); diff --git a/tests/baselines/reference/tsc/cacheResolutions/diagnostics-from-cache.js b/tests/baselines/reference/tsc/cacheResolutions/diagnostics-from-cache.js index d78122d233a2b..eb7f436a8ac24 100644 --- a/tests/baselines/reference/tsc/cacheResolutions/diagnostics-from-cache.js +++ b/tests/baselines/reference/tsc/cacheResolutions/diagnostics-from-cache.js @@ -92,7 +92,7 @@ exports.x = 10; //// [/src/project/dist/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../lib/lib.d.ts","../index.ts","../index2.ts","../randomfileforimport.ts","..","../package.json"],"fileInfos":[{"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,"impliedFormat":1},{"version":"5618920854-import * as me from \"@this/package\";\nme.thing()\nexport function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"5871974342-export function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"-10726455937-export const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n","impliedFormat":99}],"options":{"cacheResolutions":true,"declaration":true,"declarationDir":"../types","moduleResolution":99,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[2,1]],"exportedModulesMap":[],"cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2,"isExternalLibraryImport":true},"resolutionDiagnostics":[{"packagePath":6}]}],"names":["@this/package"],"resolutionEntries":[[1,1,99]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../lib/lib.d.ts","../index.ts","../index2.ts","../randomfileforimport.ts","..","../package.json"],"fileInfos":[{"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,"impliedFormat":1},{"version":"5618920854-import * as me from \"@this/package\";\nme.thing()\nexport function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"5871974342-export function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"-10726455937-export const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n","impliedFormat":99}],"options":{"cacheResolutions":true,"declaration":true,"declarationDir":"../types","moduleResolution":99,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[2,1]],"exportedModulesMap":[],"cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2,"isExternalLibraryImport":true},"affectingLocations":[6],"resolutionDiagnostics":[{"packagePath":6}]}],"names":["@this/package"],"hash":[[6,"25383995153-{\"name\":\"@this/package\",\"type\":\"module\",\"exports\":{\".\":{\"default\":\"./dist/index.js\",\"types\":\"./types/index.d.ts\"}}}"]],"resolutionEntries":[[1,1,99]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"} //// [/src/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -154,6 +154,9 @@ exports.x = 10; "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -164,6 +167,12 @@ exports.x = 10; "names": [ "@this/package" ], + "hash": [ + [ + "../package.json", + "25383995153-{\"name\":\"@this/package\",\"type\":\"module\",\"exports\":{\".\":{\"default\":\"./dist/index.js\",\"types\":\"./types/index.d.ts\"}}}" + ] + ], "resolutionEntries": [ [ "@this/package", @@ -173,6 +182,9 @@ exports.x = 10; "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -194,6 +206,9 @@ exports.x = 10; "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -208,7 +223,7 @@ exports.x = 10; } }, "version": "FakeTSVersion", - "size": 1560 + "size": 1748 } //// [/src/project/types/index.d.ts] @@ -237,6 +252,7 @@ Output:: /lib/tsc -p /src/project --incremental --explainFiles Found 'package.json' at '/src/project/package.json'. 'package.json' does not have a 'typesVersions' field. +File '/src/project/package.json' exists according to earlier cached lookups. Reusing resolution of module '@this/package' from '/src/project/index.ts' found in cache from location '/src/project', it was successfully resolved to '/src/project/index.ts'. File '/src/project/package.json' exists according to earlier cached lookups. File '/src/project/package.json' exists according to earlier cached lookups. @@ -263,7 +279,7 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated //// [/src/project/dist/randomFileForImport.js] file written with same contents //// [/src/project/dist/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../lib/lib.d.ts","../index.ts","../index2.ts","../randomfileforimport.ts","..","../package.json"],"fileInfos":[{"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,"impliedFormat":1},{"version":"5618920854-import * as me from \"@this/package\";\nme.thing()\nexport function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"5871974342-export function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"4314805146-import * as me from \"@this/package\";\nexport const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n","impliedFormat":99}],"options":{"cacheResolutions":true,"declaration":true,"declarationDir":"../types","moduleResolution":99,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[2,1],[4,1]],"exportedModulesMap":[],"cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2,"isExternalLibraryImport":true},"resolutionDiagnostics":[{"packagePath":6}]}],"names":["@this/package"],"resolutionEntries":[[1,1,99]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../lib/lib.d.ts","../index.ts","../index2.ts","../randomfileforimport.ts","..","../package.json"],"fileInfos":[{"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,"impliedFormat":1},{"version":"5618920854-import * as me from \"@this/package\";\nme.thing()\nexport function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"5871974342-export function thing(): void {}\n","signature":"-4018078458-export declare function thing(): void;\r\n","impliedFormat":99},{"version":"4314805146-import * as me from \"@this/package\";\nexport const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n","impliedFormat":99}],"options":{"cacheResolutions":true,"declaration":true,"declarationDir":"../types","moduleResolution":99,"outDir":"./"},"fileIdsList":[[2]],"referencedMap":[[2,1],[4,1]],"exportedModulesMap":[],"cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2,"isExternalLibraryImport":true},"affectingLocations":[6],"resolutionDiagnostics":[{"packagePath":6}]}],"names":["@this/package"],"hash":[[6,"25383995153-{\"name\":\"@this/package\",\"type\":\"module\",\"exports\":{\".\":{\"default\":\"./dist/index.js\",\"types\":\"./types/index.d.ts\"}}}"]],"resolutionEntries":[[1,1,99]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"} //// [/src/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -328,6 +344,9 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -338,6 +357,12 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated "names": [ "@this/package" ], + "hash": [ + [ + "../package.json", + "25383995153-{\"name\":\"@this/package\",\"type\":\"module\",\"exports\":{\".\":{\"default\":\"./dist/index.js\",\"types\":\"./types/index.d.ts\"}}}" + ] + ], "resolutionEntries": [ [ "@this/package", @@ -347,6 +372,9 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -368,6 +396,9 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated "resolvedFileName": "../index.ts", "isExternalLibraryImport": true }, + "affectingLocations": [ + "../package.json" + ], "resolutionDiagnostics": [ { "packagePath": "../package.json" @@ -382,7 +413,7 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated } }, "version": "FakeTSVersion", - "size": 1604 + "size": 1792 } //// [/src/project/types/randomFileForImport.d.ts] file written with same contents diff --git a/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-already-built.js b/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-already-built.js index 8711a655e5afc..f63b390f4dd20 100644 --- a/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-already-built.js +++ b/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-already-built.js @@ -609,11 +609,29 @@ FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg0/package.json 2000 undefined package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg1/package.json 2000 undefined package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg2/package.json 2000 undefined package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg3/package.json 2000 undefined package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Type roots +DirectoryWatcher:: Triggered with /src/project/fileWithImports.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithImports.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithImports.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithImports.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForImport.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForImport.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForImport.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForImport.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithImports.ts:2:40 - error TS2307: Cannot find module 'pkg1' or its corresponding type declarations. 2 import type { RequireInterface1 } from "pkg1" assert { "resolution-mode": "require" }; @@ -699,6 +717,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -1207,6 +1226,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -1678,6 +1698,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -2086,6 +2107,8 @@ File '/package.json' does not exist according to earlier cached lookups. File '/a/lib/package.json' does not exist according to earlier cached lookups. File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithTypeRefs.ts:2:23 - error TS2688: Cannot find type definition file for 'pkg3'. 2 /// @@ -3274,6 +3297,8 @@ File '/package.json' does not exist according to earlier cached lookups. FileWatcher:: Close:: WatchInfo: /src/project/node_modules/pkg1/require.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithImports.ts:2:40 - error TS2307: Cannot find module 'pkg1' or its corresponding type declarations. 2 import type { RequireInterface1 } from "pkg1" assert { "resolution-mode": "require" }; @@ -3355,6 +3380,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: @@ -3821,6 +3847,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations ../../a/lib/lib.d.ts Default library for target 'es3' node_modules/pkg0/import.d.ts @@ -5241,6 +5269,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations randomFileForImport.ts:1:39 - error TS2307: Cannot find module 'pkg0' or its corresponding type declarations. 1 import type { ImportInterface0 } from "pkg0" assert { "resolution-mode": "import" }; @@ -5297,6 +5327,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: @@ -5612,6 +5643,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: diff --git a/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario.js b/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario.js index f4e05e2a24a5b..818fd7bf11737 100644 --- a/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario.js +++ b/tests/baselines/reference/tscWatch/cacheResolutions/caching-resolutions-in-multi-file-scenario.js @@ -189,11 +189,31 @@ FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg0/package.json 2000 undefined package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg1/package.json 2000 undefined package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg2/package.json 2000 undefined package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg3/package.json 2000 undefined package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Type roots +DirectoryWatcher:: Triggered with /src/project/fileWithImports.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithImports.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithImports.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithImports.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/fileWithTypeRefs.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForImport.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForImport.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForImport.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForImport.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.js :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/randomFileForTypeRef.d.ts :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +DirectoryWatcher:: Triggered with /src/project/tsconfig.tsbuildinfo :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/tsconfig.tsbuildinfo :: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithImports.ts:2:40 - error TS2307: Cannot find module 'pkg1' or its corresponding type declarations. 2 import type { RequireInterface1 } from "pkg1" assert { "resolution-mode": "require" }; @@ -227,6 +247,8 @@ node_modules/@types/pkg4/index.d.ts Entry point for implicit type library 'pkg4' [12:01:18 AM] Found 3 errors. Watching for file changes. +DirectoryWatcher:: Triggered with /src/project/tsconfig.tsbuildinfo.readable.baseline.txt :: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Triggered with /src/project/tsconfig.tsbuildinfo.readable.baseline.txt :: WatchInfo: /src/project 0 undefined Failed Lookup Locations DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Wild card directory @@ -295,6 +317,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -803,6 +826,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -1274,6 +1298,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules: @@ -1682,6 +1707,8 @@ File '/package.json' does not exist according to earlier cached lookups. File '/a/lib/package.json' does not exist according to earlier cached lookups. File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithTypeRefs.ts:2:23 - error TS2688: Cannot find type definition file for 'pkg3'. 2 /// @@ -2870,6 +2897,8 @@ File '/package.json' does not exist according to earlier cached lookups. FileWatcher:: Close:: WatchInfo: /src/project/node_modules/pkg1/require.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations fileWithImports.ts:2:40 - error TS2307: Cannot find module 'pkg1' or its corresponding type declarations. 2 import type { RequireInterface1 } from "pkg1" assert { "resolution-mode": "require" }; @@ -2951,6 +2980,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: @@ -3417,6 +3447,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Failed Lookup Locations ../../a/lib/lib.d.ts Default library for target 'es3' node_modules/pkg0/import.d.ts @@ -4837,6 +4869,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Failed Lookup Locations randomFileForImport.ts:1:39 - error TS2307: Cannot find module 'pkg0' or its corresponding type declarations. 1 import type { ImportInterface0 } from "pkg0" assert { "resolution-mode": "import" }; @@ -4893,6 +4927,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: @@ -5208,6 +5243,7 @@ WatchedFiles:: FsWatches:: /src/project: {"directoryName":"/src/project"} + {"directoryName":"/src/project"} FsWatchesRecursive:: /src/project/node_modules/@types: diff --git a/tests/baselines/reference/tscWatch/moduleResolution/diagnostics-from-cache.js b/tests/baselines/reference/tscWatch/moduleResolution/diagnostics-from-cache.js index 73a18ff34db55..d80981a5015b3 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/diagnostics-from-cache.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/diagnostics-from-cache.js @@ -76,6 +76,8 @@ WatchedFiles:: {"fileName":"/user/username/projects/myproject/index2.ts","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/package.json: + {"fileName":"/user/username/projects/myproject/package.json","pollingInterval":250} /user/username/projects/myproject/node_modules/@types: {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500} @@ -172,6 +174,8 @@ WatchedFiles:: {"fileName":"/user/username/projects/myproject/index2.ts","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/package.json: + {"fileName":"/user/username/projects/myproject/package.json","pollingInterval":250} /user/username/projects/myproject/node_modules/@types: {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500} diff --git a/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-file-are-partially-used.js b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-file-are-partially-used.js index 0b96bb43ca769..1ccb720ae24ee 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-file-are-partially-used.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-file-are-partially-used.js @@ -164,6 +164,8 @@ WatchedFiles:: {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500} FsWatches:: +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject"} FsWatchesRecursive:: /user/username/projects/myproject/node_modules: @@ -278,6 +280,8 @@ WatchedFiles:: {"fileName":"/user/username/projects/myproject/node_modules/@types","pollingInterval":500} FsWatches:: +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject"} FsWatchesRecursive:: /user/username/projects/myproject/node_modules: diff --git a/tests/baselines/reference/tscWatch/nodenext watch emit/esm-mode-file-is-edited.js b/tests/baselines/reference/tscWatch/nodenext watch emit/esm-mode-file-is-edited.js index 1a8aa1657c94b..fb22082de4759 100644 --- a/tests/baselines/reference/tscWatch/nodenext watch emit/esm-mode-file-is-edited.js +++ b/tests/baselines/reference/tscWatch/nodenext watch emit/esm-mode-file-is-edited.js @@ -63,6 +63,8 @@ WatchedFiles:: {"fileName":"/project/src/index.ts","pollingInterval":250} /a/lib/lib.es2020.full.d.ts: {"fileName":"/a/lib/lib.es2020.full.d.ts","pollingInterval":250} +/project/package.json: + {"fileName":"/project/package.json","pollingInterval":250} /project/node_modules/@types: {"fileName":"/project/node_modules/@types","pollingInterval":500} @@ -119,6 +121,8 @@ WatchedFiles:: {"fileName":"/project/src/index.ts","pollingInterval":250} /a/lib/lib.es2020.full.d.ts: {"fileName":"/a/lib/lib.es2020.full.d.ts","pollingInterval":250} +/project/package.json: + {"fileName":"/project/package.json","pollingInterval":250} /project/node_modules/@types: {"fileName":"/project/node_modules/@types","pollingInterval":500} diff --git a/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-built.js b/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-built.js index 9abd6081d5d9e..692606327e193 100644 --- a/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-built.js +++ b/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-built.js @@ -122,6 +122,8 @@ File '/package.json' does not exist according to earlier cached lookups. FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg0/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg1/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg2/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg3/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file @@ -390,6 +392,8 @@ File '/package.json' does not exist according to earlier cached lookups. File '/a/lib/package.json' does not exist according to earlier cached lookups. File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (9) @@ -681,6 +685,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (9) @@ -823,6 +829,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 7 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (10) @@ -1114,6 +1122,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 10 structureChanged: true structureIsReused:: SafeModuleCache Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (5) diff --git a/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-not-built.js b/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-not-built.js index 19c27a9924741..1b15bf423b110 100644 --- a/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-not-built.js +++ b/tests/baselines/reference/tsserver/cacheResolutions/caching-resolutions-in-multi-file-scenario-when-project-is-not-built.js @@ -144,6 +144,8 @@ File '/package.json' does not exist according to earlier cached lookups. FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg0/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg1/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg2/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file FileWatcher:: Added:: WatchInfo: /src/project/node_modules/pkg3/package.json 2000 undefined Project: /src/project/tsconfig.json WatchType: package.json file @@ -412,6 +414,8 @@ File '/package.json' does not exist according to earlier cached lookups. File '/a/lib/package.json' does not exist according to earlier cached lookups. File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (9) @@ -703,6 +707,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (9) @@ -845,6 +851,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 7 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (10) @@ -1136,6 +1144,8 @@ File '/a/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 10 structureChanged: true structureIsReused:: SafeModuleCache Elapsed:: *ms Project '/src/project/tsconfig.json' (Configured) Files (5)