Add check for actually present directories to make sure projects with config file can still share resolutions if they are not hoisting their own node_modules
This is still problem because every npm install will create new source files depending on how and when we do project update and program is not reused
This commit is contained in:
Родитель
7aafb5c45d
Коммит
dde2085d0d
|
@ -893,21 +893,37 @@ function compilerOptionValueToString(value: unknown): string {
|
|||
}
|
||||
|
||||
/** @internal */
|
||||
export function getKeyForCompilerOptions(currentDirectory: string | undefined, options: CompilerOptions, affectingOptionDeclarations: readonly CommandLineOption[]) {
|
||||
export function getKeyForCompilerOptions(
|
||||
options: CompilerOptions,
|
||||
host: ModuleResolutionHost | undefined,
|
||||
currentDirectory: string,
|
||||
affectingOptionDeclarations: readonly CommandLineOption[],
|
||||
) {
|
||||
return affectingOptionDeclarations.map(option => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|")
|
||||
+ `|${options.pathsBasePath}`
|
||||
// TypeRoots are already serialized before so no need to serialize again
|
||||
+ `|${getEffectiveTypeRootsForKeyOfCompilerOptions(options, currentDirectory)}`;
|
||||
+ `|${tryGetDefaultEffectiveTypeRoots(options, host, currentDirectory)}`;
|
||||
}
|
||||
|
||||
function getEffectiveTypeRootsForKeyOfCompilerOptions(
|
||||
/** @internal */
|
||||
export function tryGetDefaultEffectiveTypeRoots(
|
||||
options: CompilerOptions,
|
||||
currentDirectory: string | undefined,
|
||||
host: ModuleResolutionHost | undefined,
|
||||
currentDirectory: string,
|
||||
) {
|
||||
// TypeRoots are already serialized before so no need to serialize again
|
||||
// TypeRoots are already handled by affectsModuleResolution so caller of this method has handled them
|
||||
if (options.typeRoots) return undefined;
|
||||
// Get the directory to traverse for type roots
|
||||
return options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
||||
const mainDirForTypeRoots = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
||||
host?.getCurrentDirectory ? host.getCurrentDirectory() :
|
||||
currentDirectory;
|
||||
if (!mainDirForTypeRoots || !host?.directoryExists) return mainDirForTypeRoots;
|
||||
// Filter out non-existent directories
|
||||
let typeRoots: string[] | undefined;
|
||||
forEachAncestorDirectory(normalizePath(mainDirForTypeRoots), directory => {
|
||||
if (host.directoryExists!(combinePaths(directory, nodeModulesAtTypes))) (typeRoots ??= []).push(directory);
|
||||
});
|
||||
return typeRoots && compilerOptionValueToString(typeRoots);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
@ -921,10 +937,10 @@ export interface CacheWithRedirects<K, V> {
|
|||
/** @internal */
|
||||
export type RedirectsCacheKey = string & { __compilerOptionsKey: any; };
|
||||
|
||||
/** @internal */
|
||||
export function createCacheWithRedirects<K, V>(
|
||||
function createCacheWithRedirects<K, V>(
|
||||
currentDirectory: string,
|
||||
ownOptions: CompilerOptions | undefined,
|
||||
getModuleResolutionHost: (() => ModuleResolutionHost) | undefined,
|
||||
optionsToRedirectsKey: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): CacheWithRedirects<K, V> {
|
||||
const redirectsMap = new Map<CompilerOptions, Map<K, V>>();
|
||||
|
@ -979,13 +995,11 @@ export function createCacheWithRedirects<K, V>(
|
|||
}
|
||||
|
||||
function clear() {
|
||||
const ownKey = ownOptions && optionsToRedirectsKey.get(ownOptions);
|
||||
ownMap.clear();
|
||||
redirectsMap.clear();
|
||||
optionsToRedirectsKey.clear();
|
||||
redirectsKeyToMap.clear();
|
||||
if (ownOptions) {
|
||||
if (ownKey) optionsToRedirectsKey.set(ownOptions, ownKey);
|
||||
redirectsMap.set(ownOptions, ownMap);
|
||||
}
|
||||
}
|
||||
|
@ -993,7 +1007,15 @@ export function createCacheWithRedirects<K, V>(
|
|||
function getRedirectsCacheKey(options: CompilerOptions) {
|
||||
let result = optionsToRedirectsKey.get(options);
|
||||
if (!result) {
|
||||
optionsToRedirectsKey.set(options, result = getKeyForCompilerOptions(currentDirectory, options, moduleResolutionOptionDeclarations) as RedirectsCacheKey);
|
||||
optionsToRedirectsKey.set(
|
||||
options,
|
||||
result = getKeyForCompilerOptions(
|
||||
options,
|
||||
getModuleResolutionHost?.(),
|
||||
currentDirectory,
|
||||
moduleResolutionOptionDeclarations,
|
||||
) as RedirectsCacheKey,
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1034,11 +1056,13 @@ function createPerDirectoryResolutionCache<T>(
|
|||
currentDirectory: string,
|
||||
getCanonicalFileName: GetCanonicalFileName,
|
||||
options: CompilerOptions | undefined,
|
||||
getModuleResolutionHost: (() => ModuleResolutionHost) | undefined,
|
||||
optionsToRedirectsKey: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): PerDirectoryResolutionCache<T> {
|
||||
const directoryToModuleNameMap = createCacheWithRedirects<Path, ModeAwareCache<T>>(
|
||||
currentDirectory,
|
||||
options,
|
||||
getModuleResolutionHost,
|
||||
optionsToRedirectsKey,
|
||||
);
|
||||
return {
|
||||
|
@ -1142,11 +1166,13 @@ function createNonRelativeNameResolutionCache<T>(
|
|||
getCanonicalFileName: (s: string) => string,
|
||||
options: CompilerOptions | undefined,
|
||||
getResolvedFileName: (result: T) => string | undefined,
|
||||
getModuleResolutionHost: (() => ModuleResolutionHost) | undefined,
|
||||
optionsToRedirectsKey: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): NonRelativeNameResolutionCache<T> {
|
||||
const moduleNameToDirectoryMap = createCacheWithRedirects<ModeAwareCacheKey, PerNonRelativeNameCache<T>>(
|
||||
currentDirectory,
|
||||
options,
|
||||
getModuleResolutionHost,
|
||||
optionsToRedirectsKey,
|
||||
);
|
||||
return {
|
||||
|
@ -1257,6 +1283,7 @@ function createModuleOrTypeReferenceResolutionCache<T>(
|
|||
options: CompilerOptions | undefined,
|
||||
packageJsonInfoCache: PackageJsonInfoCache | undefined,
|
||||
getResolvedFileName: (result: T) => string | undefined,
|
||||
getModuleResolutionHost: (() => ModuleResolutionHost) | undefined,
|
||||
optionsToRedirectsKey: Map<CompilerOptions, RedirectsCacheKey> | undefined,
|
||||
): ModuleOrTypeReferenceResolutionCache<T> {
|
||||
optionsToRedirectsKey ??= new Map();
|
||||
|
@ -1264,6 +1291,7 @@ function createModuleOrTypeReferenceResolutionCache<T>(
|
|||
currentDirectory,
|
||||
getCanonicalFileName,
|
||||
options,
|
||||
getModuleResolutionHost,
|
||||
optionsToRedirectsKey,
|
||||
);
|
||||
const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
|
||||
|
@ -1271,6 +1299,7 @@ function createModuleOrTypeReferenceResolutionCache<T>(
|
|||
getCanonicalFileName,
|
||||
options,
|
||||
getResolvedFileName,
|
||||
getModuleResolutionHost,
|
||||
optionsToRedirectsKey,
|
||||
);
|
||||
packageJsonInfoCache ??= createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
||||
|
@ -1307,21 +1336,7 @@ export function createModuleResolutionCache(
|
|||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
): ModuleResolutionCache;
|
||||
/** @internal */
|
||||
export function createModuleResolutionCache(
|
||||
currentDirectory: string,
|
||||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): ModuleResolutionCache;
|
||||
export function createModuleResolutionCache(
|
||||
currentDirectory: string,
|
||||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
getModuleResolutionHost?: () => ModuleResolutionHost,
|
||||
): ModuleResolutionCache {
|
||||
const result = createModuleOrTypeReferenceResolutionCache(
|
||||
currentDirectory,
|
||||
|
@ -1329,7 +1344,8 @@ export function createModuleResolutionCache(
|
|||
options,
|
||||
packageJsonInfoCache,
|
||||
getOriginalOrResolvedModuleFileName,
|
||||
optionsToRedirectsKey,
|
||||
getModuleResolutionHost,
|
||||
/*optionsToRedirectsKey*/ undefined,
|
||||
) as ModuleResolutionCache;
|
||||
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
||||
return result;
|
||||
|
@ -1340,6 +1356,7 @@ export function createTypeReferenceDirectiveResolutionCache(
|
|||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
getModuleResolutionHost?: () => ModuleResolutionHost,
|
||||
): TypeReferenceDirectiveResolutionCache;
|
||||
/** @internal */
|
||||
export function createTypeReferenceDirectiveResolutionCache(
|
||||
|
@ -1347,6 +1364,7 @@ export function createTypeReferenceDirectiveResolutionCache(
|
|||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
getModuleResolutionHost?: () => ModuleResolutionHost,
|
||||
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): TypeReferenceDirectiveResolutionCache;
|
||||
export function createTypeReferenceDirectiveResolutionCache(
|
||||
|
@ -1354,6 +1372,7 @@ export function createTypeReferenceDirectiveResolutionCache(
|
|||
getCanonicalFileName: (s: string) => string,
|
||||
options?: CompilerOptions,
|
||||
packageJsonInfoCache?: PackageJsonInfoCache,
|
||||
getModuleResolutionHost?: () => ModuleResolutionHost,
|
||||
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>,
|
||||
): TypeReferenceDirectiveResolutionCache {
|
||||
return createModuleOrTypeReferenceResolutionCache(
|
||||
|
@ -1362,6 +1381,7 @@ export function createTypeReferenceDirectiveResolutionCache(
|
|||
options,
|
||||
packageJsonInfoCache,
|
||||
getOriginalOrResolvedTypeReferenceFileName,
|
||||
getModuleResolutionHost,
|
||||
optionsToRedirectsKey,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ import {
|
|||
getNormalizedAbsolutePath,
|
||||
getNormalizedAbsolutePathWithoutRoot,
|
||||
getNormalizedPathComponents,
|
||||
getOptionsForLibraryResolution,
|
||||
getOutputDeclarationFileName,
|
||||
getOutputPathsForBundle,
|
||||
getPackageScopeForPath,
|
||||
|
@ -317,6 +318,7 @@ import {
|
|||
toPath as ts_toPath,
|
||||
trace,
|
||||
tracing,
|
||||
tryGetDefaultEffectiveTypeRoots,
|
||||
TsConfigSourceFile,
|
||||
TypeChecker,
|
||||
typeDirectiveIsEqualTo,
|
||||
|
@ -1444,11 +1446,12 @@ export const plainJSErrors = new Set<number>([
|
|||
/**
|
||||
* Determine if source file needs to be re-created even if its text hasn't changed
|
||||
*/
|
||||
function shouldProgramCreateNewSourceFiles(program: Program | undefined, newOptions: CompilerOptions): boolean {
|
||||
function shouldProgramCreateNewSourceFiles(program: Program | undefined, newOptions: CompilerOptions, defaultEffectiveTypeRoots: string | undefined): boolean {
|
||||
if (!program) return false;
|
||||
// If any compiler options change, we can't reuse old source file even if version match
|
||||
// The change in options like these could result in change in syntax tree or `sourceFile.bindDiagnostics`.
|
||||
return optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions);
|
||||
return program.getDefaultEffectiveTypeRoots() !== defaultEffectiveTypeRoots ||
|
||||
optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions);
|
||||
}
|
||||
|
||||
function createCreateProgramOptions(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: readonly Diagnostic[], typeScriptVersion?: string): CreateProgramOptions {
|
||||
|
@ -1591,7 +1594,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
moduleResolutionCache = host.getModuleResolutionCache?.();
|
||||
}
|
||||
else {
|
||||
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
||||
moduleResolutionCache = createModuleResolutionCache(
|
||||
currentDirectory,
|
||||
getCanonicalFileName,
|
||||
options,
|
||||
/*packageJsonInfoCache*/ undefined,
|
||||
() => host,
|
||||
);
|
||||
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options, containingSourceFile) =>
|
||||
loadWithModeAwareCache(
|
||||
moduleNames,
|
||||
|
@ -1632,6 +1641,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
getCanonicalFileName,
|
||||
/*options*/ undefined,
|
||||
moduleResolutionCache?.getPackageJsonInfoCache(),
|
||||
() => host,
|
||||
moduleResolutionCache?.optionsToRedirectsKey,
|
||||
);
|
||||
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options, containingSourceFile) =>
|
||||
|
@ -1653,7 +1663,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
actualResolveLibrary = host.resolveLibrary.bind(host);
|
||||
}
|
||||
else {
|
||||
const libraryResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, moduleResolutionCache?.getPackageJsonInfoCache());
|
||||
const libraryResolutionCache = createModuleResolutionCache(
|
||||
currentDirectory,
|
||||
getCanonicalFileName,
|
||||
getOptionsForLibraryResolution(options),
|
||||
moduleResolutionCache?.getPackageJsonInfoCache(),
|
||||
() => host,
|
||||
);
|
||||
actualResolveLibrary = (libraryName, resolveFrom, options) => resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache);
|
||||
}
|
||||
|
||||
|
@ -1698,8 +1714,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
});
|
||||
const readFile = host.readFile.bind(host) as typeof host.readFile;
|
||||
|
||||
// If there is change in default effective type roots presence, we need to re-create source file
|
||||
const defaultEffectiveTypeRoots = tryGetDefaultEffectiveTypeRoots(options, host, currentDirectory);
|
||||
|
||||
tracing?.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
||||
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
||||
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options, defaultEffectiveTypeRoots);
|
||||
tracing?.pop();
|
||||
// We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
|
||||
// `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
|
||||
|
@ -1810,13 +1829,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
// old file wasn't redirect but new file is
|
||||
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)
|
||||
) {
|
||||
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
||||
host.onReleaseOldSourceFile(oldSourceFile, !!getSourceFileByPath(oldSourceFile.path));
|
||||
}
|
||||
}
|
||||
if (!host.getParsedCommandLine) {
|
||||
oldProgram.forEachResolvedProjectReference(resolvedProjectReference => {
|
||||
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
||||
host.onReleaseOldSourceFile!(resolvedProjectReference.sourceFile, oldProgram!.getCompilerOptions(), /*hasSourceFileByPath*/ false);
|
||||
host.onReleaseOldSourceFile!(resolvedProjectReference.sourceFile, /*hasSourceFileByPath*/ false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1831,7 +1850,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
const oldReference = parent?.commandLine.projectReferences![index] || oldProgram!.getProjectReferences()![index];
|
||||
const oldRefPath = resolveProjectReferencePath(oldReference);
|
||||
if (!projectReferenceRedirects?.has(toPath(oldRefPath))) {
|
||||
host.onReleaseParsedCommandLine!(oldRefPath, oldResolvedRef, oldProgram!.getCompilerOptions());
|
||||
host.onReleaseParsedCommandLine!(oldRefPath, oldResolvedRef);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
@ -1874,6 +1893,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
||||
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames!,
|
||||
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
||||
getDefaultEffectiveTypeRoots: () => defaultEffectiveTypeRoots,
|
||||
isSourceFileFromExternalLibrary,
|
||||
isSourceFileDefaultLibrary,
|
||||
getSourceFileFromReference,
|
||||
|
@ -2350,7 +2370,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
|||
// check properties that can affect structure of the program or module resolution strategy
|
||||
// if any of these properties has changed - structure cannot be reused
|
||||
const oldOptions = oldProgram.getCompilerOptions();
|
||||
if (changesAffectModuleResolution(oldOptions, options)) {
|
||||
if (changesAffectModuleResolution(oldOptions, options) || defaultEffectiveTypeRoots !== oldProgram.getDefaultEffectiveTypeRoots()) {
|
||||
return StructureIsReused.Not;
|
||||
}
|
||||
|
||||
|
|
|
@ -450,6 +450,8 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
|
|||
getCurrentDirectory(),
|
||||
resolutionHost.getCanonicalFileName,
|
||||
resolutionHost.getCompilationSettings(),
|
||||
/*packageJsonInfoCache*/ undefined,
|
||||
getModuleResolutionHost,
|
||||
);
|
||||
|
||||
const resolvedTypeReferenceDirectives = new Map<Path, ModeAwareCache<CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations>>();
|
||||
|
@ -458,6 +460,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
|
|||
resolutionHost.getCanonicalFileName,
|
||||
resolutionHost.getCompilationSettings(),
|
||||
moduleResolutionCache.getPackageJsonInfoCache(),
|
||||
getModuleResolutionHost,
|
||||
moduleResolutionCache.optionsToRedirectsKey,
|
||||
);
|
||||
|
||||
|
@ -467,6 +470,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
|
|||
resolutionHost.getCanonicalFileName,
|
||||
getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()),
|
||||
moduleResolutionCache.getPackageJsonInfoCache(),
|
||||
getModuleResolutionHost,
|
||||
);
|
||||
|
||||
const directoryWatchesOfFailedLookups = new Map<string, DirectoryWatchesOfFailedLookup>();
|
||||
|
@ -654,8 +658,12 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
|
|||
hasChangedAutomaticTypeDirectiveNames = false;
|
||||
}
|
||||
|
||||
function getModuleResolutionHost() {
|
||||
return resolutionHost.getCompilerHost?.() || resolutionHost;
|
||||
}
|
||||
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, redirectedReference?: ResolvedProjectReference, mode?: ResolutionMode): CachedResolvedModuleWithFailedLookupLocations {
|
||||
const host = resolutionHost.getCompilerHost?.() || resolutionHost;
|
||||
const host = getModuleResolutionHost();
|
||||
const primaryResult = ts_resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
||||
// return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts
|
||||
if (!resolutionHost.getGlobalCache) {
|
||||
|
|
|
@ -440,7 +440,13 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
|
|||
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
||||
let moduleResolutionCache: ModuleResolutionCache | undefined, typeReferenceDirectiveResolutionCache: TypeReferenceDirectiveResolutionCache | undefined;
|
||||
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
||||
moduleResolutionCache = createModuleResolutionCache(compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName);
|
||||
moduleResolutionCache = createModuleResolutionCache(
|
||||
compilerHost.getCurrentDirectory(),
|
||||
compilerHost.getCanonicalFileName,
|
||||
/*options*/ undefined,
|
||||
/*packageJsonInfoCache*/ undefined,
|
||||
() => compilerHost,
|
||||
);
|
||||
compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options, containingSourceFile) =>
|
||||
loadWithModeAwareCache(
|
||||
moduleNames,
|
||||
|
@ -460,6 +466,7 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
|
|||
compilerHost.getCanonicalFileName,
|
||||
/*options*/ undefined,
|
||||
moduleResolutionCache?.getPackageJsonInfoCache(),
|
||||
() => compilerHost,
|
||||
moduleResolutionCache?.optionsToRedirectsKey,
|
||||
);
|
||||
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options, containingSourceFile) =>
|
||||
|
@ -476,7 +483,13 @@ function createSolutionBuilderState<T extends BuilderProgram>(watch: boolean, ho
|
|||
}
|
||||
let libraryResolutionCache: ModuleResolutionCache | undefined;
|
||||
if (!compilerHost.resolveLibrary) {
|
||||
libraryResolutionCache = createModuleResolutionCache(compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, /*options*/ undefined, moduleResolutionCache?.getPackageJsonInfoCache());
|
||||
libraryResolutionCache = createModuleResolutionCache(
|
||||
compilerHost.getCurrentDirectory(),
|
||||
compilerHost.getCanonicalFileName,
|
||||
/*options*/ undefined,
|
||||
moduleResolutionCache?.getPackageJsonInfoCache(),
|
||||
() => compilerHost,
|
||||
);
|
||||
compilerHost.resolveLibrary = (libraryName, resolveFrom, options) =>
|
||||
resolveLibrary(
|
||||
libraryName,
|
||||
|
|
|
@ -4700,6 +4700,7 @@ export interface Program extends ScriptReferenceHost {
|
|||
/** @internal */ getResolvedTypeReferenceDirectives(): ModeAwareCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>;
|
||||
/** @internal */ getAutomaticTypeDirectiveNames(): string[];
|
||||
/** @internal */ getAutomaticTypeDirectiveResolutions(): ModeAwareCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>;
|
||||
/** @internal */ getDefaultEffectiveTypeRoots(): string | undefined;
|
||||
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
|
||||
isSourceFileDefaultLibrary(file: SourceFile): boolean;
|
||||
|
||||
|
@ -7767,8 +7768,8 @@ export interface CompilerHost extends ModuleResolutionHost {
|
|||
*/
|
||||
hasInvalidatedLibResolutions?(libFileName: string): boolean;
|
||||
getEnvironmentVariable?(name: string): string | undefined;
|
||||
/** @internal */ onReleaseOldSourceFile?(oldSourceFile: SourceFile, oldOptions: CompilerOptions, hasSourceFileByPath: boolean): void;
|
||||
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void;
|
||||
/** @internal */ onReleaseOldSourceFile?(oldSourceFile: SourceFile, hasSourceFileByPath: boolean): void;
|
||||
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined): void;
|
||||
/** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
|
||||
hasInvalidatedResolutions?(filePath: Path): boolean;
|
||||
/** @internal */ hasChangedAutomaticTypeDirectiveNames?: HasChangedAutomaticTypeDirectiveNames;
|
||||
|
|
|
@ -799,7 +799,7 @@ export function createWatchProgram<T extends BuilderProgram>(host: WatchCompiler
|
|||
return text !== undefined ? getSourceFileVersionAsHashFromText(compilerHost, text) : undefined;
|
||||
}
|
||||
|
||||
function onReleaseOldSourceFile(oldSourceFile: SourceFile, _oldOptions: CompilerOptions, hasSourceFileByPath: boolean) {
|
||||
function onReleaseOldSourceFile(oldSourceFile: SourceFile, hasSourceFileByPath: boolean) {
|
||||
const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
||||
// If this is the source file thats in the cache and new program doesnt need it,
|
||||
// remove the cached entry.
|
||||
|
|
|
@ -83,7 +83,7 @@ function verifyDocumentRegistry(service: ts.server.ProjectService) {
|
|||
if (project.noDtsResolutionProject) collectStats(project.noDtsResolutionProject);
|
||||
const program = project.getCurrentProgram();
|
||||
if (!program) return;
|
||||
const key = service.documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions(), program.getCurrentDirectory());
|
||||
const key = program.getDocumentRegistryBucketKey();
|
||||
program.getSourceFiles().forEach(f => {
|
||||
const keyWithMode = service.documentRegistry.getDocumentRegistryBucketKeyWithMode(key, f.impliedNodeFormat);
|
||||
let mapForKeyWithMode = stats.get(keyWithMode);
|
||||
|
|
|
@ -17,6 +17,7 @@ import {
|
|||
IScriptSnapshot,
|
||||
isDeclarationFileName,
|
||||
MinimalResolutionCacheHost,
|
||||
ModuleResolutionHost,
|
||||
Path,
|
||||
ResolutionMode,
|
||||
ScriptKind,
|
||||
|
@ -68,7 +69,7 @@ export interface DocumentRegistry {
|
|||
version: string,
|
||||
scriptKind?: ScriptKind,
|
||||
sourceFileOptions?: CreateSourceFileOptions | ScriptTarget,
|
||||
currentDirectoryForDocument?: string,
|
||||
host?: ModuleResolutionHost,
|
||||
): SourceFile;
|
||||
|
||||
acquireDocumentWithKey(
|
||||
|
@ -104,7 +105,7 @@ export interface DocumentRegistry {
|
|||
version: string,
|
||||
scriptKind?: ScriptKind,
|
||||
sourceFileOptions?: CreateSourceFileOptions | ScriptTarget,
|
||||
currentDirectoryForDocument?: string,
|
||||
host?: ModuleResolutionHost,
|
||||
): SourceFile;
|
||||
|
||||
updateDocumentWithKey(
|
||||
|
@ -118,7 +119,7 @@ export interface DocumentRegistry {
|
|||
sourceFileOptions?: CreateSourceFileOptions | ScriptTarget,
|
||||
): SourceFile;
|
||||
|
||||
getKeyForCompilationSettings(settings: CompilerOptions, currentDirectoryForDocument?: string): DocumentRegistryBucketKey;
|
||||
getKeyForCompilationSettings(settings: CompilerOptions, host?: ModuleResolutionHost): DocumentRegistryBucketKey;
|
||||
/** @internal */
|
||||
getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode): DocumentRegistryBucketKeyWithMode;
|
||||
/**
|
||||
|
@ -146,7 +147,7 @@ export interface DocumentRegistry {
|
|||
* @param impliedNodeFormat The implied source file format of the file to be released
|
||||
* @param currentDirectoryForDocument The current directory of the file to be released
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode, currentDirectoryForDocument?: string): void; // eslint-disable-line @typescript-eslint/unified-signatures
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode, host?: ModuleResolutionHost): void; // eslint-disable-line @typescript-eslint/unified-signatures
|
||||
/**
|
||||
* @deprecated pass scriptKind for and impliedNodeFormat correctness */
|
||||
releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind?: ScriptKind): void;
|
||||
|
@ -233,10 +234,10 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
|
|||
version: string,
|
||||
scriptKind?: ScriptKind,
|
||||
languageVersionOrOptions?: CreateSourceFileOptions | ScriptTarget,
|
||||
currentDirectoryForDocument?: string,
|
||||
host?: ModuleResolutionHost,
|
||||
): SourceFile {
|
||||
const path = toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
const key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings), currentDirectoryForDocument);
|
||||
const key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings), host);
|
||||
return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions);
|
||||
}
|
||||
|
||||
|
@ -251,10 +252,10 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
|
|||
version: string,
|
||||
scriptKind?: ScriptKind,
|
||||
languageVersionOrOptions?: CreateSourceFileOptions | ScriptTarget,
|
||||
currentDirectoryForDocument?: string,
|
||||
host?: ModuleResolutionHost,
|
||||
): SourceFile {
|
||||
const path = toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
const key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings), currentDirectoryForDocument);
|
||||
const key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings), host);
|
||||
return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions);
|
||||
}
|
||||
|
||||
|
@ -383,10 +384,10 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
|
|||
compilationSettings: CompilerOptions,
|
||||
scriptKind?: ScriptKind,
|
||||
impliedNodeFormat?: ResolutionMode,
|
||||
currentDirectoryForDocument?: string,
|
||||
host?: ModuleResolutionHost,
|
||||
): void {
|
||||
const path = toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
const key = getKeyForCompilationSettings(compilationSettings, currentDirectoryForDocument);
|
||||
const key = getKeyForCompilationSettings(compilationSettings, host);
|
||||
return releaseDocumentWithKey(path, key, scriptKind, impliedNodeFormat);
|
||||
}
|
||||
|
||||
|
@ -422,10 +423,15 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
|
|||
reportStats,
|
||||
getBuckets: () => buckets,
|
||||
};
|
||||
}
|
||||
|
||||
function getKeyForCompilationSettings(settings: CompilerOptions, currentDirectoryForDocument: string | undefined): DocumentRegistryBucketKey {
|
||||
return getKeyForCompilerOptions(currentDirectoryForDocument, settings, sourceFileAffectingCompilerOptions) as DocumentRegistryBucketKey;
|
||||
function getKeyForCompilationSettings(settings: CompilerOptions, host: ModuleResolutionHost | undefined): DocumentRegistryBucketKey {
|
||||
return getKeyForCompilerOptions(
|
||||
settings,
|
||||
host,
|
||||
currentDirectory,
|
||||
sourceFileAffectingCompilerOptions,
|
||||
) as DocumentRegistryBucketKey;
|
||||
}
|
||||
}
|
||||
|
||||
function getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode) {
|
||||
|
|
|
@ -1716,7 +1716,7 @@ export function createLanguageService(
|
|||
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
||||
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
||||
// as a const variable without downleveling, doesn't crash).
|
||||
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings, currentDirectory);
|
||||
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings, compilerHost);
|
||||
let releasedScriptKinds: Set<Path> | undefined = new Set();
|
||||
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
|
@ -1741,6 +1741,7 @@ export function createLanguageService(
|
|||
projectReferences,
|
||||
};
|
||||
program = createProgram(options);
|
||||
program.getDocumentRegistryBucketKey = () => documentRegistryBucketKey;
|
||||
|
||||
// 'getOrCreateSourceFile' depends on caching but should be used past this point.
|
||||
// After this point, the cache needs to be cleared to allow all collected snapshots to be released
|
||||
|
@ -1785,20 +1786,19 @@ export function createLanguageService(
|
|||
);
|
||||
}
|
||||
|
||||
function onReleaseParsedCommandLine(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, oldOptions: CompilerOptions) {
|
||||
function onReleaseParsedCommandLine(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined) {
|
||||
if (host.getParsedCommandLine) {
|
||||
host.onReleaseParsedCommandLine?.(configFileName, oldResolvedRef, oldOptions);
|
||||
host.onReleaseParsedCommandLine?.(configFileName, oldResolvedRef);
|
||||
}
|
||||
else if (oldResolvedRef) {
|
||||
onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
|
||||
onReleaseOldSourceFile(oldResolvedRef.sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Release any files we have acquired in the old program but are
|
||||
// not part of the new program.
|
||||
function onReleaseOldSourceFile(oldSourceFile: SourceFile, oldOptions: CompilerOptions) {
|
||||
const oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions, currentDirectory);
|
||||
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
||||
function onReleaseOldSourceFile(oldSourceFile: SourceFile) {
|
||||
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, program.getDocumentRegistryBucketKey(), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
||||
}
|
||||
|
||||
function getOrCreateSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined {
|
||||
|
@ -1821,7 +1821,7 @@ export function createLanguageService(
|
|||
// Check if the language version has changed since we last created a program; if they are the same,
|
||||
// it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile
|
||||
// can not be reused. we have to dump all syntax trees and create new ones.
|
||||
if (!shouldCreateNewSourceFile) {
|
||||
if (!shouldCreateNewSourceFile) { // Handle when directories get created
|
||||
// Check if the old program had this file already
|
||||
const oldSourceFile = program && program.getSourceFileByPath(path);
|
||||
if (oldSourceFile) {
|
||||
|
@ -1857,7 +1857,7 @@ export function createLanguageService(
|
|||
// Release old source file and fall through to aquire new file with new script kind
|
||||
documentRegistry.releaseDocumentWithKey(
|
||||
oldSourceFile.resolvedPath,
|
||||
documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions(), program.getCurrentDirectory()),
|
||||
program.getDocumentRegistryBucketKey(),
|
||||
oldSourceFile.scriptKind,
|
||||
oldSourceFile.impliedNodeFormat,
|
||||
);
|
||||
|
@ -1948,7 +1948,7 @@ export function createLanguageService(
|
|||
function cleanupSemanticCache(): void {
|
||||
if (program) {
|
||||
// Use paths to ensure we are using correct key and paths as document registry could be created with different current directory than host
|
||||
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions(), program.getCurrentDirectory());
|
||||
const key = program.getDocumentRegistryBucketKey();
|
||||
forEach(program.getSourceFiles(), f => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
||||
program = undefined!; // TODO: GH#18217
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
DiagnosticWithLocation,
|
||||
DocumentHighlights,
|
||||
DocumentPositionMapper,
|
||||
DocumentRegistryBucketKey,
|
||||
EmitOutput,
|
||||
ExportInfoMap,
|
||||
ExportMapInfoKey,
|
||||
|
@ -188,6 +189,13 @@ declare module "../compiler/types" {
|
|||
}
|
||||
}
|
||||
|
||||
declare module "../compiler/types" {
|
||||
/** @internal */
|
||||
export interface Program {
|
||||
getDocumentRegistryBucketKey(): DocumentRegistryBucketKey;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an immutable snapshot of a script at a specified time.Once acquired, the
|
||||
* snapshot is observably immutable. i.e. the same calls with the same parameters will return
|
||||
|
@ -425,7 +433,7 @@ export interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalR
|
|||
/** @internal */ getPackageJsonAutoImportProvider?(): Program | undefined;
|
||||
/** @internal */ sendPerformanceEvent?(kind: PerformanceEvent["kind"], durationMs: number): void;
|
||||
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
|
||||
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void;
|
||||
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined): void;
|
||||
/** @internal */ getIncompleteCompletionsCache?(): IncompleteCompletionsCache;
|
||||
}
|
||||
|
||||
|
|
|
@ -9539,8 +9539,8 @@ declare namespace ts {
|
|||
* this list is only the set of defaults that are implicitly included.
|
||||
*/
|
||||
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
|
||||
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): ModuleResolutionCache;
|
||||
function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache;
|
||||
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache, getModuleResolutionHost?: () => ModuleResolutionHost): ModuleResolutionCache;
|
||||
function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache, getModuleResolutionHost?: () => ModuleResolutionHost): TypeReferenceDirectiveResolutionCache;
|
||||
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
|
||||
function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
|
||||
|
@ -11408,7 +11408,7 @@ declare namespace ts {
|
|||
* @param version Current version of the file. Only used if the file was not found
|
||||
* in the registry and a new one was created.
|
||||
*/
|
||||
acquireDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget, currentDirectoryForDocument?: string): SourceFile;
|
||||
acquireDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget, host?: ModuleResolutionHost): SourceFile;
|
||||
acquireDocumentWithKey(fileName: string, path: Path, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget): SourceFile;
|
||||
/**
|
||||
* Request an updated version of an already existing SourceFile with a given fileName
|
||||
|
@ -11425,9 +11425,9 @@ declare namespace ts {
|
|||
* @param scriptSnapshot Text of the file.
|
||||
* @param version Current version of the file.
|
||||
*/
|
||||
updateDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget, currentDirectoryForDocument?: string): SourceFile;
|
||||
updateDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget, host?: ModuleResolutionHost): SourceFile;
|
||||
updateDocumentWithKey(fileName: string, path: Path, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind, sourceFileOptions?: CreateSourceFileOptions | ScriptTarget): SourceFile;
|
||||
getKeyForCompilationSettings(settings: CompilerOptions, currentDirectoryForDocument?: string): DocumentRegistryBucketKey;
|
||||
getKeyForCompilationSettings(settings: CompilerOptions, host?: ModuleResolutionHost): DocumentRegistryBucketKey;
|
||||
/**
|
||||
* Informs the DocumentRegistry that a file is not needed any longer.
|
||||
*
|
||||
|
@ -11453,7 +11453,7 @@ declare namespace ts {
|
|||
* @param impliedNodeFormat The implied source file format of the file to be released
|
||||
* @param currentDirectoryForDocument The current directory of the file to be released
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode, currentDirectoryForDocument?: string): void;
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode, host?: ModuleResolutionHost): void;
|
||||
/**
|
||||
* @deprecated pass scriptKind for and impliedNodeFormat correctness */
|
||||
releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind?: ScriptKind): void;
|
||||
|
|
|
@ -77,14 +77,7 @@ Module resolution kind is not specified, using 'Node10'.
|
|||
Loading module 'moduleX' from 'node_modules' folder, target file types: TypeScript, Declaration.
|
||||
Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
|
||||
Directory '/users/username/projects/app/node_modules' does not exist, skipping all lookups in it.
|
||||
File '/users/username/projects/node_modules/moduleX/package.json' does not exist according to earlier cached lookups.
|
||||
File '/users/username/projects/node_modules/moduleX.ts' does not exist.
|
||||
File '/users/username/projects/node_modules/moduleX.tsx' does not exist.
|
||||
File '/users/username/projects/node_modules/moduleX.d.ts' does not exist.
|
||||
File '/users/username/projects/node_modules/moduleX/index.ts' does not exist.
|
||||
File '/users/username/projects/node_modules/moduleX/index.tsx' does not exist.
|
||||
File '/users/username/projects/node_modules/moduleX/index.d.ts' exists - use it as a name resolution result.
|
||||
Resolving real path for '/users/username/projects/node_modules/moduleX/index.d.ts', result '/users/username/projects/node_modules/moduleX/index.d.ts'.
|
||||
Resolution for module 'moduleX' was found in cache from location '/users/username/projects'.
|
||||
======== Module name 'moduleX' was successfully resolved to '/users/username/projects/node_modules/moduleX/index.d.ts'. ========
|
||||
======== Resolving module '../common/moduleB' from '/users/username/projects/app/appB.ts'. ========
|
||||
Module resolution kind is not specified, using 'Node10'.
|
||||
|
|
|
@ -352,7 +352,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/
|
|||
|
||||
Program root files: ["/user/username/projects/myproject/worker.ts"]
|
||||
Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
|
||||
Program structureReused: SafeModules
|
||||
Program structureReused: Not
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/worker.ts
|
||||
|
|
|
@ -130,7 +130,7 @@ sysLog:: /users/username/projects/project/node_modules/@types:: Changing watcher
|
|||
|
||||
Program root files: ["/users/username/projects/project/foo.ts"]
|
||||
Program options: {"watch":true}
|
||||
Program structureReused: SafeModules
|
||||
Program structureReused: Not
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/users/username/projects/project/foo.ts
|
||||
|
|
|
@ -122,7 +122,7 @@ sysLog:: /user/username/projects/myproject/node_modules/@types:: Changing watche
|
|||
|
||||
Program root files: ["/user/username/projects/myproject/a.ts"]
|
||||
Program options: {"watch":true}
|
||||
Program structureReused: SafeModules
|
||||
Program structureReused: Not
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/node_modules/@types/qqq/index.d.ts
|
||||
|
|
|
@ -1864,7 +1864,7 @@ Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /user/username/ro
|
|||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/rootfolder/otherfolder/node_modules 1 undefined Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /user/username/rootfolder/node_modules 1 undefined Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/rootfolder/node_modules 1 undefined Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Project '/user/username/rootfolder/otherfolder/a/b/tsconfig.json' (Configured)
|
||||
Info seq [hh:mm:ss:mss] Files (3)
|
||||
/a/lib/lib.d.ts Text-1 "/// <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; }"
|
||||
|
|
|
@ -1143,7 +1143,7 @@ Before running Timeout callback:: count: 2
|
|||
|
||||
Info seq [hh:mm:ss:mss] Running: /user/username/rootfolder/otherfolder/a/b/tsconfig.json
|
||||
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/rootfolder/otherfolder/a/b/tsconfig.json Version: 3 structureChanged: true structureIsReused:: Not Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Project '/user/username/rootfolder/otherfolder/a/b/tsconfig.json' (Configured)
|
||||
Info seq [hh:mm:ss:mss] Files (2)
|
||||
/a/lib/lib.d.ts Text-1 "/// <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; }"
|
||||
|
|
|
@ -126,7 +126,7 @@ Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/fo
|
|||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/folder/myproject/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
|
||||
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /user/username/folder/node_modules 1 undefined Project: /user/username/folder/myproject/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/folder/node_modules 1 undefined Project: /user/username/folder/myproject/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/folder/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/folder/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Project '/user/username/folder/myproject/tsconfig.json' (Configured)
|
||||
Info seq [hh:mm:ss:mss] Files (3)
|
||||
/a/lib/lib.d.ts Text-1 "/// <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; }"
|
||||
|
|
|
@ -49,7 +49,9 @@ Info seq [hh:mm:ss:mss] ../f1.ts(1,1): error TS2304: Cannot find name 'foo'.
|
|||
Info seq [hh:mm:ss:mss] fileExists::
|
||||
|
||||
Info seq [hh:mm:ss:mss] directoryExists::
|
||||
|
||||
/c/d/node_modules/@types: 1
|
||||
/c/node_modules/@types: 1
|
||||
/node_modules/@types: 1
|
||||
Info seq [hh:mm:ss:mss] getDirectories::
|
||||
|
||||
Info seq [hh:mm:ss:mss] readFile::
|
||||
|
@ -155,9 +157,9 @@ Info seq [hh:mm:ss:mss] fileExists::
|
|||
Info seq [hh:mm:ss:mss] directoryExists::
|
||||
/c: 1
|
||||
/c/d: 1
|
||||
/c/d/node_modules/@types: 1
|
||||
/c/node_modules/@types: 1
|
||||
/node_modules/@types: 1
|
||||
/c/d/node_modules/@types: 3
|
||||
/c/node_modules/@types: 3
|
||||
/node_modules/@types: 3
|
||||
Info seq [hh:mm:ss:mss] getDirectories::
|
||||
|
||||
Info seq [hh:mm:ss:mss] readFile::
|
||||
|
|
|
@ -69,7 +69,7 @@ Info seq [hh:mm:ss:mss] Open files:
|
|||
Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/index.ts ProjectRootPath: undefined
|
||||
Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/user/username/projects/myproject/module1.d.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
|
@ -88,7 +88,7 @@ Info seq [hh:mm:ss:mss] Files (2)
|
|||
|
||||
Info seq [hh:mm:ss:mss] -----------------------------------------------
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/module1.d.ts 1:: WatchInfo: /user/username/projects/myproject/module1.d.ts 500 undefined WatchType: Closed Script info
|
||||
|
@ -111,7 +111,7 @@ Info seq [hh:mm:ss:mss] Files (3)
|
|||
|
||||
Info seq [hh:mm:ss:mss] -----------------------------------------------
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
/user/username/projects/myproject/module1.d.ts: TS 1
|
|
@ -69,7 +69,7 @@ Info seq [hh:mm:ss:mss] Open files:
|
|||
Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/index.ts ProjectRootPath: undefined
|
||||
Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/user/username/projects/myproject/module1.d.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
|
@ -88,7 +88,7 @@ Info seq [hh:mm:ss:mss] Files (2)
|
|||
|
||||
Info seq [hh:mm:ss:mss] -----------------------------------------------
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json
|
||||
|
@ -109,7 +109,7 @@ Info seq [hh:mm:ss:mss] Files (3)
|
|||
|
||||
Info seq [hh:mm:ss:mss] -----------------------------------------------
|
||||
DocumentRegistry::
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|/user/username/projects/myproject
|
||||
Key:: undefined|undefined|undefined|undefined|undefined|false|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined|undefined
|
||||
/user/username/projects/myproject/index.ts: TS 1
|
||||
/a/lib/lib.d.ts: TS 1
|
||||
/user/username/projects/myproject/module1.d.ts: TS 1
|
|
@ -245,7 +245,7 @@ Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /a/b/projects/tem
|
|||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /a/b/projects/temp/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
|
||||
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /a/b/projects/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /a/b/projects/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
|
||||
Info seq [hh:mm:ss:mss] Files (3)
|
||||
/a/lib/lib.d.ts Text-1 "/// <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; }"
|
||||
|
|
|
@ -105,14 +105,7 @@ Info seq [hh:mm:ss:mss] Module resolution kind is not specified, using 'Node10'
|
|||
Info seq [hh:mm:ss:mss] Loading module 'moduleX' from 'node_modules' folder, target file types: TypeScript, Declaration.
|
||||
Info seq [hh:mm:ss:mss] Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
|
||||
Info seq [hh:mm:ss:mss] Directory '/users/username/projects/common/node_modules' does not exist, skipping all lookups in it.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX/package.json' does not exist according to earlier cached lookups.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX.ts' does not exist.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX.tsx' does not exist.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX.d.ts' does not exist.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX/index.ts' does not exist.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX/index.tsx' does not exist.
|
||||
Info seq [hh:mm:ss:mss] File '/users/username/projects/node_modules/moduleX/index.d.ts' exists - use it as a name resolution result.
|
||||
Info seq [hh:mm:ss:mss] Resolving real path for '/users/username/projects/node_modules/moduleX/index.d.ts', result '/users/username/projects/node_modules/moduleX/index.d.ts'.
|
||||
Info seq [hh:mm:ss:mss] Resolution for module 'moduleX' was found in cache from location '/users/username/projects'.
|
||||
Info seq [hh:mm:ss:mss] ======== Module name 'moduleX' was successfully resolved to '/users/username/projects/node_modules/moduleX/index.d.ts'. ========
|
||||
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /users/username/projects/app/node_modules 1 undefined Project: /users/username/projects/app/tsconfig.json WatchType: Failed Lookup Locations
|
||||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /users/username/projects/app/node_modules 1 undefined Project: /users/username/projects/app/tsconfig.json WatchType: Failed Lookup Locations
|
||||
|
|
|
@ -539,7 +539,7 @@ Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles*, Cancelled earli
|
|||
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /workspaces/somerepo/src/tsconfig.json
|
||||
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /workspaces/somerepo/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
|
||||
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /workspaces/somerepo/node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /workspaces/somerepo/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /workspaces/somerepo/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: Not Elapsed:: *ms
|
||||
Info seq [hh:mm:ss:mss] Project '/workspaces/somerepo/src/tsconfig.json' (Configured)
|
||||
Info seq [hh:mm:ss:mss] Files (3)
|
||||
/a/lib/lib.d.ts Text-1 "/// <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; }"
|
||||
|
|
Загрузка…
Ссылка в новой задаче