Handle project reference redirects for the module and type reference resolutions

This commit is contained in:
Sheetal Nandi
2022-12-09 14:49:21 -08:00
parent 23cfc79fdc
commit 0132dc0b1d
24 changed files with 27465 additions and 94 deletions
+129 -42
View File
@@ -9,6 +9,7 @@ import {
BuilderState,
BuildInfo,
BundleBuildInfo,
CacheWithRedirects,
CancellationToken,
CommandLineOption,
compareStringsCaseSensitive,
@@ -22,8 +23,10 @@ import {
concatenate,
convertToOptionsWithAbsolutePaths,
createBuildInfo,
createCacheWithRedirects,
createGetCanonicalFileName,
createModeAwareCache,
createPerDirectoryResolutionCache,
createProgram,
CustomTransformers,
Debug,
@@ -74,6 +77,7 @@ import {
OldBuildInfoProgramHost,
outFile,
Path,
PerDirectoryResolutionCache,
Program,
ProjectReference,
ReadBuildProgramHost,
@@ -81,6 +85,7 @@ import {
ResolutionMode,
ResolvedModuleFull,
ResolvedModuleWithFailedLookupLocations,
ResolvedProjectReference,
ResolvedTypeReferenceDirective,
ResolvedTypeReferenceDirectiveWithFailedLookupLocations,
returnFalse,
@@ -174,8 +179,8 @@ export interface ReusableBuilderProgramState extends BuilderState {
*/
bundle?: BundleBuildInfo;
cacheResolutions?: {
modules: Map<Path, ModeAwareCache<ResolvedModuleWithFailedLookupLocations>> | undefined;
typeRefs: Map<Path, ModeAwareCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>> | undefined;
modules: PerDirectoryResolutionCache<ResolvedModuleWithFailedLookupLocations> | undefined;
typeRefs: PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations> | undefined;
};
resuableCacheResolutions?: {
cache: ProgramBuildInfoCacheResolutions;
@@ -968,12 +973,22 @@ export type ProgramBuildInfoResolutionEntryId = number & { __programBuildInfoRes
/** @internal */
export type ProgramBuildInfoResolutionCache = [dirId: ProgramBuildInfoFileId, resolutions: readonly ProgramBuildInfoResolutionEntryId[]][];
/** @internal */
export interface ProgramBuildInfoResolutionRedirectsCache {
options: CompilerOptions | undefined;
cache: ProgramBuildInfoResolutionCache;
}
/** @internal */
export type ProgramBuildInfoResolutionCacheWithRedirects = ProgramBuildInfoResolutionCache | {
own: ProgramBuildInfoResolutionCache | undefined;
redirects: readonly ProgramBuildInfoResolutionRedirectsCache[];
};
/** @internal */
export interface ProgramBuildInfoCacheResolutions {
resolutions: readonly ProgramBuildInfoResolution[];
names: readonly string[];
resolutionEntries: readonly ProgramBuildInfoResolutionEntry[];
modules: ProgramBuildInfoResolutionCache | undefined;
typeRefs: ProgramBuildInfoResolutionCache | undefined;
modules: ProgramBuildInfoResolutionCacheWithRedirects | undefined;
typeRefs: ProgramBuildInfoResolutionCacheWithRedirects | undefined;
}
/** @internal */
export interface ProgramMultiFileEmitBuildInfo {
@@ -1050,11 +1065,11 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
{ version: value.version, impliedFormat: value.impliedFormat, signature: undefined, affectsGlobalScope: undefined } :
value.version;
});
const cacheResolutions = toProgramBuildInfoResolutions();
const cacheResolutions = toProgramBuildInfoCacheResolutions();
const program: ProgramBundleEmitBuildInfo = {
fileNames,
fileInfos,
options: toProgramBuildInfoCompilerOptions(state.compilerOptions),
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, /*affectsBuildInfo*/ true, !!state.compilerOptions.cacheResolutions),
outSignature: state.outSignature,
latestChangedDtsFile,
pendingEmit: !state.programEmitPending ?
@@ -1173,11 +1188,11 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
}
}
const cacheResolutions = toProgramBuildInfoResolutions();
const cacheResolutions = toProgramBuildInfoCacheResolutions();
const program: ProgramMultiFileEmitBuildInfo = {
fileNames,
fileInfos,
options: toProgramBuildInfoCompilerOptions(state.compilerOptions),
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, /*affectsBuildInfo*/ true, !!state.compilerOptions.cacheResolutions),
fileIdsList,
referencedMap,
exportedModulesMap,
@@ -1226,18 +1241,25 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
return fileIdListId;
}
function toProgramBuildInfoCompilerOptions(options: CompilerOptions) {
/**
* @param affectsBuildInfo should seraialize the option if it is marked as affectsBuildInfo
* @param affectsModuleResolution should serialize the option if marked as affectsModuleResolution
*/
function toProgramBuildInfoCompilerOptions(options: CompilerOptions, affectsBuildInfo: boolean, affectsModuleResolution: boolean) {
let result: CompilerOptions | undefined;
const considerModuleResolution = options.cacheResolutions;
const { optionsNameMap } = getOptionsNameMap();
for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
const optionInfo = optionsNameMap.get(name.toLowerCase());
if (optionInfo?.affectsBuildInfo || considerModuleResolution && optionInfo?.affectsModuleResolution) {
if ((affectsBuildInfo && optionInfo?.affectsBuildInfo) || (affectsModuleResolution && optionInfo?.affectsModuleResolution)) {
(result ??= {})[name] = toReusableCompilerOptionValue(
optionInfo,
options[name] as CompilerOptionsValue,
);
}
else if (affectsModuleResolution && name === "pathsBasePath") {
(result ??= {}).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath!);
continue;
}
}
return result;
}
@@ -1279,10 +1301,10 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
return array?.length ? array.map(map) : undefined;
}
function toProgramBuildInfoResolutions(): ProgramBuildInfoCacheResolutions | undefined {
function toProgramBuildInfoCacheResolutions(): ProgramBuildInfoCacheResolutions | undefined {
const cacheResolutions = getCacheResolutions(state);
const modules = toProgramBuildInfoResolutionCache(cacheResolutions?.modules);
const typeRefs = toProgramBuildInfoResolutionCache(cacheResolutions?.typeRefs);
const modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions?.modules?.perDirectoryMap);
const typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions?.typeRefs?.perDirectoryMap);
if (!resolutions) return;
Debug.assertIsDefined(names);
Debug.assertIsDefined(resolutionEntries);
@@ -1304,8 +1326,30 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
return state.resuableCacheResolutions.cache;
}
function toProgramBuildInfoResolutionCacheWithRedirects<T extends ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations>(
cache: CacheWithRedirects<Path, ModeAwareCache<T>> | undefined
): ProgramBuildInfoResolutionCacheWithRedirects | undefined {
if (!cache) return undefined;
const ownMap = cache.getOwnMap();
const own = toProgramBuildInfoResolutionCache(ownMap);
const seenMaps = new Set<Map<Path, ModeAwareCache<T>>>();
seenMaps.add(ownMap);
let redirects: ProgramBuildInfoResolutionRedirectsCache[] | undefined;
cache.redirectsMap.forEach((map, options) => {
if (!tryAddToSet(seenMaps, map)) return;
const redirectCache = toProgramBuildInfoResolutionCache(map);
if (redirectCache) {
(redirects ??= []).push({
options: toProgramBuildInfoCompilerOptions(options, /*affectsBuildInfo*/ false, /*affectsModuleResolution*/ true),
cache: redirectCache
});
}
});
return !redirects ? own : { own, redirects };
}
function toProgramBuildInfoResolutionCache<T extends ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations>(
cache: Map<Path, ModeAwareCache<T>> | undefined,
cache: Map<Path, ModeAwareCache<T>>
): ProgramBuildInfoResolutionCache | undefined {
return cache && arrayFrom(cache.entries(), ([dirPath, dirCache]) => {
const dirId = toFileId(dirPath);
@@ -1375,37 +1419,47 @@ function getBuildInfo(state: BuilderProgramState, bundle: BundleBuildInfo | unde
function getCacheResolutions(state: BuilderProgramState) {
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions) return state.cacheResolutions;
let modules: Map<Path, ModeAwareCache<ResolvedModuleWithFailedLookupLocations>> | undefined;
let typeRefs: Map<Path, ModeAwareCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>> | undefined;
let modules: PerDirectoryResolutionCache<ResolvedModuleWithFailedLookupLocations> | undefined;
let typeRefs: PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations> | undefined;
for (const f of state.program!.getSourceFiles()) {
const containingPath = getDirectoryPath(f.path);
modules = toPerDirectoryCache(modules, getOriginalOrResolvedModuleFileName, f.resolvedModules, containingPath);
typeRefs = toPerDirectoryCache(typeRefs, getOriginalOrResolvedTypeReferenceFileName, f.resolvedTypeReferenceDirectiveNames, containingPath);
modules = toPerDirectoryCache(state, modules, getOriginalOrResolvedModuleFileName, f.resolvedModules, f);
typeRefs = toPerDirectoryCache(state, typeRefs, getOriginalOrResolvedTypeReferenceFileName, f.resolvedTypeReferenceDirectiveNames, f);
}
const automaticTypeDirectiveNames = state.program!.getAutomaticTypeDirectiveNames();
if (automaticTypeDirectiveNames.length) {
const currentDirectory = state.program!.getCurrentDirectory();
const containingDirectory = state.compilerOptions.configFilePath ? getDirectoryPath(state.compilerOptions.configFilePath) : currentDirectory;
const containingPath = toPath(containingDirectory, currentDirectory, state.program!.getCanonicalFileName);
typeRefs = toPerDirectoryCache(typeRefs, getOriginalOrResolvedTypeReferenceFileName, state.program!.getAutomaticTypeDirectiveResolutions(), containingPath);
typeRefs = toPerDirectoryCache(state, typeRefs, getOriginalOrResolvedTypeReferenceFileName, state.program!.getAutomaticTypeDirectiveResolutions(), containingPath);
}
return state.cacheResolutions = { modules, typeRefs };
}
function toPerDirectoryCache<T>(
perDirCache: Map<Path, ModeAwareCache<T>> | undefined,
state: BuilderProgramState,
perDirCache: PerDirectoryResolutionCache<T> | undefined,
getResolvedFileName: (resolved: T) => string | undefined,
cache: ModeAwareCache<T> | undefined,
dirPath: Path,
): Map<Path, ModeAwareCache<T>> | undefined {
fOrDirPath: SourceFile | Path,
): PerDirectoryResolutionCache<T> | undefined {
if (!cache?.size()) return perDirCache;
let dirCache = perDirCache?.get(dirPath);
let dirPath: Path, redirectedReference: ResolvedProjectReference | undefined;
if (!isString(fOrDirPath)) {
redirectedReference = state.program!.getRedirectReferenceForResolution(fOrDirPath);
dirPath = getDirectoryPath(fOrDirPath.path);
}
else {
dirPath = fOrDirPath;
}
let dirCache = perDirCache?.perDirectoryMap.getMapOfCacheRedirects(redirectedReference)?.get(dirPath);
cache.forEach((resolution, name, mode) => {
if (!getResolvedFileName(resolution)) return;
// TODO:: (shkamat) redirected references
if (dirCache?.has(name, mode)) return;
if (!dirCache) (perDirCache ??= new Map()).set(dirPath, dirCache = createModeAwareCache());
dirCache.set(name, mode, resolution);
(dirCache ??= (perDirCache ??= createPerDirectoryResolutionCache(
state.program!.getCurrentDirectory(),
state.program!.getCanonicalFileName,
state.compilerOptions,
)).getOrCreateCacheForDirectoryWithPath(dirPath, redirectedReference)).set(name, mode, resolution);
});
return perDirCache;
}
@@ -2039,9 +2093,10 @@ export function createOldBuildInfoProgram(
type Resolution = ResolvedModuleWithFailedLookupLocations & ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
type ResolutionEntry = [name: string, resolutionId: ProgramBuildInfoResolutionId, mode: ResolutionMode];
type BuildInfoResolutionEntriesOrModeAwareCache = readonly ProgramBuildInfoResolutionEntryId[] | ModeAwareCache<ProgramBuildInfoResolutionId>;
interface ReusableResolutionsCache {
reusable?: ProgramBuildInfoResolutionCache;
decoded?: Map<Path, readonly ProgramBuildInfoResolutionEntryId[] | ModeAwareCache<ProgramBuildInfoResolutionId>>;
reusable?: ProgramBuildInfoResolutionCacheWithRedirects;
decoded?: CacheWithRedirects<Path, BuildInfoResolutionEntriesOrModeAwareCache>;
}
const reusableResolvedModules = intializeReusableResolutionsCache(resuableCacheResolutions?.cache.modules);
const reusableResolvedTypeRefs = intializeReusableResolutionsCache(resuableCacheResolutions?.cache.typeRefs);
@@ -2049,25 +2104,27 @@ export function createOldBuildInfoProgram(
let resolutionEntries: ResolutionEntry[] | undefined;
return {
getCompilerOptions: () => compilerOptions,
getResolvedModule: (name, mode, dirPath) => getResolvedFromCache(
getResolvedModule: (name, mode, dirPath, redirectedReference) => getResolvedFromCache(
cacheResolutions?.modules,
getOriginalOrResolvedModuleFileName,
reusableResolvedModules,
name,
mode,
dirPath,
redirectedReference,
),
getResolvedTypeReferenceDirective: (name, mode, dirPath) => getResolvedFromCache(
getResolvedTypeReferenceDirective: (name, mode, dirPath, redirectedReference) => getResolvedFromCache(
cacheResolutions?.typeRefs,
getOriginalOrResolvedTypeReferenceFileName,
reusableResolvedTypeRefs,
name,
mode,
dirPath,
redirectedReference,
),
};
function intializeReusableResolutionsCache(reusable: ProgramBuildInfoResolutionCache | undefined): ReusableResolutionsCache | undefined {
function intializeReusableResolutionsCache(reusable: ProgramBuildInfoResolutionCacheWithRedirects | undefined): ReusableResolutionsCache | undefined {
return reusable ? { reusable } : undefined;
}
@@ -2078,14 +2135,18 @@ export function createOldBuildInfoProgram(
}
function getResolvedFromCache<T extends ResolvedModuleWithFailedLookupLocations | ResolvedTypeReferenceDirectiveWithFailedLookupLocations>(
cache: Map<Path, ModeAwareCache<T>> | undefined,
cache: PerDirectoryResolutionCache<T> | undefined,
getResolvedFileName: (resolution: T) => string | undefined,
reusableResolutionsCache: ReusableResolutionsCache | undefined,
name: string,
mode: ResolutionMode,
dirPath: Path,
redirectedReference: ResolvedProjectReference | undefined,
): T | undefined {
const fromCache = cache?.get(dirPath)?.get(name, mode);
// Always use current options/redirect options to retrieve the information from cache
const options = redirectedReference?.commandLine.options || host.getCompilerOptions();
// If we are using the cache, directly get from there
const fromCache = cache?.perDirectoryMap.getOrCreateMap(options, /*create*/ false)?.get(dirPath)?.get(name, mode);
if (fromCache) {
// TODO:: symlinks
const resolvedFileName = getResolvedFileName(fromCache);
@@ -2094,22 +2155,48 @@ export function createOldBuildInfoProgram(
if (!reusableResolutionsCache) return undefined;
if (!reusableResolutionsCache.decoded) {
if (!reusableResolutionsCache.reusable) return undefined;
for (const [dirId, entryId] of reusableResolutionsCache.reusable) {
(reusableResolutionsCache.decoded ??= new Map()).set(
resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toFilePath(dirId),
entryId
);
if (isArray(reusableResolutionsCache.reusable)) {
setBuildInfoResolutionEntries(reusableResolutionsCache, reusableResolutionsCache.reusable, compilerOptions);
}
else {
if (reusableResolutionsCache.reusable.own) {
setBuildInfoResolutionEntries(reusableResolutionsCache, reusableResolutionsCache.reusable.own, compilerOptions);
}
for (const { options, cache } of reusableResolutionsCache.reusable.redirects) {
setBuildInfoResolutionEntries(
reusableResolutionsCache,
cache,
options ? convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {},
);
}
}
reusableResolutionsCache.reusable = undefined;
if (!reusableResolutionsCache.decoded) return undefined;
}
let cacheForDir = reusableResolutionsCache.decoded.get(dirPath);
const actualCache = reusableResolutionsCache.decoded.getOrCreateMap(options, /*create*/ false);
let cacheForDir = actualCache?.get(dirPath);
if (!cacheForDir) return undefined;
if (isArray(cacheForDir)) reusableResolutionsCache.decoded.set(dirPath, cacheForDir = toModeAwareCache(cacheForDir));
// If this was not decoded to mode aware cache, decode now
if (isArray(cacheForDir)) actualCache!.set(dirPath, cacheForDir = toModeAwareCache(cacheForDir));
const resolutionId = cacheForDir.get(name, mode);
return resolutionId ? toResolution(resolutionId) as T : undefined;
}
function setBuildInfoResolutionEntries(
reusableResolutionsCache: ReusableResolutionsCache,
cache: ProgramBuildInfoResolutionCache,
options: CompilerOptions,
) {
const map = (reusableResolutionsCache.decoded ??= createCacheWithRedirects(compilerOptions)).getOrCreateMap(options || {}, /*create*/ true);
for (const [dirId, entryId] of cache) {
map.set(
resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toFilePath(dirId),
entryId
);
}
}
function toModeAwareCache(entries: readonly ProgramBuildInfoResolutionEntryId[]) {
const modeAwareCache = createModeAwareCache<ProgramBuildInfoResolutionId>();
for (const entryId of entries) {
+3
View File
@@ -2801,6 +2801,9 @@ export function convertToOptionsWithAbsolutePaths(options: CompilerOptions, toAb
if (result.configFilePath) {
result.configFilePath = toAbsolutePath(result.configFilePath);
}
if (result.pathsBasePath) {
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
}
return result;
}
+28 -9
View File
@@ -705,8 +705,10 @@ export interface ModeAwareCache<T> {
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
export interface PerDirectoryResolutionCache<T> {
/** @internal*/ perDirectoryMap: CacheWithRedirects<Path, ModeAwareCache<T>>;
getFromDirectoryCache(name: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined): T | undefined;
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): ModeAwareCache<T>;
/** @internal*/ getOrCreateCacheForDirectoryWithPath(directory: Path, redirectedReference: ResolvedProjectReference | undefined): ModeAwareCache<T>;
clear(): void;
/**
* Updates with the current compilerOptions the cache will operate with.
@@ -780,13 +782,18 @@ export function getKeyForCompilerOptions(options: CompilerOptions, affectingOpti
export interface CacheWithRedirects<K, V> {
getMapOfCacheRedirects(redirectedReference: ResolvedProjectReference | undefined): Map<K, V> | undefined;
getOrCreateMapOfCacheRedirects(redirectedReference: ResolvedProjectReference | undefined): Map<K, V>;
getOrCreateMap(redirectOptions: CompilerOptions, create: true): Map<K, V>;
getOrCreateMap(redirectOptions: CompilerOptions, create: false): Map<K, V> | undefined;
update(newOptions: CompilerOptions): void;
clear(): void;
getOwnMap(): Map<K, V>;
redirectsMap: Map<CompilerOptions, Map<K, V>>;
}
/** @internal */
export type RedirectsCacheKey = string & { __compilerOptionsKey: any; };
/** @internal */
export function createCacheWithRedirects<K, V>(ownOptions: CompilerOptions | undefined): CacheWithRedirects<K, V> {
type RedirectsCacheKey = string & { __compilerOptionsKey: any; };
const redirectsMap = new Map<CompilerOptions, Map<K, V>>();
const optionsToRedirectsKey = new Map<CompilerOptions, RedirectsCacheKey>();
const redirectsKeyToMap = new Map<RedirectsCacheKey, Map<K, V>>();
@@ -795,8 +802,11 @@ export function createCacheWithRedirects<K, V>(ownOptions: CompilerOptions | und
return {
getMapOfCacheRedirects,
getOrCreateMapOfCacheRedirects,
getOrCreateMap,
update,
clear,
getOwnMap: () => ownMap,
redirectsMap,
};
function getMapOfCacheRedirects(redirectedReference: ResolvedProjectReference | undefined): Map<K, V> | undefined {
@@ -891,31 +901,40 @@ function getOrCreateCache<K, V>(cacheWithRedirects: CacheWithRedirects<K, V>, re
return result;
}
function createPerDirectoryResolutionCache<T>(currentDirectory: string, getCanonicalFileName: GetCanonicalFileName, options: CompilerOptions | undefined): PerDirectoryResolutionCache<T> {
const directoryToModuleNameMap = createCacheWithRedirects<Path, ModeAwareCache<T>>(options);
/** @internal */
export function createPerDirectoryResolutionCache<T>(currentDirectory: string, getCanonicalFileName: GetCanonicalFileName, options: CompilerOptions | undefined): PerDirectoryResolutionCache<T> {
const perDirectoryMap = createCacheWithRedirects<Path, ModeAwareCache<T>>(options);
return {
perDirectoryMap,
getFromDirectoryCache,
getOrCreateCacheForDirectory,
getOrCreateCacheForDirectoryWithPath,
clear,
update,
};
function clear() {
directoryToModuleNameMap.clear();
perDirectoryMap.clear();
}
function update(options: CompilerOptions) {
directoryToModuleNameMap.update(options);
perDirectoryMap.update(options);
}
function getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference) {
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, () => createModeAwareCache());
return getOrCreateCacheForDirectoryWithPath(toPath(directoryName, currentDirectory, getCanonicalFileName), redirectedReference);
}
function getOrCreateCacheForDirectoryWithPath(directory: Path, redirectedReference: ResolvedProjectReference | undefined) {
return getOrCreateCache(perDirectoryMap, redirectedReference, directory, () => createModeAwareCache());
}
function getFromDirectoryCache(name: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined) {
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
return directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)?.get(path)?.get(name, mode);
return getFromDirectoryCacheWithPath(name, mode, toPath(directoryName, currentDirectory, getCanonicalFileName), redirectedReference);
}
function getFromDirectoryCacheWithPath(name: string, mode: ResolutionMode, directory: Path, redirectedReference: ResolvedProjectReference | undefined) {
return perDirectoryMap.getMapOfCacheRedirects(redirectedReference)?.get(directory)?.get(name, mode);
}
}
+42 -14
View File
@@ -1577,7 +1577,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
let oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
let oldBuildInfoProgram: OldBuildInfoProgram | undefined;
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor(host);
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
fileExists: fileName => host.fileExists(fileName),
getCompilerOptions: () => options,
});
}
// Map from a stringified PackageId to the source file with that id.
@@ -1810,6 +1813,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
getProjectReferenceRedirect,
getResolvedProjectReferenceToRedirect,
getResolvedProjectReferenceByPath,
getRedirectReferenceForResolution,
forEachResolvedProjectReference,
isSourceOfProjectReferenceRedirect,
emitBuildInfo,
@@ -1873,27 +1877,37 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (fromCache) addResolutionDiagnostics(fromCache);
}
function resolveModuleNamesWorker(moduleNames: readonly StringLiteralLike[], containingFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[] {
function resolveModuleNamesWorker(
moduleNames: readonly StringLiteralLike[],
containingFile: SourceFile,
reusedNames: readonly StringLiteralLike[] | undefined,
redirectedReference: ResolvedProjectReference | false | undefined,
): readonly ResolvedModuleWithFailedLookupLocations[] {
if (!moduleNames.length) return emptyArray;
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
const redirectedReference = getRedirectReferenceForResolution(containingFile);
if (redirectedReference === undefined) redirectedReference = getRedirectReferenceForResolution(containingFile);
tracing?.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
performance.mark("beforeResolveModule");
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference || undefined, options, containingFile, reusedNames);
performance.mark("afterResolveModule");
performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
tracing?.pop();
return result;
}
function resolveTypeReferenceDirectiveNamesWorker<T extends FileReference | string>(typeDirectiveNames: T[], containingFile: string | SourceFile, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] {
function resolveTypeReferenceDirectiveNamesWorker<T extends FileReference | string>(
typeDirectiveNames: T[],
containingFile: string | SourceFile,
reusedNames: readonly T[] | undefined,
redirectedReference: ResolvedProjectReference | false | undefined,
): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] {
if (!typeDirectiveNames.length) return [];
const containingSourceFile = !isString(containingFile) ? containingFile : undefined;
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
if (redirectedReference === undefined && containingSourceFile) redirectedReference = getRedirectReferenceForResolution(containingSourceFile);
tracing?.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
performance.mark("beforeResolveTypeReference");
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference || undefined, options, containingSourceFile, reusedNames);
performance.mark("afterResolveTypeReference");
performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
tracing?.pop();
@@ -1981,7 +1995,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (structureIsReused === StructureIsReused.Not && !file.ambientModuleNames.length) {
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
// the best we can do is fallback to the default logic.
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined);
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined, /*redirectedReference*/ undefined);
}
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
@@ -2021,6 +2035,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
let reusedNames: StringLiteralLike[] | undefined;
/** A transient placeholder used to mark predicted resolution in the result list. */
const predictedToResolveToAmbientModuleMarker: ResolvedModuleWithFailedLookupLocations = emptyResolution;
let redirectedReference: ResolvedProjectReference | false | undefined;
for (let i = 0; i < moduleNames.length; i++) {
const moduleName = moduleNames[i];
@@ -2029,7 +2044,12 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
const mode = getModeForUsageLocation(file, moduleName);
const oldResolution = !oldBuildInfoProgram ?
oldSourceFile?.resolvedModules?.get(moduleName.text, mode) :
oldBuildInfoProgram.getResolvedModule(moduleName.text, mode, getDirectoryPath(file.path));
oldBuildInfoProgram.getResolvedModule(
moduleName.text,
mode,
getDirectoryPath(file.path),
(redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined,
);
if (oldResolution?.resolvedModule) {
if (isTraceEnabled(options, host)) {
const fileLocation = getNormalizedAbsolutePath(file.originalFileName, currentDirectory);
@@ -2087,7 +2107,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
}
const resolutions = unknownModuleNames && unknownModuleNames.length
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames, redirectedReference)
: emptyArray;
// Combine results of resolutions and predicted results
@@ -2141,7 +2161,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (structureIsReused === StructureIsReused.Not) {
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
// the best we can do is fallback to the default logic.
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*resuedNames*/ undefined);
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*resuedNames*/ undefined, /*redirectedReference*/ undefined);
}
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : undefined;
@@ -2170,20 +2190,27 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
let result: ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] | undefined;
let reusedNames: T[] | undefined;
const containingSourceFile = !isString(containingFile) ? containingFile : undefined;
const inferredTypeFile = !isString(containingFile) ? undefined : containingFile;
const canReuseResolutions = oldBuildInfoProgram || (!isString(containingFile) ?
containingFile === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path) :
!hasInvalidatedResolutions(toPath(containingFile)));
let redirectedReference: ResolvedProjectReference | false | undefined;
for (let i = 0; i < typeDirectiveNames.length; i++) {
const entry = typeDirectiveNames[i];
if (canReuseResolutions) {
const typeDirectiveName = getTypeReferenceResolutionName(entry);
const mode = getModeForFileReference(entry, containingSourceFile?.impliedNodeFormat);
const oldResolution = !oldBuildInfoProgram ?
(!isString(containingFile) ? oldSourceFile?.resolvedTypeReferenceDirectiveNames : oldProgram?.getAutomaticTypeDirectiveResolutions())?.get(typeDirectiveName, mode) :
oldBuildInfoProgram.getResolvedTypeReferenceDirective(typeDirectiveName, mode, getDirectoryPath(!isString(containingFile) ? containingFile.path : toPath(containingFile)));
(containingSourceFile ? oldSourceFile?.resolvedTypeReferenceDirectiveNames : oldProgram?.getAutomaticTypeDirectiveResolutions())?.get(typeDirectiveName, mode) :
oldBuildInfoProgram.getResolvedTypeReferenceDirective(
typeDirectiveName,
mode,
getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile!)),
containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined,
);
if (oldResolution?.resolvedTypeReferenceDirective) {
if (isTraceEnabled(options, host)) {
const fileLocation = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
const fileLocation = containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile!;
if (!oldBuildInfoProgram) {
trace(host,
oldResolution.resolvedTypeReferenceDirective.packageId ?
@@ -2222,6 +2249,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
unknownTypeReferenceDirectiveNames,
containingFile,
reusedNames,
redirectedReference,
);
// Combine results of resolutions
+2
View File
@@ -417,6 +417,8 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
nonRelativeExternalModuleResolutions.clear();
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
}
function finishCachingPerDirectoryResolution(newProgram: Program | undefined, oldProgram: Program | undefined) {
+4 -2
View File
@@ -4538,6 +4538,7 @@ export interface Program extends ScriptReferenceHost {
/** @internal */ getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined;
/** @internal */ forEachResolvedProjectReference<T>(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined;
/** @internal */ getResolvedProjectReferenceByPath(projectReferencePath: Path): ResolvedProjectReference | undefined;
/** @internal */ getRedirectReferenceForResolution(file: SourceFile): ResolvedProjectReference | undefined;
/** @internal */ isSourceOfProjectReferenceRedirect(fileName: string): boolean;
/** @internal */ getBuildInfo?(bundle: BundleBuildInfo | undefined, buildInfoPath: string): BuildInfo;
/** @internal */ emitBuildInfo(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult;
@@ -6972,13 +6973,14 @@ export interface CreateProgramOptions {
/** @internal */
export interface OldBuildInfoProgram {
getCompilerOptions(): CompilerOptions;
getResolvedModule(name: string, mode: ResolutionMode, dirPath: Path): ResolvedModuleWithFailedLookupLocations | undefined;
getResolvedTypeReferenceDirective(name: string, mode: ResolutionMode, dirPath: Path): ResolvedTypeReferenceDirectiveWithFailedLookupLocations | undefined;
getResolvedModule(name: string, mode: ResolutionMode, dirPath: Path, redirectedReference: ResolvedProjectReference | undefined): ResolvedModuleWithFailedLookupLocations | undefined;
getResolvedTypeReferenceDirective(name: string, mode: ResolutionMode, dirPath: Path, redirectedReference: ResolvedProjectReference | undefined): ResolvedTypeReferenceDirectiveWithFailedLookupLocations | undefined;
}
/** @internal */
export interface OldBuildInfoProgramHost {
fileExists(fileName: string): boolean;
getCompilerOptions(): CompilerOptions;
}
/** @internal */
+2 -1
View File
@@ -615,7 +615,8 @@ export function changesAffectModuleResolution(oldOptions: CompilerOptions, newOp
/** @internal */
export function optionsHaveModuleResolutionChanges(oldOptions: CompilerOptions, newOptions: CompilerOptions) {
return optionsHaveChanges(oldOptions, newOptions, moduleResolutionOptionDeclarations);
return oldOptions.pathsBasePath !== newOptions.pathsBasePath ||
optionsHaveChanges(oldOptions, newOptions, moduleResolutionOptionDeclarations);
}
/** @internal */
@@ -1,9 +1,11 @@
import * as ts from "../../_namespaces/ts";
import {
noChangeRun,
prependText,
verifyTsc,
} from "../tsc/helpers";
import {
getFsWithMultipleProjects,
getFsWithNode16,
getFsWithOut,
getPkgImportContent,
@@ -67,4 +69,62 @@ describe("unittests:: tsbuild:: cacheResolutions::", () => {
},
]
});
verifyTsc({
scenario: "cacheResolutions",
subScenario: "multi project",
fs: getFsWithMultipleProjects,
commandLineArgs: ["-b", "/src/project", "--explainFiles", "--v"],
baselineModulesAndTypeRefs: true,
edits: [
{
caption: "modify aRandomFileForImport by adding import",
edit: fs => prependText(fs, "/src/project/aRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
},
{
caption: "modify bRandomFileForImport by adding import",
edit: fs => prependText(fs, "/src/project/bRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
},
{
caption: "modify cRandomFileForImport by adding import",
edit: fs => prependText(fs, "/src/project/cRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
},
{
caption: "Project build on B",
edit: ts.noop,
commandLineArgs: ["-p", "/src/project/tsconfig.b.json", "--explainFiles"],
discrepancyExplanation: () => [
"During incremental build, build succeeds because everything was built",
"Clean build does not have project build from a so it errors and has extra errors and incorrect buildinfo",
]
},
{
caption: "modify bRandomFileForImport2 by adding import and project build",
edit: fs => prependText(fs, "/src/project/bRandomFileForImport2.ts", `export type { ImportInterface0 } from "pkg0";\n`),
commandLineArgs: ["-p", "/src/project/tsconfig.b.json", "--explainFiles"],
discrepancyExplanation: () => [
"During incremental build, build succeeds because everything was built",
"Clean build does not have project build from a so it errors and has extra errors and incorrect buildinfo",
]
},
{
caption: "Project build on c",
edit: ts.noop,
commandLineArgs: ["-p", "/src/project", "--explainFiles"],
discrepancyExplanation: () => [
"During incremental build, build succeeds because everything was built",
"Clean build does not have project build from a and b so it errors and has extra errors and incorrect buildinfo",
]
},
{
caption: "modify cRandomFileForImport2 by adding import and project build",
edit: fs => prependText(fs, "/src/project/cRandomFileForImport2.ts", `export type { ImportInterface0 } from "pkg0";\n`),
commandLineArgs: ["-p", "/src/project", "--explainFiles"],
discrepancyExplanation: () => [
"During incremental build, build succeeds because everything was built",
"Clean build does not have project build from a and b so it errors and has extra errors and incorrect buildinfo",
]
},
]
});
});
@@ -3,7 +3,6 @@ import {
createServerHost,
createWatchedSystem,
libFile,
TestServerHost,
} from "../virtualFileSystemWithWatch";
import {
loadProjectFromFiles,
@@ -36,7 +35,7 @@ export function getPkgTypeRefContent(type: "Import" | "Require", pkg: number) {
}
`;
}
export function getFsMapWithNode16(): { [path: string]: string; } {
function getFsMapWithNode16(): { [path: string]: string; } {
return {
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
@@ -91,20 +90,18 @@ export function getServerHostWithNode16() {
}
export function getWatchSystemWithNode16WithBuild() {
return getSystemWithBuild(getWatchSystemWithNode16);
}
export function getServerHostWithNode16WithBuild() {
return getSystemWithBuild(getServerHostWithNode16);
}
function getSystemWithBuild(createSystem: () => TestServerHost) {
const system = createSystem();
const system = getWatchSystemWithNode16();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
export function getFsMapWithOut(): { [path: string]: string; } {
export function getServerHostWithNode16WithBuild() {
const system = getServerHostWithNode16();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
function getFsMapWithOut(): { [path: string]: string; } {
return {
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
@@ -152,9 +149,96 @@ export function getServerHostWithOut() {
}
export function getWatchSystemWithOutWithBuild() {
return getSystemWithBuild(getWatchSystemWithOut);
const system = getWatchSystemWithOut();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
export function getServerHostWithOutWithBuild() {
return getSystemWithBuild(getServerHostWithOut);
const system = getServerHostWithOut();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
function getFsMapWithMultipleProjects(): { [path: string]: string; } {
return {
"/src/project/tsconfig.a.json": JSON.stringify({
compilerOptions: {
composite: true,
cacheResolutions: true,
traceResolution: true,
},
files: ["aFileWithImports.ts", "aRandomFileForImport.ts", "aRandomFileForImport2.ts"],
}),
"/src/project/aFileWithImports.ts": Utils.dedent`
import type { ImportInterface0 } from "pkg0";
export { x } from "./aRandomFileForImport";
export { x as x2 } from "./aRandomFileForImport2";
export const y = 10;
`,
"/src/project/aRandomFileForImport.ts": getRandomFileContent(),
"/src/project/aRandomFileForImport2.ts": getRandomFileContent(),
"/src/project/node_modules/pkg0/index.d.ts": getPkgImportContent("Import", 0),
"/src/project/tsconfig.b.json": JSON.stringify({
compilerOptions: {
composite: true,
cacheResolutions: true,
traceResolution: true,
},
files: ["bFileWithImports.ts", "bRandomFileForImport.ts", "bRandomFileForImport2.ts"],
references: [{ path: "./tsconfig.a.json" }]
}),
"/src/project/bFileWithImports.ts": Utils.dedent`
export { y } from "./aFileWithImports";
export { x } from "./bRandomFileForImport";
import type { ImportInterface0 } from "pkg0";
`,
"/src/project/bRandomFileForImport.ts": getRandomFileContent(),
"/src/project/bRandomFileForImport2.ts": getRandomFileContent(),
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
composite: true,
cacheResolutions: true,
traceResolution: true,
module: "amd"
},
files: ["cFileWithImports.ts", "cRandomFileForImport.ts", "cRandomFileForImport2.ts"],
references: [{ path: "./tsconfig.a.json" }, { path: "./tsconfig.b.json" }]
}),
"/src/project/cFileWithImports.ts": Utils.dedent`
import { y } from "./bFileWithImports";
import type { ImportInterface0 } from "pkg0";
`,
"/src/project/cRandomFileForImport.ts": getRandomFileContent(),
"/src/project/cRandomFileForImport2.ts": getRandomFileContent(),
"/src/project/pkg0.d.ts": getPkgImportContent("Import", 0),
};
}
export function getFsWithMultipleProjects() {
return loadProjectFromFiles(getFsMapWithMultipleProjects());
}
export function getWatchSystemWithMultipleProjects() {
const system = createWatchedSystem(getFsMapWithMultipleProjects(), { currentDirectory: "/src/project" });
system.ensureFileOrFolder(libFile);
return system;
}
export function getServerHostWithMultipleProjects() {
const system = createServerHost(getFsMapWithMultipleProjects(), { currentDirectory: "/src/project" });
system.writeFile(libFile.path, libFile.content);
return system;
}
export function getWatchSystemWithMultipleProjectsWithBuild() {
const system = getWatchSystemWithMultipleProjects();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
export function getServerHostWithMultipleProjectsWithBuild() {
const system = getServerHostWithMultipleProjects();
solutionBuildWithBaseline(system, ["/src/project"]);
return system;
}
@@ -4,6 +4,8 @@ import {
import {
getPkgImportContent,
getPkgTypeRefContent,
getWatchSystemWithMultipleProjects,
getWatchSystemWithMultipleProjectsWithBuild,
getWatchSystemWithNode16,
getWatchSystemWithNode16WithBuild,
getWatchSystemWithOut,
@@ -110,4 +112,44 @@ describe("unittests:: tsbuildWatch:: watchMode:: cacheResolutions::", () => {
});
}
});
describe("multi project", () => {
verifyTscWatchMultiProject("multi project", getWatchSystemWithMultipleProjects);
verifyTscWatchMultiProject("multi project already built", getWatchSystemWithMultipleProjectsWithBuild);
function verifyTscWatchMultiProject(subScenario: string, sys: () => TestServerHost) {
verifyTscWatch({
scenario: "cacheResolutions",
subScenario,
sys,
commandLineArgs: ["-b", "-w", "--explainFiles", "-v"],
baselineModulesAndTypeRefs: true,
edits: [
{
caption: "modify aRandomFileForImport by adding import",
edit: sys => sys.prependFile("/src/project/aRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.runQueuedTimeoutCallbacks();
},
},
{
caption: "modify bRandomFileForImport by adding import",
edit: sys => sys.prependFile("/src/project/bRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.runQueuedTimeoutCallbacks();
},
},
{
caption: "modify cRandomFileForImport by adding import",
edit: sys => sys.prependFile("/src/project/cRandomFileForImport.ts", `export type { ImportInterface0 } from "pkg0";\n`),
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.runQueuedTimeoutCallbacks();
},
},
]
});
}
});
});
+24 -6
View File
@@ -562,13 +562,20 @@ interface ReadableProgramBuildInfoResolutionCacheEntry {
dir: string;
resolutions: readonly ReadableProgramBuildInfoResolutionEntry[];
}
type ReadableProgramBuildInfoResolutionRedirectsCache = Omit<ts.ProgramBuildInfoResolutionRedirectsCache, "cache"> & {
cache: ReadableProgramBuildInfoResolutionCacheEntry[];
};
type ReadableProgramBuildInfoResolutionCacheWithRedirects = ReadableProgramBuildInfoResolutionCacheEntry[] | {
own: ReadableProgramBuildInfoResolutionCacheEntry[] | undefined;
redirects: readonly ReadableProgramBuildInfoResolutionRedirectsCache[];
};
type ReadableProgramBuildInfoCacheResolutions = Omit<ts.ProgramBuildInfoCacheResolutions,
"resolutions" | "resolutionEntries" | "modules" | "typeRefs"
> & {
resolutions: readonly ReadableWithOriginal<ReadableProgramBuildInfoResolution, ts.ProgramBuildInfoResolution>[];
resolutionEntries: readonly ReadableWithOriginal<ReadableProgramBuildInfoResolutionEntry, ts.ProgramBuildInfoResolutionEntry>[];
modules: ReadableProgramBuildInfoResolutionCacheEntry[] | undefined;
typeRefs: ReadableProgramBuildInfoResolutionCacheEntry[] | undefined;
modules: ReadableProgramBuildInfoResolutionCacheWithRedirects | undefined;
typeRefs: ReadableProgramBuildInfoResolutionCacheWithRedirects | undefined;
};
type ReadableProgramMultiFileEmitBuildInfo = Omit<ts.ProgramMultiFileEmitBuildInfo,
@@ -744,11 +751,22 @@ function generateBuildInfoProgramBaseline(sys: ts.System, buildInfoPath: string,
...cacheResolutions,
resolutions: resolutions.withOriginals,
resolutionEntries: resolutionEntries.withOriginals,
modules: toReadableProgramBuildInfoResolutionCache(cacheResolutions.modules),
typeRefs: toReadableProgramBuildInfoResolutionCache(cacheResolutions.typeRefs)
modules: toReadableProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions.modules),
typeRefs: toReadableProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions.typeRefs)
};
}
function toReadableProgramBuildInfoResolutionCacheWithRedirects(cache: ts.ProgramBuildInfoResolutionCacheWithRedirects | undefined): ReadableProgramBuildInfoResolutionCacheWithRedirects | undefined {
return cache ?
ts.isArray(cache) ?
toReadableProgramBuildInfoResolutionCache(cache) :
{
own: toReadableProgramBuildInfoResolutionCache(cache.own),
redirects: cache.redirects.map(r => ({ ...r, cache: toReadableProgramBuildInfoResolutionCache(r.cache)! }))
}
: undefined;
}
function toReadableProgramBuildInfoResolution(resolution: ts.ProgramBuildInfoResolution, index: number): ReadableProgramBuildInfoResolution {
return {
resolutionId: index + 1 as ts.ProgramBuildInfoResolutionId,
@@ -893,10 +911,10 @@ function verifyTscEditDiscrepancies({
const dtsForKey = dtsSignaures?.get(key);
if (!incrementalFileInfo || !cleanFileInfo || incrementalFileInfo.signature !== cleanFileInfo.signature && (!dtsForKey || incrementalFileInfo.signature !== dtsForKey.signature)) {
return [
`Incremental signature is neither dts signature nor file version for File:: ${key}`,
`Incremental signature is neither dts signature nor file version from clean for File:: ${key}`,
`Incremental:: ${JSON.stringify(incrementalFileInfo, /*replacer*/ undefined, 2)}`,
`Clean:: ${JSON.stringify(cleanFileInfo, /*replacer*/ undefined, 2)}`,
`Dts Signature:: $${JSON.stringify(dtsForKey?.signature)}`
`Dts Signature:: ${JSON.stringify(dtsForKey?.signature)}`
];
}
},
@@ -1,6 +1,7 @@
import {
getPkgImportContent,
getPkgTypeRefContent,
getWatchSystemWithMultipleProjectsWithBuild,
getWatchSystemWithNode16,
getWatchSystemWithNode16WithBuild,
getWatchSystemWithOut,
@@ -140,4 +141,25 @@ describe("unittests:: tsc-watch:: cacheResolutions::", () => {
});
}
});
describe("multi project", () => {
verifyTscWatchMultiProject("multi project", "/src/project/tsconfig.b.json", "bRandomFileForImport");
verifyTscWatchMultiProject("multi project mixed redirect options", "/src/project", "cRandomFileForImport");
function verifyTscWatchMultiProject(subScenario: string, project: string, file: string) {
verifyTscWatch({
scenario: "cacheResolutions",
subScenario,
sys: getWatchSystemWithMultipleProjectsWithBuild,
commandLineArgs: ["-p", project, "-w", "--explainFiles"],
baselineModulesAndTypeRefs: true,
edits: [
{
caption: `modify ${file} by adding import`,
edit: sys => sys.prependFile(`/src/project/${file}.ts`, `export type { ImportInterface0 } from "pkg0";\n`),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
}
});
});
@@ -19,6 +19,8 @@ import {
} from "./helpers";
import {
getPkgImportContent,
getServerHostWithMultipleProjects,
getServerHostWithMultipleProjectsWithBuild,
getServerHostWithNode16,
getServerHostWithNode16WithBuild,
getServerHostWithOut,
@@ -165,6 +167,36 @@ describe("unittests:: tsserver:: cacheResolutions:: tsserverProjectSystem cachin
}
});
describe("multi project", () => {
verifyTsserverMultiProject("multi project not built", getServerHostWithMultipleProjects, "bRandomFileForImport", "/src/project/tsconfig.b.json");
verifyTsserverMultiProject("multi project mixed redirect options not built", getServerHostWithMultipleProjects, "cRandomFileForImport");
verifyTsserverMultiProject("multi project", getServerHostWithMultipleProjectsWithBuild, "bRandomFileForImport", "/src/project/tsconfig.b.json");
verifyTsserverMultiProject("multi project mixed redirect options", getServerHostWithMultipleProjectsWithBuild, "cRandomFileForImport");
function verifyTsserverMultiProject(scenario: string, createHost: () => TestServerHost, file: string, project?: string) {
it(scenario, () => {
const host = fakes.patchHostForBuildInfoReadWrite(createHost());
const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([`/src/project/${file}.ts`], session);
session.logger.info(`modify ${file} by adding import`);
session.executeCommandSeq<ts.server.protocol.ChangeRequest>({
command: ts.server.protocol.CommandTypes.Change,
arguments: {
file: `/src/project/${file}.ts`,
line: 1,
offset: 1,
endLine: 1,
endOffset: 1,
insertString: `export type { ImportInterface0 } from "pkg0";\n`,
}
});
if (project) ts.server.updateProjectIfDirty(session.getProjectService().configuredProjects.get(project)!);
ts.server.updateProjectIfDirty(session.getProjectService().configuredProjects.get("/src/project/tsconfig.json")!);
baselineTsserverLogs("cacheResolutions", scenario, session);
});
}
});
describe("different projects", () => {
describe("on sample project", () => {
function cacheResolutions(file: File) {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -94,7 +94,7 @@ exports.x = 10;
//// [/src/project/tsconfig.tsbuildinfo]
{"program":{"fileNames":["../../lib/lib.d.ts","./lib/pkg0/index.d.ts","./main.ts","./randomfileforimport.ts","./","./lib/pkg0.ts","./lib/pkg0.tsx","./lib/pkg0.d.ts","./lib/pkg0/package.json","./lib/pkg0/index.ts","./lib/pkg0/index.tsx"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"769951468-export interface ImportInterface0 {}",{"version":"7372004325-import type { ImportInterface0 } from \"pkg0\";\n","signature":"-4882119183-export {};\r\n"},{"version":"-10726455937-export const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n"}],"options":{"cacheResolutions":true,"composite":true,"paths":{"*":["./lib/*"]}},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"latestChangedDtsFile":"./randomFileForImport.d.ts","cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2},"failedLookupLocations":[6,7,8,9,10,11]}],"names":["pkg0"],"resolutionEntries":[[1,1]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"}
{"program":{"fileNames":["../../lib/lib.d.ts","./lib/pkg0/index.d.ts","./main.ts","./randomfileforimport.ts","./","./lib/pkg0.ts","./lib/pkg0.tsx","./lib/pkg0.d.ts","./lib/pkg0/package.json","./lib/pkg0/index.ts","./lib/pkg0/index.tsx"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"769951468-export interface ImportInterface0 {}",{"version":"7372004325-import type { ImportInterface0 } from \"pkg0\";\n","signature":"-4882119183-export {};\r\n"},{"version":"-10726455937-export const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n"}],"options":{"cacheResolutions":true,"composite":true,"paths":{"*":["./lib/*"]},"pathsBasePath":"./"},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"latestChangedDtsFile":"./randomFileForImport.d.ts","cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2},"failedLookupLocations":[6,7,8,9,10,11]}],"names":["pkg0"],"resolutionEntries":[[1,1]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"}
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
{
@@ -155,7 +155,8 @@ exports.x = 10;
"*": [
"./lib/*"
]
}
},
"pathsBasePath": "./"
},
"referencedMap": {
"./main.ts": [
@@ -255,7 +256,7 @@ exports.x = 10;
}
},
"version": "FakeTSVersion",
"size": 1451
"size": 1472
}
@@ -319,7 +320,7 @@ pkg0: {
//// [/src/project/randomFileForImport.js] file written with same contents
//// [/src/project/tsconfig.tsbuildinfo]
{"program":{"fileNames":["../../lib/lib.d.ts","./lib/pkg0/index.d.ts","./main.ts","./randomfileforimport.ts","./","./lib/pkg0.ts","./lib/pkg0.tsx","./lib/pkg0.d.ts","./lib/pkg0/package.json","./lib/pkg0/index.ts","./lib/pkg0/index.tsx"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"769951468-export interface ImportInterface0 {}",{"version":"7372004325-import type { ImportInterface0 } from \"pkg0\";\n","signature":"-4882119183-export {};\r\n"},{"version":"10580737119-import type { ImportInterface0 } from \"pkg0\";\nexport const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n"}],"options":{"cacheResolutions":true,"composite":true,"paths":{"*":["./lib/*"]}},"fileIdsList":[[2]],"referencedMap":[[3,1],[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"latestChangedDtsFile":"./randomFileForImport.d.ts","cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2},"failedLookupLocations":[6,7,8,9,10,11]}],"names":["pkg0"],"resolutionEntries":[[1,1]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"}
{"program":{"fileNames":["../../lib/lib.d.ts","./lib/pkg0/index.d.ts","./main.ts","./randomfileforimport.ts","./","./lib/pkg0.ts","./lib/pkg0.tsx","./lib/pkg0.d.ts","./lib/pkg0/package.json","./lib/pkg0/index.ts","./lib/pkg0/index.tsx"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"769951468-export interface ImportInterface0 {}",{"version":"7372004325-import type { ImportInterface0 } from \"pkg0\";\n","signature":"-4882119183-export {};\r\n"},{"version":"10580737119-import type { ImportInterface0 } from \"pkg0\";\nexport const x = 10;","signature":"-6057683066-export declare const x = 10;\r\n"}],"options":{"cacheResolutions":true,"composite":true,"paths":{"*":["./lib/*"]},"pathsBasePath":"./"},"fileIdsList":[[2]],"referencedMap":[[3,1],[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"latestChangedDtsFile":"./randomFileForImport.d.ts","cacheResolutions":{"resolutions":[{"resolvedModule":{"resolvedFileName":2},"failedLookupLocations":[6,7,8,9,10,11]}],"names":["pkg0"],"resolutionEntries":[[1,1]],"modules":[[5,[1]]]}},"version":"FakeTSVersion"}
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
{
@@ -380,7 +381,8 @@ pkg0: {
"*": [
"./lib/*"
]
}
},
"pathsBasePath": "./"
},
"referencedMap": {
"./main.ts": [
@@ -483,6 +485,6 @@ pkg0: {
}
},
"version": "FakeTSVersion",
"size": 1505
"size": 1526
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,417 @@
Info 0 [00:00:46.000] Provided types map file "/a/lib/typesMap.json" doesn't exist
Info 1 [00:00:47.000] request:
{
"command": "open",
"arguments": {
"file": "/src/project/cRandomFileForImport.ts"
},
"seq": 1,
"type": "request"
}
Before request
//// [/src/project/tsconfig.a.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true},"files":["aFileWithImports.ts","aRandomFileForImport.ts","aRandomFileForImport2.ts"]}
//// [/src/project/aFileWithImports.ts]
import type { ImportInterface0 } from "pkg0";
export { x } from "./aRandomFileForImport";
export { x as x2 } from "./aRandomFileForImport2";
export const y = 10;
//// [/src/project/aRandomFileForImport.ts]
export const x = 10;
//// [/src/project/aRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/node_modules/pkg0/index.d.ts]
export interface ImportInterface0 {}
//// [/src/project/tsconfig.b.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true},"files":["bFileWithImports.ts","bRandomFileForImport.ts","bRandomFileForImport2.ts"],"references":[{"path":"./tsconfig.a.json"}]}
//// [/src/project/bFileWithImports.ts]
export { y } from "./aFileWithImports";
export { x } from "./bRandomFileForImport";
import type { ImportInterface0 } from "pkg0";
//// [/src/project/bRandomFileForImport.ts]
export const x = 10;
//// [/src/project/bRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/tsconfig.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true,"module":"amd"},"files":["cFileWithImports.ts","cRandomFileForImport.ts","cRandomFileForImport2.ts"],"references":[{"path":"./tsconfig.a.json"},{"path":"./tsconfig.b.json"}]}
//// [/src/project/cFileWithImports.ts]
import { y } from "./bFileWithImports";
import type { ImportInterface0 } from "pkg0";
//// [/src/project/cRandomFileForImport.ts]
export const x = 10;
//// [/src/project/cRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/pkg0.d.ts]
export interface ImportInterface0 {}
//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
PolledWatches::
FsWatches::
FsWatchesRecursive::
Info 2 [00:00:48.000] Search path: /src/project
Info 3 [00:00:49.000] For info: /src/project/cRandomFileForImport.ts :: Config file name: /src/project/tsconfig.json
Info 4 [00:00:50.000] Creating configuration project /src/project/tsconfig.json
Info 5 [00:00:51.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 6 [00:00:52.000] Config: /src/project/tsconfig.json : {
"rootNames": [
"/src/project/cFileWithImports.ts",
"/src/project/cRandomFileForImport.ts",
"/src/project/cRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"module": 2,
"configFilePath": "/src/project/tsconfig.json"
},
"projectReferences": [
{
"path": "/src/project/tsconfig.a.json",
"originalPath": "./tsconfig.a.json"
},
{
"path": "/src/project/tsconfig.b.json",
"originalPath": "./tsconfig.b.json"
}
]
}
Info 7 [00:00:53.000] FileWatcher:: Added:: WatchInfo: /src/project/cFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 8 [00:00:54.000] FileWatcher:: Added:: WatchInfo: /src/project/cRandomFileForImport2.ts 500 undefined WatchType: Closed Script info
Info 9 [00:00:55.000] Starting updateGraphWorker: Project: /src/project/tsconfig.json
Info 10 [00:00:56.000] Config: /src/project/tsconfig.a.json : {
"rootNames": [
"/src/project/aFileWithImports.ts",
"/src/project/aRandomFileForImport.ts",
"/src/project/aRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"configFilePath": "/src/project/tsconfig.a.json"
}
}
Info 11 [00:00:57.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.a.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 12 [00:00:58.000] Config: /src/project/tsconfig.b.json : {
"rootNames": [
"/src/project/bFileWithImports.ts",
"/src/project/bRandomFileForImport.ts",
"/src/project/bRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"configFilePath": "/src/project/tsconfig.b.json"
},
"projectReferences": [
{
"path": "/src/project/tsconfig.a.json",
"originalPath": "./tsconfig.a.json"
}
]
}
Info 13 [00:00:59.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.b.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 14 [00:01:00.000] ======== Resolving module './bFileWithImports' from '/src/project/cFileWithImports.ts'. ========
Info 15 [00:01:01.000] Module resolution kind is not specified, using 'Classic'.
Info 16 [00:01:02.000] File '/src/project/bFileWithImports.ts' exist - use it as a name resolution result.
Info 17 [00:01:03.000] ======== Module name './bFileWithImports' was successfully resolved to '/src/project/bFileWithImports.ts'. ========
Info 18 [00:01:04.000] ======== Resolving module 'pkg0' from '/src/project/cFileWithImports.ts'. ========
Info 19 [00:01:05.000] Module resolution kind is not specified, using 'Classic'.
Info 20 [00:01:06.000] File '/src/project/pkg0.ts' does not exist.
Info 21 [00:01:07.000] File '/src/project/pkg0.tsx' does not exist.
Info 22 [00:01:08.000] File '/src/project/pkg0.d.ts' exist - use it as a name resolution result.
Info 23 [00:01:09.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/pkg0.d.ts'. ========
Info 24 [00:01:10.000] FileWatcher:: Added:: WatchInfo: /src/project/bFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 25 [00:01:11.000] ======== Resolving module './aFileWithImports' from '/src/project/bFileWithImports.ts'. ========
Info 26 [00:01:12.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 27 [00:01:13.000] Module resolution kind is not specified, using 'NodeJs'.
Info 28 [00:01:14.000] Loading module as file / folder, candidate module location '/src/project/aFileWithImports', target file types: TypeScript, Declaration.
Info 29 [00:01:15.000] File '/src/project/aFileWithImports.ts' exist - use it as a name resolution result.
Info 30 [00:01:16.000] ======== Module name './aFileWithImports' was successfully resolved to '/src/project/aFileWithImports.ts'. ========
Info 31 [00:01:17.000] ======== Resolving module './bRandomFileForImport' from '/src/project/bFileWithImports.ts'. ========
Info 32 [00:01:18.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 33 [00:01:19.000] Module resolution kind is not specified, using 'NodeJs'.
Info 34 [00:01:20.000] Loading module as file / folder, candidate module location '/src/project/bRandomFileForImport', target file types: TypeScript, Declaration.
Info 35 [00:01:21.000] File '/src/project/bRandomFileForImport.ts' exist - use it as a name resolution result.
Info 36 [00:01:22.000] ======== Module name './bRandomFileForImport' was successfully resolved to '/src/project/bRandomFileForImport.ts'. ========
Info 37 [00:01:23.000] ======== Resolving module 'pkg0' from '/src/project/bFileWithImports.ts'. ========
Info 38 [00:01:24.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 39 [00:01:25.000] Module resolution kind is not specified, using 'NodeJs'.
Info 40 [00:01:26.000] Loading module 'pkg0' from 'node_modules' folder, target file types: TypeScript, Declaration.
Info 41 [00:01:27.000] File '/src/project/node_modules/pkg0/package.json' does not exist.
Info 42 [00:01:28.000] File '/src/project/node_modules/pkg0.ts' does not exist.
Info 43 [00:01:29.000] File '/src/project/node_modules/pkg0.tsx' does not exist.
Info 44 [00:01:30.000] File '/src/project/node_modules/pkg0.d.ts' does not exist.
Info 45 [00:01:31.000] File '/src/project/node_modules/pkg0/index.ts' does not exist.
Info 46 [00:01:32.000] File '/src/project/node_modules/pkg0/index.tsx' does not exist.
Info 47 [00:01:33.000] File '/src/project/node_modules/pkg0/index.d.ts' exist - use it as a name resolution result.
Info 48 [00:01:34.000] Resolving real path for '/src/project/node_modules/pkg0/index.d.ts', result '/src/project/node_modules/pkg0/index.d.ts'.
Info 49 [00:01:35.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 50 [00:01:36.000] FileWatcher:: Added:: WatchInfo: /src/project/aFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 51 [00:01:37.000] ======== Resolving module 'pkg0' from '/src/project/aFileWithImports.ts'. ========
Info 52 [00:01:38.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 53 [00:01:39.000] Resolution for module 'pkg0' was found in cache from location '/src/project'.
Info 54 [00:01:40.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 55 [00:01:41.000] ======== Resolving module './aRandomFileForImport' from '/src/project/aFileWithImports.ts'. ========
Info 56 [00:01:42.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 57 [00:01:43.000] Module resolution kind is not specified, using 'NodeJs'.
Info 58 [00:01:44.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport', target file types: TypeScript, Declaration.
Info 59 [00:01:45.000] File '/src/project/aRandomFileForImport.ts' exist - use it as a name resolution result.
Info 60 [00:01:46.000] ======== Module name './aRandomFileForImport' was successfully resolved to '/src/project/aRandomFileForImport.ts'. ========
Info 61 [00:01:47.000] ======== Resolving module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts'. ========
Info 62 [00:01:48.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 63 [00:01:49.000] Module resolution kind is not specified, using 'NodeJs'.
Info 64 [00:01:50.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport2', target file types: TypeScript, Declaration.
Info 65 [00:01:51.000] File '/src/project/aRandomFileForImport2.ts' exist - use it as a name resolution result.
Info 66 [00:01:52.000] ======== Module name './aRandomFileForImport2' was successfully resolved to '/src/project/aRandomFileForImport2.ts'. ========
Info 67 [00:01:53.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info 68 [00:01:54.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info 69 [00:01:55.000] FileWatcher:: Added:: WatchInfo: /src/project/aRandomFileForImport.ts 500 undefined WatchType: Closed Script info
Info 70 [00:01:56.000] FileWatcher:: Added:: WatchInfo: /src/project/aRandomFileForImport2.ts 500 undefined WatchType: Closed Script info
Info 71 [00:01:57.000] FileWatcher:: Added:: WatchInfo: /src/project/bRandomFileForImport.ts 500 undefined WatchType: Closed Script info
Info 72 [00:01:58.000] FileWatcher:: Added:: WatchInfo: /src/project/pkg0.d.ts 500 undefined WatchType: Closed Script info
Info 73 [00:01:59.000] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info
Info 74 [00:02:00.000] DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 75 [00:02:01.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 76 [00:02:02.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 77 [00:02:03.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 78 [00:02:04.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.json WatchType: Type roots
Info 79 [00:02:05.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.json WatchType: Type roots
Info 80 [00:02:06.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info 81 [00:02:07.000] Project '/src/project/tsconfig.json' (Configured)
Info 82 [00:02:08.000] Files (11)
/a/lib/lib.d.ts
/src/project/node_modules/pkg0/index.d.ts
/src/project/aRandomFileForImport.ts
/src/project/aRandomFileForImport2.ts
/src/project/aFileWithImports.ts
/src/project/bRandomFileForImport.ts
/src/project/bFileWithImports.ts
/src/project/pkg0.d.ts
/src/project/cFileWithImports.ts
/src/project/cRandomFileForImport.ts
/src/project/cRandomFileForImport2.ts
../../a/lib/lib.d.ts
Default library for target 'es5'
node_modules/pkg0/index.d.ts
Imported via "pkg0" from file 'aFileWithImports.ts'
Imported via "pkg0" from file 'bFileWithImports.ts'
aRandomFileForImport.ts
Imported via "./aRandomFileForImport" from file 'aFileWithImports.ts'
aRandomFileForImport2.ts
Imported via "./aRandomFileForImport2" from file 'aFileWithImports.ts'
aFileWithImports.ts
Imported via "./aFileWithImports" from file 'bFileWithImports.ts'
bRandomFileForImport.ts
Imported via "./bRandomFileForImport" from file 'bFileWithImports.ts'
bFileWithImports.ts
Imported via "./bFileWithImports" from file 'cFileWithImports.ts'
pkg0.d.ts
Imported via "pkg0" from file 'cFileWithImports.ts'
cFileWithImports.ts
Part of 'files' list in tsconfig.json
cRandomFileForImport.ts
Part of 'files' list in tsconfig.json
cRandomFileForImport2.ts
Part of 'files' list in tsconfig.json
Info 83 [00:02:09.000] -----------------------------------------------
Info 84 [00:02:10.000] Search path: /src/project
Info 85 [00:02:11.000] For info: /src/project/tsconfig.json :: No config files found.
Info 86 [00:02:12.000] Project '/src/project/tsconfig.json' (Configured)
Info 86 [00:02:13.000] Files (11)
Info 86 [00:02:14.000] -----------------------------------------------
Info 86 [00:02:15.000] Open files:
Info 86 [00:02:16.000] FileName: /src/project/cRandomFileForImport.ts ProjectRootPath: undefined
Info 86 [00:02:17.000] Projects: /src/project/tsconfig.json
After request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/brandomfileforimport.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
Info 86 [00:02:18.000] response:
{
"responseRequired": false
}
Info 87 [00:02:19.000] modify cRandomFileForImport by adding import
Info 88 [00:02:20.000] request:
{
"command": "change",
"arguments": {
"file": "/src/project/cRandomFileForImport.ts",
"line": 1,
"offset": 1,
"endLine": 1,
"endOffset": 1,
"insertString": "export type { ImportInterface0 } from \"pkg0\";\n"
},
"seq": 2,
"type": "request"
}
Before request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/brandomfileforimport.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
After request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/brandomfileforimport.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
Info 89 [00:02:21.000] response:
{
"responseRequired": false
}
Info 90 [00:02:22.000] Starting updateGraphWorker: Project: /src/project/tsconfig.json
Info 91 [00:02:23.000] Reusing resolution of module './bFileWithImports' from '/src/project/cFileWithImports.ts' of old program, it was successfully resolved to '/src/project/bFileWithImports.ts'.
Info 92 [00:02:24.000] Reusing resolution of module 'pkg0' from '/src/project/cFileWithImports.ts' of old program, it was successfully resolved to '/src/project/pkg0.d.ts'.
Info 93 [00:02:25.000] Reusing resolution of module './aFileWithImports' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aFileWithImports.ts'.
Info 94 [00:02:26.000] Reusing resolution of module './bRandomFileForImport' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/bRandomFileForImport.ts'.
Info 95 [00:02:27.000] Reusing resolution of module 'pkg0' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 96 [00:02:28.000] Reusing resolution of module 'pkg0' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 97 [00:02:29.000] Reusing resolution of module './aRandomFileForImport' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport.ts'.
Info 98 [00:02:30.000] Reusing resolution of module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport2.ts'.
Info 99 [00:02:31.000] ======== Resolving module 'pkg0' from '/src/project/cRandomFileForImport.ts'. ========
Info 100 [00:02:32.000] Module resolution kind is not specified, using 'Classic'.
Info 101 [00:02:33.000] File '/src/project/pkg0.ts' does not exist.
Info 102 [00:02:34.000] File '/src/project/pkg0.tsx' does not exist.
Info 103 [00:02:35.000] File '/src/project/pkg0.d.ts' exist - use it as a name resolution result.
Info 104 [00:02:36.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/pkg0.d.ts'. ========
Info 105 [00:02:37.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
Info 106 [00:02:38.000] Different program with same set of files
@@ -0,0 +1,533 @@
Info 0 [00:00:46.000] Provided types map file "/a/lib/typesMap.json" doesn't exist
Info 1 [00:00:47.000] request:
{
"command": "open",
"arguments": {
"file": "/src/project/bRandomFileForImport.ts"
},
"seq": 1,
"type": "request"
}
Before request
//// [/src/project/tsconfig.a.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true},"files":["aFileWithImports.ts","aRandomFileForImport.ts","aRandomFileForImport2.ts"]}
//// [/src/project/aFileWithImports.ts]
import type { ImportInterface0 } from "pkg0";
export { x } from "./aRandomFileForImport";
export { x as x2 } from "./aRandomFileForImport2";
export const y = 10;
//// [/src/project/aRandomFileForImport.ts]
export const x = 10;
//// [/src/project/aRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/node_modules/pkg0/index.d.ts]
export interface ImportInterface0 {}
//// [/src/project/tsconfig.b.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true},"files":["bFileWithImports.ts","bRandomFileForImport.ts","bRandomFileForImport2.ts"],"references":[{"path":"./tsconfig.a.json"}]}
//// [/src/project/bFileWithImports.ts]
export { y } from "./aFileWithImports";
export { x } from "./bRandomFileForImport";
import type { ImportInterface0 } from "pkg0";
//// [/src/project/bRandomFileForImport.ts]
export const x = 10;
//// [/src/project/bRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/tsconfig.json]
{"compilerOptions":{"composite":true,"cacheResolutions":true,"traceResolution":true,"module":"amd"},"files":["cFileWithImports.ts","cRandomFileForImport.ts","cRandomFileForImport2.ts"],"references":[{"path":"./tsconfig.a.json"},{"path":"./tsconfig.b.json"}]}
//// [/src/project/cFileWithImports.ts]
import { y } from "./bFileWithImports";
import type { ImportInterface0 } from "pkg0";
//// [/src/project/cRandomFileForImport.ts]
export const x = 10;
//// [/src/project/cRandomFileForImport2.ts]
export const x = 10;
//// [/src/project/pkg0.d.ts]
export interface ImportInterface0 {}
//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
PolledWatches::
FsWatches::
FsWatchesRecursive::
Info 2 [00:00:48.000] Search path: /src/project
Info 3 [00:00:49.000] For info: /src/project/bRandomFileForImport.ts :: Config file name: /src/project/tsconfig.json
Info 4 [00:00:50.000] Creating configuration project /src/project/tsconfig.json
Info 5 [00:00:51.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 6 [00:00:52.000] Config: /src/project/tsconfig.json : {
"rootNames": [
"/src/project/cFileWithImports.ts",
"/src/project/cRandomFileForImport.ts",
"/src/project/cRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"module": 2,
"configFilePath": "/src/project/tsconfig.json"
},
"projectReferences": [
{
"path": "/src/project/tsconfig.a.json",
"originalPath": "./tsconfig.a.json"
},
{
"path": "/src/project/tsconfig.b.json",
"originalPath": "./tsconfig.b.json"
}
]
}
Info 7 [00:00:53.000] FileWatcher:: Added:: WatchInfo: /src/project/cFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 8 [00:00:54.000] FileWatcher:: Added:: WatchInfo: /src/project/cRandomFileForImport.ts 500 undefined WatchType: Closed Script info
Info 9 [00:00:55.000] FileWatcher:: Added:: WatchInfo: /src/project/cRandomFileForImport2.ts 500 undefined WatchType: Closed Script info
Info 10 [00:00:56.000] Starting updateGraphWorker: Project: /src/project/tsconfig.json
Info 11 [00:00:57.000] Config: /src/project/tsconfig.a.json : {
"rootNames": [
"/src/project/aFileWithImports.ts",
"/src/project/aRandomFileForImport.ts",
"/src/project/aRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"configFilePath": "/src/project/tsconfig.a.json"
}
}
Info 12 [00:00:58.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.a.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 13 [00:00:59.000] Config: /src/project/tsconfig.b.json : {
"rootNames": [
"/src/project/bFileWithImports.ts",
"/src/project/bRandomFileForImport.ts",
"/src/project/bRandomFileForImport2.ts"
],
"options": {
"composite": true,
"cacheResolutions": true,
"traceResolution": true,
"configFilePath": "/src/project/tsconfig.b.json"
},
"projectReferences": [
{
"path": "/src/project/tsconfig.a.json",
"originalPath": "./tsconfig.a.json"
}
]
}
Info 14 [00:01:00.000] FileWatcher:: Added:: WatchInfo: /src/project/tsconfig.b.json 2000 undefined Project: /src/project/tsconfig.json WatchType: Config file
Info 15 [00:01:01.000] ======== Resolving module './bFileWithImports' from '/src/project/cFileWithImports.ts'. ========
Info 16 [00:01:02.000] Module resolution kind is not specified, using 'Classic'.
Info 17 [00:01:03.000] File '/src/project/bFileWithImports.ts' exist - use it as a name resolution result.
Info 18 [00:01:04.000] ======== Module name './bFileWithImports' was successfully resolved to '/src/project/bFileWithImports.ts'. ========
Info 19 [00:01:05.000] ======== Resolving module 'pkg0' from '/src/project/cFileWithImports.ts'. ========
Info 20 [00:01:06.000] Module resolution kind is not specified, using 'Classic'.
Info 21 [00:01:07.000] File '/src/project/pkg0.ts' does not exist.
Info 22 [00:01:08.000] File '/src/project/pkg0.tsx' does not exist.
Info 23 [00:01:09.000] File '/src/project/pkg0.d.ts' exist - use it as a name resolution result.
Info 24 [00:01:10.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/pkg0.d.ts'. ========
Info 25 [00:01:11.000] FileWatcher:: Added:: WatchInfo: /src/project/bFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 26 [00:01:12.000] ======== Resolving module './aFileWithImports' from '/src/project/bFileWithImports.ts'. ========
Info 27 [00:01:13.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 28 [00:01:14.000] Module resolution kind is not specified, using 'NodeJs'.
Info 29 [00:01:15.000] Loading module as file / folder, candidate module location '/src/project/aFileWithImports', target file types: TypeScript, Declaration.
Info 30 [00:01:16.000] File '/src/project/aFileWithImports.ts' exist - use it as a name resolution result.
Info 31 [00:01:17.000] ======== Module name './aFileWithImports' was successfully resolved to '/src/project/aFileWithImports.ts'. ========
Info 32 [00:01:18.000] ======== Resolving module './bRandomFileForImport' from '/src/project/bFileWithImports.ts'. ========
Info 33 [00:01:19.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 34 [00:01:20.000] Module resolution kind is not specified, using 'NodeJs'.
Info 35 [00:01:21.000] Loading module as file / folder, candidate module location '/src/project/bRandomFileForImport', target file types: TypeScript, Declaration.
Info 36 [00:01:22.000] File '/src/project/bRandomFileForImport.ts' exist - use it as a name resolution result.
Info 37 [00:01:23.000] ======== Module name './bRandomFileForImport' was successfully resolved to '/src/project/bRandomFileForImport.ts'. ========
Info 38 [00:01:24.000] ======== Resolving module 'pkg0' from '/src/project/bFileWithImports.ts'. ========
Info 39 [00:01:25.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 40 [00:01:26.000] Module resolution kind is not specified, using 'NodeJs'.
Info 41 [00:01:27.000] Loading module 'pkg0' from 'node_modules' folder, target file types: TypeScript, Declaration.
Info 42 [00:01:28.000] File '/src/project/node_modules/pkg0/package.json' does not exist.
Info 43 [00:01:29.000] File '/src/project/node_modules/pkg0.ts' does not exist.
Info 44 [00:01:30.000] File '/src/project/node_modules/pkg0.tsx' does not exist.
Info 45 [00:01:31.000] File '/src/project/node_modules/pkg0.d.ts' does not exist.
Info 46 [00:01:32.000] File '/src/project/node_modules/pkg0/index.ts' does not exist.
Info 47 [00:01:33.000] File '/src/project/node_modules/pkg0/index.tsx' does not exist.
Info 48 [00:01:34.000] File '/src/project/node_modules/pkg0/index.d.ts' exist - use it as a name resolution result.
Info 49 [00:01:35.000] Resolving real path for '/src/project/node_modules/pkg0/index.d.ts', result '/src/project/node_modules/pkg0/index.d.ts'.
Info 50 [00:01:36.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 51 [00:01:37.000] FileWatcher:: Added:: WatchInfo: /src/project/aFileWithImports.ts 500 undefined WatchType: Closed Script info
Info 52 [00:01:38.000] ======== Resolving module 'pkg0' from '/src/project/aFileWithImports.ts'. ========
Info 53 [00:01:39.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 54 [00:01:40.000] Resolution for module 'pkg0' was found in cache from location '/src/project'.
Info 55 [00:01:41.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 56 [00:01:42.000] ======== Resolving module './aRandomFileForImport' from '/src/project/aFileWithImports.ts'. ========
Info 57 [00:01:43.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 58 [00:01:44.000] Module resolution kind is not specified, using 'NodeJs'.
Info 59 [00:01:45.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport', target file types: TypeScript, Declaration.
Info 60 [00:01:46.000] File '/src/project/aRandomFileForImport.ts' exist - use it as a name resolution result.
Info 61 [00:01:47.000] ======== Module name './aRandomFileForImport' was successfully resolved to '/src/project/aRandomFileForImport.ts'. ========
Info 62 [00:01:48.000] ======== Resolving module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts'. ========
Info 63 [00:01:49.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 64 [00:01:50.000] Module resolution kind is not specified, using 'NodeJs'.
Info 65 [00:01:51.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport2', target file types: TypeScript, Declaration.
Info 66 [00:01:52.000] File '/src/project/aRandomFileForImport2.ts' exist - use it as a name resolution result.
Info 67 [00:01:53.000] ======== Module name './aRandomFileForImport2' was successfully resolved to '/src/project/aRandomFileForImport2.ts'. ========
Info 68 [00:01:54.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info 69 [00:01:55.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info 70 [00:01:56.000] FileWatcher:: Added:: WatchInfo: /src/project/aRandomFileForImport.ts 500 undefined WatchType: Closed Script info
Info 71 [00:01:57.000] FileWatcher:: Added:: WatchInfo: /src/project/aRandomFileForImport2.ts 500 undefined WatchType: Closed Script info
Info 72 [00:01:58.000] FileWatcher:: Added:: WatchInfo: /src/project/pkg0.d.ts 500 undefined WatchType: Closed Script info
Info 73 [00:01:59.000] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info
Info 74 [00:02:00.000] DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 75 [00:02:01.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project 0 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 76 [00:02:02.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 77 [00:02:03.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.json WatchType: Failed Lookup Locations
Info 78 [00:02:04.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.json WatchType: Type roots
Info 79 [00:02:05.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.json WatchType: Type roots
Info 80 [00:02:06.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info 81 [00:02:07.000] Project '/src/project/tsconfig.json' (Configured)
Info 82 [00:02:08.000] Files (11)
/a/lib/lib.d.ts
/src/project/node_modules/pkg0/index.d.ts
/src/project/aRandomFileForImport.ts
/src/project/aRandomFileForImport2.ts
/src/project/aFileWithImports.ts
/src/project/bRandomFileForImport.ts
/src/project/bFileWithImports.ts
/src/project/pkg0.d.ts
/src/project/cFileWithImports.ts
/src/project/cRandomFileForImport.ts
/src/project/cRandomFileForImport2.ts
../../a/lib/lib.d.ts
Default library for target 'es5'
node_modules/pkg0/index.d.ts
Imported via "pkg0" from file 'aFileWithImports.ts'
Imported via "pkg0" from file 'bFileWithImports.ts'
aRandomFileForImport.ts
Imported via "./aRandomFileForImport" from file 'aFileWithImports.ts'
aRandomFileForImport2.ts
Imported via "./aRandomFileForImport2" from file 'aFileWithImports.ts'
aFileWithImports.ts
Imported via "./aFileWithImports" from file 'bFileWithImports.ts'
bRandomFileForImport.ts
Imported via "./bRandomFileForImport" from file 'bFileWithImports.ts'
bFileWithImports.ts
Imported via "./bFileWithImports" from file 'cFileWithImports.ts'
pkg0.d.ts
Imported via "pkg0" from file 'cFileWithImports.ts'
cFileWithImports.ts
Part of 'files' list in tsconfig.json
cRandomFileForImport.ts
Part of 'files' list in tsconfig.json
cRandomFileForImport2.ts
Part of 'files' list in tsconfig.json
Info 83 [00:02:09.000] -----------------------------------------------
Info 84 [00:02:10.000] Creating configuration project /src/project/tsconfig.b.json
Info 85 [00:02:11.000] FileWatcher:: Added:: WatchInfo: /src/project/bRandomFileForImport2.ts 500 undefined WatchType: Closed Script info
Info 86 [00:02:12.000] Starting updateGraphWorker: Project: /src/project/tsconfig.b.json
Info 87 [00:02:13.000] ======== Resolving module './aFileWithImports' from '/src/project/bFileWithImports.ts'. ========
Info 88 [00:02:14.000] Module resolution kind is not specified, using 'NodeJs'.
Info 89 [00:02:15.000] Loading module as file / folder, candidate module location '/src/project/aFileWithImports', target file types: TypeScript, Declaration.
Info 90 [00:02:16.000] File '/src/project/aFileWithImports.ts' exist - use it as a name resolution result.
Info 91 [00:02:17.000] ======== Module name './aFileWithImports' was successfully resolved to '/src/project/aFileWithImports.ts'. ========
Info 92 [00:02:18.000] ======== Resolving module './bRandomFileForImport' from '/src/project/bFileWithImports.ts'. ========
Info 93 [00:02:19.000] Module resolution kind is not specified, using 'NodeJs'.
Info 94 [00:02:20.000] Loading module as file / folder, candidate module location '/src/project/bRandomFileForImport', target file types: TypeScript, Declaration.
Info 95 [00:02:21.000] File '/src/project/bRandomFileForImport.ts' exist - use it as a name resolution result.
Info 96 [00:02:22.000] ======== Module name './bRandomFileForImport' was successfully resolved to '/src/project/bRandomFileForImport.ts'. ========
Info 97 [00:02:23.000] ======== Resolving module 'pkg0' from '/src/project/bFileWithImports.ts'. ========
Info 98 [00:02:24.000] Module resolution kind is not specified, using 'NodeJs'.
Info 99 [00:02:25.000] Loading module 'pkg0' from 'node_modules' folder, target file types: TypeScript, Declaration.
Info 100 [00:02:26.000] File '/src/project/node_modules/pkg0/package.json' does not exist.
Info 101 [00:02:27.000] File '/src/project/node_modules/pkg0.ts' does not exist.
Info 102 [00:02:28.000] File '/src/project/node_modules/pkg0.tsx' does not exist.
Info 103 [00:02:29.000] File '/src/project/node_modules/pkg0.d.ts' does not exist.
Info 104 [00:02:30.000] File '/src/project/node_modules/pkg0/index.ts' does not exist.
Info 105 [00:02:31.000] File '/src/project/node_modules/pkg0/index.tsx' does not exist.
Info 106 [00:02:32.000] File '/src/project/node_modules/pkg0/index.d.ts' exist - use it as a name resolution result.
Info 107 [00:02:33.000] Resolving real path for '/src/project/node_modules/pkg0/index.d.ts', result '/src/project/node_modules/pkg0/index.d.ts'.
Info 108 [00:02:34.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 109 [00:02:35.000] ======== Resolving module 'pkg0' from '/src/project/aFileWithImports.ts'. ========
Info 110 [00:02:36.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 111 [00:02:37.000] Resolution for module 'pkg0' was found in cache from location '/src/project'.
Info 112 [00:02:38.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 113 [00:02:39.000] ======== Resolving module './aRandomFileForImport' from '/src/project/aFileWithImports.ts'. ========
Info 114 [00:02:40.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 115 [00:02:41.000] Module resolution kind is not specified, using 'NodeJs'.
Info 116 [00:02:42.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport', target file types: TypeScript, Declaration.
Info 117 [00:02:43.000] File '/src/project/aRandomFileForImport.ts' exist - use it as a name resolution result.
Info 118 [00:02:44.000] ======== Module name './aRandomFileForImport' was successfully resolved to '/src/project/aRandomFileForImport.ts'. ========
Info 119 [00:02:45.000] ======== Resolving module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts'. ========
Info 120 [00:02:46.000] Using compiler options of project reference redirect '/src/project/tsconfig.a.json'.
Info 121 [00:02:47.000] Module resolution kind is not specified, using 'NodeJs'.
Info 122 [00:02:48.000] Loading module as file / folder, candidate module location '/src/project/aRandomFileForImport2', target file types: TypeScript, Declaration.
Info 123 [00:02:49.000] File '/src/project/aRandomFileForImport2.ts' exist - use it as a name resolution result.
Info 124 [00:02:50.000] ======== Module name './aRandomFileForImport2' was successfully resolved to '/src/project/aRandomFileForImport2.ts'. ========
Info 125 [00:02:51.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.b.json WatchType: Failed Lookup Locations
Info 126 [00:02:52.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules 1 undefined Project: /src/project/tsconfig.b.json WatchType: Failed Lookup Locations
Info 127 [00:02:53.000] DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.b.json WatchType: Type roots
Info 128 [00:02:54.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /src/project/node_modules/@types 1 undefined Project: /src/project/tsconfig.b.json WatchType: Type roots
Info 129 [00:02:55.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.b.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info 130 [00:02:56.000] Project '/src/project/tsconfig.b.json' (Configured)
Info 131 [00:02:57.000] Files (8)
/a/lib/lib.d.ts
/src/project/node_modules/pkg0/index.d.ts
/src/project/aRandomFileForImport.ts
/src/project/aRandomFileForImport2.ts
/src/project/aFileWithImports.ts
/src/project/bRandomFileForImport.ts
/src/project/bFileWithImports.ts
/src/project/bRandomFileForImport2.ts
../../a/lib/lib.d.ts
Default library for target 'es5'
node_modules/pkg0/index.d.ts
Imported via "pkg0" from file 'aFileWithImports.ts'
Imported via "pkg0" from file 'bFileWithImports.ts'
aRandomFileForImport.ts
Imported via "./aRandomFileForImport" from file 'aFileWithImports.ts'
aRandomFileForImport2.ts
Imported via "./aRandomFileForImport2" from file 'aFileWithImports.ts'
aFileWithImports.ts
Imported via "./aFileWithImports" from file 'bFileWithImports.ts'
bRandomFileForImport.ts
Imported via "./bRandomFileForImport" from file 'bFileWithImports.ts'
Part of 'files' list in tsconfig.json
bFileWithImports.ts
Part of 'files' list in tsconfig.json
bRandomFileForImport2.ts
Part of 'files' list in tsconfig.json
Info 132 [00:02:58.000] -----------------------------------------------
Info 133 [00:02:59.000] Search path: /src/project
Info 134 [00:03:00.000] For info: /src/project/tsconfig.json :: No config files found.
Info 135 [00:03:01.000] Project '/src/project/tsconfig.json' (Configured)
Info 135 [00:03:02.000] Files (11)
Info 135 [00:03:03.000] -----------------------------------------------
Info 135 [00:03:04.000] Project '/src/project/tsconfig.b.json' (Configured)
Info 135 [00:03:05.000] Files (8)
Info 135 [00:03:06.000] -----------------------------------------------
Info 135 [00:03:07.000] Open files:
Info 135 [00:03:08.000] FileName: /src/project/bRandomFileForImport.ts ProjectRootPath: undefined
Info 135 [00:03:09.000] Projects: /src/project/tsconfig.json,/src/project/tsconfig.b.json
After request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
/src/project/brandomfileforimport2.ts:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
Info 135 [00:03:10.000] response:
{
"responseRequired": false
}
Info 136 [00:03:11.000] modify bRandomFileForImport by adding import
Info 137 [00:03:12.000] request:
{
"command": "change",
"arguments": {
"file": "/src/project/bRandomFileForImport.ts",
"line": 1,
"offset": 1,
"endLine": 1,
"endOffset": 1,
"insertString": "export type { ImportInterface0 } from \"pkg0\";\n"
},
"seq": 2,
"type": "request"
}
Before request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
/src/project/brandomfileforimport2.ts:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
After request
PolledWatches::
/src/project/node_modules/@types:
{"pollingInterval":500}
FsWatches::
/src/project/tsconfig.json:
{}
/src/project/cfilewithimports.ts:
{}
/src/project/crandomfileforimport.ts:
{}
/src/project/crandomfileforimport2.ts:
{}
/src/project/tsconfig.a.json:
{}
/src/project/tsconfig.b.json:
{}
/src/project/bfilewithimports.ts:
{}
/src/project/afilewithimports.ts:
{}
/src/project/arandomfileforimport.ts:
{}
/src/project/arandomfileforimport2.ts:
{}
/src/project/pkg0.d.ts:
{}
/a/lib/lib.d.ts:
{}
/src/project:
{}
/src/project/brandomfileforimport2.ts:
{}
FsWatchesRecursive::
/src/project/node_modules:
{}
Info 138 [00:03:13.000] response:
{
"responseRequired": false
}
Info 139 [00:03:14.000] Starting updateGraphWorker: Project: /src/project/tsconfig.b.json
Info 140 [00:03:15.000] Reusing resolution of module './aFileWithImports' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aFileWithImports.ts'.
Info 141 [00:03:16.000] Reusing resolution of module './bRandomFileForImport' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/bRandomFileForImport.ts'.
Info 142 [00:03:17.000] Reusing resolution of module 'pkg0' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 143 [00:03:18.000] Reusing resolution of module 'pkg0' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 144 [00:03:19.000] Reusing resolution of module './aRandomFileForImport' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport.ts'.
Info 145 [00:03:20.000] Reusing resolution of module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport2.ts'.
Info 146 [00:03:21.000] ======== Resolving module 'pkg0' from '/src/project/bRandomFileForImport.ts'. ========
Info 147 [00:03:22.000] Module resolution kind is not specified, using 'NodeJs'.
Info 148 [00:03:23.000] Loading module 'pkg0' from 'node_modules' folder, target file types: TypeScript, Declaration.
Info 149 [00:03:24.000] File '/src/project/node_modules/pkg0/package.json' does not exist according to earlier cached lookups.
Info 150 [00:03:25.000] File '/src/project/node_modules/pkg0.ts' does not exist.
Info 151 [00:03:26.000] File '/src/project/node_modules/pkg0.tsx' does not exist.
Info 152 [00:03:27.000] File '/src/project/node_modules/pkg0.d.ts' does not exist.
Info 153 [00:03:28.000] File '/src/project/node_modules/pkg0/index.ts' does not exist.
Info 154 [00:03:29.000] File '/src/project/node_modules/pkg0/index.tsx' does not exist.
Info 155 [00:03:30.000] File '/src/project/node_modules/pkg0/index.d.ts' exist - use it as a name resolution result.
Info 156 [00:03:31.000] Resolving real path for '/src/project/node_modules/pkg0/index.d.ts', result '/src/project/node_modules/pkg0/index.d.ts'.
Info 157 [00:03:32.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 158 [00:03:33.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.b.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
Info 159 [00:03:34.000] Different program with same set of files
Info 160 [00:03:35.000] Starting updateGraphWorker: Project: /src/project/tsconfig.json
Info 161 [00:03:36.000] Reusing resolution of module './bFileWithImports' from '/src/project/cFileWithImports.ts' of old program, it was successfully resolved to '/src/project/bFileWithImports.ts'.
Info 162 [00:03:37.000] Reusing resolution of module 'pkg0' from '/src/project/cFileWithImports.ts' of old program, it was successfully resolved to '/src/project/pkg0.d.ts'.
Info 163 [00:03:38.000] Reusing resolution of module './aFileWithImports' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aFileWithImports.ts'.
Info 164 [00:03:39.000] Reusing resolution of module './bRandomFileForImport' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/bRandomFileForImport.ts'.
Info 165 [00:03:40.000] Reusing resolution of module 'pkg0' from '/src/project/bFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 166 [00:03:41.000] Reusing resolution of module 'pkg0' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'.
Info 167 [00:03:42.000] Reusing resolution of module './aRandomFileForImport' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport.ts'.
Info 168 [00:03:43.000] Reusing resolution of module './aRandomFileForImport2' from '/src/project/aFileWithImports.ts' of old program, it was successfully resolved to '/src/project/aRandomFileForImport2.ts'.
Info 169 [00:03:44.000] ======== Resolving module 'pkg0' from '/src/project/bRandomFileForImport.ts'. ========
Info 170 [00:03:45.000] Using compiler options of project reference redirect '/src/project/tsconfig.b.json'.
Info 171 [00:03:46.000] Module resolution kind is not specified, using 'NodeJs'.
Info 172 [00:03:47.000] Loading module 'pkg0' from 'node_modules' folder, target file types: TypeScript, Declaration.
Info 173 [00:03:48.000] File '/src/project/node_modules/pkg0/package.json' does not exist according to earlier cached lookups.
Info 174 [00:03:49.000] File '/src/project/node_modules/pkg0.ts' does not exist.
Info 175 [00:03:50.000] File '/src/project/node_modules/pkg0.tsx' does not exist.
Info 176 [00:03:51.000] File '/src/project/node_modules/pkg0.d.ts' does not exist.
Info 177 [00:03:52.000] File '/src/project/node_modules/pkg0/index.ts' does not exist.
Info 178 [00:03:53.000] File '/src/project/node_modules/pkg0/index.tsx' does not exist.
Info 179 [00:03:54.000] File '/src/project/node_modules/pkg0/index.d.ts' exist - use it as a name resolution result.
Info 180 [00:03:55.000] Resolving real path for '/src/project/node_modules/pkg0/index.d.ts', result '/src/project/node_modules/pkg0/index.d.ts'.
Info 181 [00:03:56.000] ======== Module name 'pkg0' was successfully resolved to '/src/project/node_modules/pkg0/index.d.ts'. ========
Info 182 [00:03:57.000] Finishing updateGraphWorker: Project: /src/project/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
Info 183 [00:03:58.000] Different program with same set of files
File diff suppressed because it is too large Load Diff