vendor tsgo

This commit is contained in:
2026-07-09 16:50:43 -04:00
parent c06ea2e5a4
commit 98978e4930
5804 changed files with 1556156 additions and 101 deletions

View File

@@ -0,0 +1,51 @@
package tsoptions
import (
"github.com/microsoft/typescript-go/internal/ast"
"github.com/microsoft/typescript-go/internal/collections"
"github.com/microsoft/typescript-go/internal/vfs"
)
func getTestParseCommandLineWorkerDiagnostics(decls []*CommandLineOption) *ParseCommandLineWorkerDiagnostics {
if len(decls) == 0 {
return CompilerOptionsDidYouMeanDiagnostics
}
return getParseCommandLineWorkerDiagnostics(decls)
}
func ParseCommandLineTestWorker(
decls []*CommandLineOption,
commandLine []string,
fs vfs.FS,
currentDirectory string,
) *TestCommandLineParser {
parser := &commandLineParser{
fs: fs,
currentDirectory: currentDirectory,
workerDiagnostics: CompilerOptionsDidYouMeanDiagnostics,
fileNames: []string{},
options: &collections.OrderedMap[string, any]{},
errors: []*ast.Diagnostic{},
}
if len(decls) != 0 {
parser.workerDiagnostics = getTestParseCommandLineWorkerDiagnostics(decls)
}
parser.optionsMap = GetNameMapFromList(parser.OptionsDeclarations())
parser.parseStrings(commandLine)
return &TestCommandLineParser{
Fs: fs,
WorkerDiagnostics: parser.workerDiagnostics,
FileNames: parser.fileNames,
Options: parser.options,
Errors: parser.errors,
}
}
type TestCommandLineParser struct {
Fs vfs.FS
WorkerDiagnostics *ParseCommandLineWorkerDiagnostics
FileNames []string
Options *collections.OrderedMap[string, any]
Errors []*ast.Diagnostic
}