getImpliedNodeFormatForFile

external fun getImpliedNodeFormatForFile(fileName: String, packageJsonInfoCache: PackageJsonInfoCache?, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode(source)

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.

Parameters

fileName

The file name to check the format of (it need not exist on disk)

packageJsonInfoCache

A cache for package file lookups - it's best to have a cache when this function is called often

host

The ModuleResolutionHost which can perform the filesystem lookups for package json data

options

The compiler options to perform the analysis under - relevant options are moduleResolution and traceResolution