(path string, packageJsonType string)
| 2531 | } |
| 2532 | |
| 2533 | func GetImpliedNodeFormatForFile(path string, packageJsonType string) core.ModuleKind { |
| 2534 | impliedNodeFormat := core.ResolutionModeNone |
| 2535 | if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDmts, tspath.ExtensionMts, tspath.ExtensionMjs}) { |
| 2536 | impliedNodeFormat = core.ResolutionModeESM |
| 2537 | } else if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDcts, tspath.ExtensionCts, tspath.ExtensionCjs}) { |
| 2538 | impliedNodeFormat = core.ResolutionModeCommonJS |
| 2539 | } else if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDts, tspath.ExtensionTs, tspath.ExtensionTsx, tspath.ExtensionJs, tspath.ExtensionJsx}) { |
| 2540 | impliedNodeFormat = core.IfElse(packageJsonType == "module", core.ResolutionModeESM, core.ResolutionModeCommonJS) |
| 2541 | } |
| 2542 | |
| 2543 | return impliedNodeFormat |
| 2544 | } |
| 2545 | |
| 2546 | func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData SourceFileMetaData) core.ModuleKind { |
| 2547 | result := GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), sourceFileMetaData) |
no test coverage detected