vendor tsgo
This commit is contained in:
45
tools/tsgo/internal/tsoptions/parsedbuildcommandline.go
Normal file
45
tools/tsgo/internal/tsoptions/parsedbuildcommandline.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package tsoptions
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/ast"
|
||||
"github.com/microsoft/typescript-go/internal/core"
|
||||
"github.com/microsoft/typescript-go/internal/locale"
|
||||
"github.com/microsoft/typescript-go/internal/tspath"
|
||||
)
|
||||
|
||||
type ParsedBuildCommandLine struct {
|
||||
BuildOptions *core.BuildOptions `json:"buildOptions"`
|
||||
CompilerOptions *core.CompilerOptions `json:"compilerOptions"`
|
||||
WatchOptions *core.WatchOptions `json:"watchOptions"`
|
||||
Projects []string `json:"projects"`
|
||||
Errors []*ast.Diagnostic `json:"errors"`
|
||||
Raw any `json:"raw"`
|
||||
|
||||
comparePathsOptions tspath.ComparePathsOptions
|
||||
|
||||
resolvedProjectPaths []string
|
||||
resolvedProjectPathsOnce sync.Once
|
||||
|
||||
locale locale.Locale
|
||||
localeOnce sync.Once
|
||||
}
|
||||
|
||||
func (p *ParsedBuildCommandLine) ResolvedProjectPaths() []string {
|
||||
p.resolvedProjectPathsOnce.Do(func() {
|
||||
p.resolvedProjectPaths = core.Map(p.Projects, func(project string) string {
|
||||
return core.ResolveConfigFileNameOfProjectReference(
|
||||
tspath.ResolvePath(p.comparePathsOptions.CurrentDirectory, project),
|
||||
)
|
||||
})
|
||||
})
|
||||
return p.resolvedProjectPaths
|
||||
}
|
||||
|
||||
func (p *ParsedBuildCommandLine) Locale() locale.Locale {
|
||||
p.localeOnce.Do(func() {
|
||||
p.locale, _ = locale.Parse(p.CompilerOptions.Locale)
|
||||
})
|
||||
return p.locale
|
||||
}
|
||||
Reference in New Issue
Block a user