Skip to content

Commit f7c042c

Browse files
committed
tsc -b
1 parent 9dc4762 commit f7c042c

File tree

114 files changed

+20817
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+20817
-596
lines changed

cmd/tsgo/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ func runMain() int {
2020
return runAPI(args[1:])
2121
}
2222
}
23-
result := execute.CommandLine(newSystem(), args, false)
23+
result := execute.CommandLine(newSystem(), args, nil)
2424
return int(result.Status)
2525
}

cmd/tsgo/sys.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ func (s *osSys) Writer() io.Writer {
4545
return s.writer
4646
}
4747

48-
func (s *osSys) EndWrite() {
49-
// do nothing, this is needed in the interface for testing
50-
// todo: revisit if improving tsc/build/watch unittest baselines
51-
}
52-
5348
func newSystem() *osSys {
5449
cwd, err := os.Getwd()
5550
if err != nil {

internal/api/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"strconv"
1010
"sync"
11+
"time"
1112

1213
"github.com/go-json-experiment/json"
1314
"github.com/microsoft/typescript-go/internal/bundled"
@@ -472,3 +473,8 @@ func (s *Server) Stat(path string) vfs.FileInfo {
472473
func (s *Server) Remove(path string) error {
473474
panic("unimplemented")
474475
}
476+
477+
// Chtimes implements vfs.FS.
478+
func (s *Server) Chtimes(path string, aTime time.Time, mTime time.Time) error {
479+
panic("unimplemented")
480+
}

internal/bundled/embed.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ func (vfs *wrappedFS) Remove(path string) error {
161161
return vfs.fs.Remove(path)
162162
}
163163

164+
func (vfs *wrappedFS) Chtimes(path string, aTime time.Time, mTime time.Time) error {
165+
if _, ok := splitPath(path); ok {
166+
panic("cannot change times on embedded file system")
167+
}
168+
return vfs.fs.Chtimes(path, aTime, mTime)
169+
}
170+
164171
type fileInfo struct {
165172
mode fs.FileMode
166173
name string

internal/compiler/emitter.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ type emitter struct {
4242
}
4343

4444
func (e *emitter) emit() {
45-
if e.host.Options().ListEmittedFiles.IsTrue() {
46-
e.emitResult.EmittedFiles = []string{}
47-
}
4845
// !!! tracing
4946
e.emitJSFile(e.sourceFile, e.paths.JsFilePath(), e.paths.SourceMapFilePath())
5047
e.emitDeclarationFile(e.sourceFile, e.paths.DeclarationFilePath(), e.paths.DeclarationMapPath())
@@ -254,7 +251,7 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s
254251
err := e.host.WriteFile(sourceMapFilePath, sourceMap, false /*writeByteOrderMark*/)
255252
if err != nil {
256253
e.emitterDiagnostics.Add(ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, jsFilePath, err.Error()))
257-
} else if e.emitResult.EmittedFiles != nil {
254+
} else {
258255
e.emitResult.EmittedFiles = append(e.emitResult.EmittedFiles, sourceMapFilePath)
259256
}
260257
}
@@ -278,7 +275,7 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s
278275
}
279276
if err != nil {
280277
e.emitterDiagnostics.Add(ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, jsFilePath, err.Error()))
281-
} else if e.emitResult.EmittedFiles != nil && !skippedDtsWrite {
278+
} else if !skippedDtsWrite {
282279
e.emitResult.EmittedFiles = append(e.emitResult.EmittedFiles, jsFilePath)
283280
}
284281

internal/compiler/fileloader.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,6 @@ func getInferredLibraryNameResolveFrom(options *core.CompilerOptions, currentDir
567567
return tspath.CombinePaths(containingDirectory, "__lib_node_modules_lookup_"+libFileName+"__.ts")
568568
}
569569

570-
type resolution struct {
571-
node *ast.Node
572-
resolvedModule *module.ResolvedModule
573-
}
574-
575570
func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.SourceFile, meta ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode {
576571
if ref.ResolutionMode != core.ResolutionModeNone {
577572
return ref.ResolutionMode

internal/compiler/program.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ func equalCheckJSDirectives(d1 *ast.CheckJsDirective, d2 *ast.CheckJsDirective)
257257

258258
func (p *Program) SourceFiles() []*ast.SourceFile { return p.files }
259259
func (p *Program) Options() *core.CompilerOptions { return p.opts.Config.CompilerOptions() }
260+
func (p *Program) GetRootFileNames() []string { return p.opts.Config.FileNames() }
260261
func (p *Program) Host() CompilerHost { return p.opts.Host }
261262
func (p *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic {
262263
return slices.Clip(p.opts.Config.GetConfigFileParsingDiagnostics())
@@ -1353,9 +1354,7 @@ func CombineEmitResults(results []*EmitResult) *EmitResult {
13531354
result.EmitSkipped = true
13541355
}
13551356
result.Diagnostics = append(result.Diagnostics, emitResult.Diagnostics...)
1356-
if emitResult.EmittedFiles != nil {
1357-
result.EmittedFiles = append(result.EmittedFiles, emitResult.EmittedFiles...)
1358-
}
1357+
result.EmittedFiles = append(result.EmittedFiles, emitResult.EmittedFiles...)
13591358
if emitResult.SourceMaps != nil {
13601359
result.SourceMaps = append(result.SourceMaps, emitResult.SourceMaps...)
13611360
}

internal/compiler/projectreferencedtsfakinghost.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package compiler
22

33
import (
44
"strings"
5+
"time"
56

67
"github.com/microsoft/typescript-go/internal/collections"
78
"github.com/microsoft/typescript-go/internal/core"
@@ -87,6 +88,11 @@ func (fs *projectReferenceDtsFakingVfs) Remove(path string) error {
8788
panic("should not be called by resolver")
8889
}
8990

91+
// Chtimes implements vfs.FS.
92+
func (fs *projectReferenceDtsFakingVfs) Chtimes(path string, aTime time.Time, mTime time.Time) error {
93+
panic("should not be called by resolver")
94+
}
95+
9096
// DirectoryExists implements vfs.FS.
9197
func (fs *projectReferenceDtsFakingVfs) DirectoryExists(path string) bool {
9298
if fs.projectReferenceFileMapper.opts.Host.FS().DirectoryExists(path) {

internal/diagnostics/diagnostics_generated.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/diagnostics/extraDiagnosticMessages.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,21 @@
2222
"A JSDoc '@type' tag may not occur with a '@param' or '@returns' tag.": {
2323
"category": "Error",
2424
"code": 8040
25+
},
26+
"Failed to delete file '{0}'.": {
27+
"category": "Message",
28+
"code": 6353
29+
},
30+
"Project '{0}' is out of date because config file does not exist.": {
31+
"category": "Message",
32+
"code": 6401
33+
},
34+
"Project '{0}' is out of date because input '{1}' does not exist.": {
35+
"category": "Message",
36+
"code": 6420
37+
},
38+
"Failed to update timestamp of file '{0}'.": {
39+
"category": "Message",
40+
"code": 5074
2541
}
2642
}

0 commit comments

Comments
 (0)