MCPcopy Create free account
hub / github.com/microsoft/typescript-go / GetConditions

Function GetConditions

internal/module/resolver.go:1922–1942  ·  view source on GitHub ↗
(options *core.CompilerOptions, resolutionMode core.ResolutionMode)

Source from the content-addressed store, hash-verified

1920}
1921
1922func GetConditions(options *core.CompilerOptions, resolutionMode core.ResolutionMode) []string {
1923 moduleResolution := options.GetModuleResolutionKind()
1924 if resolutionMode == core.ModuleKindNone && moduleResolution == core.ModuleResolutionKindBundler {
1925 resolutionMode = core.ModuleKindESNext
1926 }
1927 conditions := make([]string, 0, 3+len(options.CustomConditions))
1928 if resolutionMode == core.ModuleKindESNext {
1929 conditions = append(conditions, "import")
1930 } else {
1931 conditions = append(conditions, "require")
1932 }
1933
1934 if options.NoDtsResolution != core.TSTrue {
1935 conditions = append(conditions, "types")
1936 }
1937 if moduleResolution != core.ModuleResolutionKindBundler {
1938 conditions = append(conditions, "node")
1939 }
1940 conditions = core.Concatenate(conditions, options.CustomConditions)
1941 return conditions
1942}
1943
1944func getNodeResolutionFeatures(options *core.CompilerOptions) NodeResolutionFeatures {
1945 features := NodeResolutionFeaturesNone

Calls 5

ConcatenateFunction · 0.92
lenFunction · 0.85
makeFunction · 0.50
appendFunction · 0.50

Tested by

no test coverage detected