Make `emitModuleKindIsNonNodeESM` internal (#52599)

This commit is contained in:
Andrew Branch 2023-02-06 08:44:58 -08:00 коммит произвёл GitHub
Родитель 1ed0a5ac4b
Коммит 0bf99914e7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -3066,6 +3066,7 @@ export function classicNameResolver(moduleName: string, containingFile: string,
// Program errors validate that `noEmit` or `emitDeclarationOnly` is also set,
// so this function doesn't check them to avoid propagating errors.
/** @internal */
export function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string) {
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
}

Просмотреть файл

@ -7989,6 +7989,7 @@ export function getEmitModuleKind(compilerOptions: {module?: CompilerOptions["mo
getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS;
}
/** @internal */
export function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind) {
return moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext;
}

Просмотреть файл

@ -8689,7 +8689,6 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind): boolean;
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@ -9144,7 +9143,6 @@ declare namespace ts {
function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined;
interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, NonRelativeNameResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
}
interface ModeAwareCache<T> {

Просмотреть файл

@ -4714,7 +4714,6 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind): boolean;
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@ -5169,7 +5168,6 @@ declare namespace ts {
function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined;
interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, NonRelativeNameResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
}
interface ModeAwareCache<T> {