esm: improve getFormatOfExtensionlessFile
perf.
#49965
Merged
getFormatOfExtensionlessFile
perf.
#49965