mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
getImpliedNodeFormatForFile does not need a Path (#56853)
This commit is contained in:
@@ -1307,13 +1307,13 @@ export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCom
|
||||
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
||||
* `options` parameter.
|
||||
*
|
||||
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
||||
* @param fileName The file name to check the format of (it need not exist on disk)
|
||||
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
||||
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
||||
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
||||
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
||||
*/
|
||||
export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode {
|
||||
export function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode {
|
||||
const result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
|
||||
return typeof result === "object" ? result.impliedNodeFormat : result;
|
||||
}
|
||||
|
||||
+2
-2
@@ -9914,13 +9914,13 @@ declare namespace ts {
|
||||
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
||||
* `options` parameter.
|
||||
*
|
||||
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
||||
* @param fileName The file name to check the format of (it need not exist on disk)
|
||||
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
||||
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
||||
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
||||
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
||||
*/
|
||||
function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
|
||||
function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
|
||||
/**
|
||||
* Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
|
||||
* that represent a compilation unit.
|
||||
|
||||
Reference in New Issue
Block a user