ttsc 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +2 -1
  2. package/cmd/platform/main.go +86 -76
  3. package/cmd/ttsc/api_compile.go +122 -105
  4. package/cmd/ttsc/api_transform.go +57 -49
  5. package/cmd/ttsc/build.go +116 -103
  6. package/cmd/ttsc/main.go +117 -117
  7. package/cmd/ttsc/main_test.go +191 -191
  8. package/driver/host.go +9 -9
  9. package/driver/program.go +285 -285
  10. package/driver/rewrite.go +225 -219
  11. package/lib/compiler/internal/compileProjectInMemory.js +3 -3
  12. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  13. package/lib/compiler/internal/resolveEmittedJavaScript.js +2 -1
  14. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
  15. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  16. package/lib/compiler/internal/runBuild.js.map +1 -1
  17. package/lib/launcher/internal/getCompilerVersionText.js +1 -2
  18. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  19. package/lib/launcher/internal/prepareExecution.js +6 -4
  20. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  21. package/lib/launcher/internal/runTtsc.js +30 -4
  22. package/lib/launcher/internal/runTtsc.js.map +1 -1
  23. package/lib/launcher/internal/runTtsx.js +7 -2
  24. package/lib/launcher/internal/runTtsx.js.map +1 -1
  25. package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
  26. package/package.json +9 -9
  27. package/shim/ast/lint.go +171 -171
  28. package/shim/ast/shim.go +83 -83
  29. package/shim/bundled/shim.go +5 -1
  30. package/shim/checker/shim.go +79 -79
  31. package/shim/compiler/shim.go +16 -1
  32. package/shim/core/shim.go +10 -10
  33. package/shim/diagnosticwriter/lint.go +79 -79
  34. package/shim/diagnosticwriter/shim.go +19 -19
  35. package/shim/parser/shim.go +7 -1
  36. package/shim/scanner/shim.go +39 -1
  37. package/shim/tsoptions/shim.go +51 -1
  38. package/shim/tspath/shim.go +72 -1
  39. package/shim/vfs/cachedvfs/shim.go +1 -1
  40. package/shim/vfs/osvfs/shim.go +1 -1
  41. package/shim/vfs/shim.go +4 -1
  42. package/src/compiler/internal/compileProjectInMemory.ts +6 -3
  43. package/src/compiler/internal/resolveEmittedJavaScript.ts +2 -1
  44. package/src/compiler/internal/resolveTsgo.ts +0 -1
  45. package/src/compiler/internal/runBuild.ts +4 -1
  46. package/src/launcher/internal/getCompilerVersionText.ts +1 -2
  47. package/src/launcher/internal/prepareExecution.ts +6 -6
  48. package/src/launcher/internal/runTtsc.ts +35 -4
  49. package/src/launcher/internal/runTtsx.ts +16 -5
  50. package/src/plugin/internal/buildSourcePlugin.ts +7 -2
  51. package/test/platform.test.ts +1 -3
  52. package/test/tsgo.test.ts +6 -1
  53. package/tools/gen_shims/main.go +409 -409
@@ -1,92 +1,92 @@
1
1
  package main
2
2
 
3
3
  import (
4
- "bytes"
5
- "os"
6
- "path/filepath"
7
- "strings"
8
- "testing"
4
+ "bytes"
5
+ "os"
6
+ "path/filepath"
7
+ "strings"
8
+ "testing"
9
9
  )
10
10
 
11
11
  // withCapture replaces stdout/stderr with buffers for the duration of fn.
12
12
  // Keeps each test hermetic.
13
13
  func withCapture(fn func()) (out, errOut string) {
14
- var outBuf, errBuf bytes.Buffer
15
- prevOut, prevErr := stdout, stderr
16
- stdout = &outBuf
17
- stderr = &errBuf
18
- defer func() {
19
- stdout = prevOut
20
- stderr = prevErr
21
- }()
22
- fn()
23
- return outBuf.String(), errBuf.String()
14
+ var outBuf, errBuf bytes.Buffer
15
+ prevOut, prevErr := stdout, stderr
16
+ stdout = &outBuf
17
+ stderr = &errBuf
18
+ defer func() {
19
+ stdout = prevOut
20
+ stderr = prevErr
21
+ }()
22
+ fn()
23
+ return outBuf.String(), errBuf.String()
24
24
  }
25
25
 
26
26
  func TestRunNoArgsAttemptsProjectBuild(t *testing.T) {
27
- out, errOut := withCapture(func() {
28
- if code := run(nil); code == 0 {
29
- t.Errorf("expected no-args run without a local tsconfig to fail")
30
- }
31
- })
32
- if strings.Contains(out, "Usage:") {
33
- t.Errorf("no-args ttsc must build the project, not print help; got %q", out)
34
- }
35
- if !strings.Contains(errOut, "tsconfig") {
36
- t.Errorf("expected no-args build to look for tsconfig, got stderr %q", errOut)
37
- }
27
+ out, errOut := withCapture(func() {
28
+ if code := run(nil); code == 0 {
29
+ t.Errorf("expected no-args run without a local tsconfig to fail")
30
+ }
31
+ })
32
+ if strings.Contains(out, "Usage:") {
33
+ t.Errorf("no-args ttsc must build the project, not print help; got %q", out)
34
+ }
35
+ if !strings.Contains(errOut, "tsconfig") {
36
+ t.Errorf("expected no-args build to look for tsconfig, got stderr %q", errOut)
37
+ }
38
38
  }
39
39
 
40
40
  func TestRunHelpVariants(t *testing.T) {
41
- for _, flag := range []string{"-h", "--help", "help"} {
42
- t.Run(flag, func(t *testing.T) {
43
- out, _ := withCapture(func() {
44
- if code := run([]string{flag}); code != 0 {
45
- t.Errorf("expected exit 0, got %d", code)
46
- }
47
- })
48
- if !strings.Contains(out, "demo") {
49
- t.Errorf("help text should list demo subcommand, got %q", out)
50
- }
51
- })
52
- }
41
+ for _, flag := range []string{"-h", "--help", "help"} {
42
+ t.Run(flag, func(t *testing.T) {
43
+ out, _ := withCapture(func() {
44
+ if code := run([]string{flag}); code != 0 {
45
+ t.Errorf("expected exit 0, got %d", code)
46
+ }
47
+ })
48
+ if !strings.Contains(out, "demo") {
49
+ t.Errorf("help text should list demo subcommand, got %q", out)
50
+ }
51
+ })
52
+ }
53
53
  }
54
54
 
55
55
  func TestRunVersion(t *testing.T) {
56
- for _, flag := range []string{"-v", "--version", "version"} {
57
- t.Run(flag, func(t *testing.T) {
58
- out, _ := withCapture(func() {
59
- if code := run([]string{flag}); code != 0 {
60
- t.Errorf("expected exit 0, got %d", code)
61
- }
62
- })
63
- if !strings.Contains(out, "ttsc ") {
64
- t.Errorf("expected version banner, got %q", out)
65
- }
66
- // Include useful debug bits
67
- for _, tag := range []string{"commit", "go"} {
68
- if !strings.Contains(out, tag) {
69
- t.Errorf("expected %q substring in version output, got %q", tag, out)
70
- }
71
- }
72
- })
73
- }
56
+ for _, flag := range []string{"-v", "--version", "version"} {
57
+ t.Run(flag, func(t *testing.T) {
58
+ out, _ := withCapture(func() {
59
+ if code := run([]string{flag}); code != 0 {
60
+ t.Errorf("expected exit 0, got %d", code)
61
+ }
62
+ })
63
+ if !strings.Contains(out, "ttsc ") {
64
+ t.Errorf("expected version banner, got %q", out)
65
+ }
66
+ // Include useful debug bits
67
+ for _, tag := range []string{"commit", "go"} {
68
+ if !strings.Contains(out, tag) {
69
+ t.Errorf("expected %q substring in version output, got %q", tag, out)
70
+ }
71
+ }
72
+ })
73
+ }
74
74
  }
75
75
 
76
76
  func TestRunUnknownCommandExits2(t *testing.T) {
77
- _, errOut := withCapture(func() {
78
- if code := run([]string{"fly-to-mars"}); code != 2 {
79
- t.Errorf("expected exit 2, got %d", code)
80
- }
81
- })
82
- if !strings.Contains(errOut, "unknown command") {
83
- t.Errorf("expected error text, got %q", errOut)
84
- }
77
+ _, errOut := withCapture(func() {
78
+ if code := run([]string{"fly-to-mars"}); code != 2 {
79
+ t.Errorf("expected exit 2, got %d", code)
80
+ }
81
+ })
82
+ if !strings.Contains(errOut, "unknown command") {
83
+ t.Errorf("expected error text, got %q", errOut)
84
+ }
85
85
  }
86
86
 
87
87
  func TestRunBuildBlocksSemanticDiagnosticsBeforeEmit(t *testing.T) {
88
- root := t.TempDir()
89
- writeProjectFile(t, root, "tsconfig.json", `{
88
+ root := t.TempDir()
89
+ writeProjectFile(t, root, "tsconfig.json", `{
90
90
  "compilerOptions": {
91
91
  "module": "commonjs",
92
92
  "target": "es2020",
@@ -95,32 +95,32 @@ func TestRunBuildBlocksSemanticDiagnosticsBeforeEmit(t *testing.T) {
95
95
  }
96
96
  }
97
97
  `)
98
- writeProjectFile(t, root, "index.ts", `const value: string = 123;
98
+ writeProjectFile(t, root, "index.ts", `const value: string = 123;
99
99
  console.log(value);
100
100
  `)
101
101
 
102
- _, errOut := withCapture(func() {
103
- if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
104
- t.Errorf("expected exit 2, got %d", code)
105
- }
106
- })
107
- if !strings.Contains(errOut, "Type 'number' is not assignable to type 'string'") {
108
- t.Errorf("expected semantic diagnostic, got %q", errOut)
109
- }
110
- if !strings.Contains(errOut, "\x1b[91merror\x1b[0m") || !strings.Contains(errOut, "TS2322") {
111
- t.Errorf("expected colored TypeScript-style diagnostic header, got %q", errOut)
112
- }
113
- if !strings.Contains(errOut, "\x1b[7m1\x1b[0m") || !strings.Contains(errOut, "~~~~~") {
114
- t.Errorf("expected source context with highlighted span, got %q", errOut)
115
- }
116
- if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
117
- t.Errorf("expected no emitted JS, stat err=%v", err)
118
- }
102
+ _, errOut := withCapture(func() {
103
+ if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
104
+ t.Errorf("expected exit 2, got %d", code)
105
+ }
106
+ })
107
+ if !strings.Contains(errOut, "Type 'number' is not assignable to type 'string'") {
108
+ t.Errorf("expected semantic diagnostic, got %q", errOut)
109
+ }
110
+ if !strings.Contains(errOut, "\x1b[91merror\x1b[0m") || !strings.Contains(errOut, "TS2322") {
111
+ t.Errorf("expected colored TypeScript-style diagnostic header, got %q", errOut)
112
+ }
113
+ if !strings.Contains(errOut, "\x1b[7m1\x1b[0m") || !strings.Contains(errOut, "~~~~~") {
114
+ t.Errorf("expected source context with highlighted span, got %q", errOut)
115
+ }
116
+ if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
117
+ t.Errorf("expected no emitted JS, stat err=%v", err)
118
+ }
119
119
  }
120
120
 
121
121
  func TestRunBuildAllowsUnusedTypeParametersOnOverloadSignatures(t *testing.T) {
122
- root := t.TempDir()
123
- writeProjectFile(t, root, "tsconfig.json", `{
122
+ root := t.TempDir()
123
+ writeProjectFile(t, root, "tsconfig.json", `{
124
124
  "compilerOptions": {
125
125
  "module": "commonjs",
126
126
  "target": "es2020",
@@ -131,28 +131,28 @@ func TestRunBuildAllowsUnusedTypeParametersOnOverloadSignatures(t *testing.T) {
131
131
  }
132
132
  }
133
133
  `)
134
- writeProjectFile(t, root, "index.ts", `export function marker<T>(input: unknown): string;
134
+ writeProjectFile(t, root, "index.ts", `export function marker<T>(input: unknown): string;
135
135
  export function marker(input: unknown): string {
136
136
  return String(input);
137
137
  }
138
138
  `)
139
139
 
140
- _, errOut := withCapture(func() {
141
- if code := runBuild([]string{"--cwd", root, "--emit", "--quiet"}); code != 0 {
142
- t.Errorf("expected exit 0, got %d", code)
143
- }
144
- })
145
- if strings.Contains(errOut, "declared but never used") || strings.Contains(errOut, "All type parameters are unused") {
146
- t.Errorf("overload signature type parameters must not fail noUnused checks, got %q", errOut)
147
- }
148
- if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); err != nil {
149
- t.Errorf("expected emitted JS, stat err=%v", err)
150
- }
140
+ _, errOut := withCapture(func() {
141
+ if code := runBuild([]string{"--cwd", root, "--emit", "--quiet"}); code != 0 {
142
+ t.Errorf("expected exit 0, got %d", code)
143
+ }
144
+ })
145
+ if strings.Contains(errOut, "declared but never used") || strings.Contains(errOut, "All type parameters are unused") {
146
+ t.Errorf("overload signature type parameters must not fail noUnused checks, got %q", errOut)
147
+ }
148
+ if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); err != nil {
149
+ t.Errorf("expected emitted JS, stat err=%v", err)
150
+ }
151
151
  }
152
152
 
153
153
  func TestRunBuildBlocksUnusedParametersBeforeEmit(t *testing.T) {
154
- root := t.TempDir()
155
- writeProjectFile(t, root, "tsconfig.json", `{
154
+ root := t.TempDir()
155
+ writeProjectFile(t, root, "tsconfig.json", `{
156
156
  "compilerOptions": {
157
157
  "module": "commonjs",
158
158
  "target": "es2020",
@@ -162,28 +162,28 @@ func TestRunBuildBlocksUnusedParametersBeforeEmit(t *testing.T) {
162
162
  }
163
163
  }
164
164
  `)
165
- writeProjectFile(t, root, "index.ts", `export function run(unused: string): number {
165
+ writeProjectFile(t, root, "index.ts", `export function run(unused: string): number {
166
166
  return 1;
167
167
  }
168
168
  `)
169
169
 
170
- _, errOut := withCapture(func() {
171
- if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
172
- t.Errorf("expected exit 2, got %d", code)
173
- }
174
- })
175
- if !strings.Contains(errOut, "'unused' is declared but its value is never read") &&
176
- !strings.Contains(errOut, "'unused' is declared but never used") {
177
- t.Errorf("expected unused parameter diagnostic, got %q", errOut)
178
- }
179
- if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
180
- t.Errorf("expected no emitted JS, stat err=%v", err)
181
- }
170
+ _, errOut := withCapture(func() {
171
+ if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
172
+ t.Errorf("expected exit 2, got %d", code)
173
+ }
174
+ })
175
+ if !strings.Contains(errOut, "'unused' is declared but its value is never read") &&
176
+ !strings.Contains(errOut, "'unused' is declared but never used") {
177
+ t.Errorf("expected unused parameter diagnostic, got %q", errOut)
178
+ }
179
+ if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
180
+ t.Errorf("expected no emitted JS, stat err=%v", err)
181
+ }
182
182
  }
183
183
 
184
184
  func TestRunBuildBlocksSyntacticDiagnosticsBeforeEmit(t *testing.T) {
185
- root := t.TempDir()
186
- writeProjectFile(t, root, "tsconfig.json", `{
185
+ root := t.TempDir()
186
+ writeProjectFile(t, root, "tsconfig.json", `{
187
187
  "compilerOptions": {
188
188
  "module": "commonjs",
189
189
  "target": "es2020",
@@ -191,98 +191,98 @@ func TestRunBuildBlocksSyntacticDiagnosticsBeforeEmit(t *testing.T) {
191
191
  }
192
192
  }
193
193
  `)
194
- writeProjectFile(t, root, "index.ts", `console.log("before");
194
+ writeProjectFile(t, root, "index.ts", `console.log("before");
195
195
  const = ;
196
196
  `)
197
197
 
198
- _, errOut := withCapture(func() {
199
- if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
200
- t.Errorf("expected exit 2, got %d", code)
201
- }
202
- })
203
- if !strings.Contains(errOut, "Variable declaration expected") {
204
- t.Errorf("expected syntactic diagnostic, got %q", errOut)
205
- }
206
- if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
207
- t.Errorf("expected no emitted JS, stat err=%v", err)
208
- }
198
+ _, errOut := withCapture(func() {
199
+ if code := runBuild([]string{"--cwd", root, "--emit"}); code != 2 {
200
+ t.Errorf("expected exit 2, got %d", code)
201
+ }
202
+ })
203
+ if !strings.Contains(errOut, "Variable declaration expected") {
204
+ t.Errorf("expected syntactic diagnostic, got %q", errOut)
205
+ }
206
+ if _, err := os.Stat(filepath.Join(root, "bin", "index.js")); !os.IsNotExist(err) {
207
+ t.Errorf("expected no emitted JS, stat err=%v", err)
208
+ }
209
209
  }
210
210
 
211
211
  func writeProjectFile(t *testing.T, root string, name string, contents string) {
212
- t.Helper()
213
- file := filepath.Join(root, name)
214
- if err := os.MkdirAll(filepath.Dir(file), 0o755); err != nil {
215
- t.Fatal(err)
216
- }
217
- if err := os.WriteFile(file, []byte(contents), 0o644); err != nil {
218
- t.Fatal(err)
219
- }
212
+ t.Helper()
213
+ file := filepath.Join(root, name)
214
+ if err := os.MkdirAll(filepath.Dir(file), 0o755); err != nil {
215
+ t.Fatal(err)
216
+ }
217
+ if err := os.WriteFile(file, []byte(contents), 0o644); err != nil {
218
+ t.Fatal(err)
219
+ }
220
220
  }
221
221
 
222
222
  func TestRunDemoString(t *testing.T) {
223
- out, _ := withCapture(func() {
224
- if code := run([]string{"demo", "--type=string"}); code != 0 {
225
- t.Errorf("expected exit 0, got %d", code)
226
- }
227
- })
228
- want := `(input) => "string" === typeof input`
229
- if !strings.Contains(out, want) {
230
- t.Errorf("expected demo output to contain %q, got:\n%s", want, out)
231
- }
232
- if !strings.Contains(out, "demo<string>") {
233
- t.Errorf("expected comment prefix in demo output, got:\n%s", out)
234
- }
223
+ out, _ := withCapture(func() {
224
+ if code := run([]string{"demo", "--type=string"}); code != 0 {
225
+ t.Errorf("expected exit 0, got %d", code)
226
+ }
227
+ })
228
+ want := `(input) => "string" === typeof input`
229
+ if !strings.Contains(out, want) {
230
+ t.Errorf("expected demo output to contain %q, got:\n%s", want, out)
231
+ }
232
+ if !strings.Contains(out, "demo<string>") {
233
+ t.Errorf("expected comment prefix in demo output, got:\n%s", out)
234
+ }
235
235
  }
236
236
 
237
237
  func TestRunDemoEveryAtomic(t *testing.T) {
238
- cases := map[string]string{
239
- "boolean": `"boolean" === typeof input`,
240
- "number": `"number" === typeof input`,
241
- "bigint": `"bigint" === typeof input`,
242
- "any": `(input) => true`,
243
- }
244
- for typ, expected := range cases {
245
- t.Run(typ, func(t *testing.T) {
246
- out, _ := withCapture(func() {
247
- if code := run([]string{"demo", "--type=" + typ}); code != 0 {
248
- t.Errorf("expected exit 0 for %s, got %d", typ, code)
249
- }
250
- })
251
- if !strings.Contains(out, expected) {
252
- t.Errorf("for --type=%s, want %q in output:\n%s", typ, expected, out)
253
- }
254
- })
255
- }
238
+ cases := map[string]string{
239
+ "boolean": `"boolean" === typeof input`,
240
+ "number": `"number" === typeof input`,
241
+ "bigint": `"bigint" === typeof input`,
242
+ "any": `(input) => true`,
243
+ }
244
+ for typ, expected := range cases {
245
+ t.Run(typ, func(t *testing.T) {
246
+ out, _ := withCapture(func() {
247
+ if code := run([]string{"demo", "--type=" + typ}); code != 0 {
248
+ t.Errorf("expected exit 0 for %s, got %d", typ, code)
249
+ }
250
+ })
251
+ if !strings.Contains(out, expected) {
252
+ t.Errorf("for --type=%s, want %q in output:\n%s", typ, expected, out)
253
+ }
254
+ })
255
+ }
256
256
  }
257
257
 
258
258
  func TestRunDemoUnknownTypeExits2(t *testing.T) {
259
- _, errOut := withCapture(func() {
260
- if code := run([]string{"demo", "--type=object"}); code != 2 {
261
- t.Errorf("expected exit 2 for unknown type, got %d", code)
262
- }
263
- })
264
- if !strings.Contains(errOut, "unknown --type") {
265
- t.Errorf("expected diagnostic text, got %q", errOut)
266
- }
259
+ _, errOut := withCapture(func() {
260
+ if code := run([]string{"demo", "--type=object"}); code != 2 {
261
+ t.Errorf("expected exit 2 for unknown type, got %d", code)
262
+ }
263
+ })
264
+ if !strings.Contains(errOut, "unknown --type") {
265
+ t.Errorf("expected diagnostic text, got %q", errOut)
266
+ }
267
267
  }
268
268
 
269
269
  func TestDemoArrowEveryAtomic(t *testing.T) {
270
- cases := map[string]string{
271
- "string": `"string" === typeof input`,
272
- "number": `"number" === typeof input`,
273
- "boolean": `"boolean" === typeof input`,
274
- "bigint": `"bigint" === typeof input`,
275
- "any": `(input) => true`,
276
- }
277
- for name, want := range cases {
278
- t.Run(name, func(t *testing.T) {
279
- arrow, err := demoArrow(name)
280
- if err != nil {
281
- t.Fatalf("unexpected err: %v", err)
282
- }
283
- if !strings.Contains(arrow, want) {
284
- t.Errorf("for %s want %q, got %q", name, want, arrow)
285
- }
286
- })
287
- }
270
+ cases := map[string]string{
271
+ "string": `"string" === typeof input`,
272
+ "number": `"number" === typeof input`,
273
+ "boolean": `"boolean" === typeof input`,
274
+ "bigint": `"bigint" === typeof input`,
275
+ "any": `(input) => true`,
276
+ }
277
+ for name, want := range cases {
278
+ t.Run(name, func(t *testing.T) {
279
+ arrow, err := demoArrow(name)
280
+ if err != nil {
281
+ t.Fatalf("unexpected err: %v", err)
282
+ }
283
+ if !strings.Contains(arrow, want) {
284
+ t.Errorf("for %s want %q, got %q", name, want, arrow)
285
+ }
286
+ })
287
+ }
288
288
  }
package/driver/host.go CHANGED
@@ -5,27 +5,27 @@
5
5
  //
6
6
  // Structural note: this file is deliberately adapted from tsgonest's
7
7
  // `internal/compiler/host.go` (MIT, github.com/tsgonest/tsgonest).
8
- // The helper surface is the same; we keep names in sync to make future
9
- // upstream changes easy to compare.
8
+ // The helper surface is the same because both hosts need the same bundled-lib
9
+ // filesystem and CompilerHost construction.
10
10
  package driver
11
11
 
12
12
  import (
13
- "github.com/microsoft/typescript-go/shim/bundled"
14
- shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
15
- "github.com/microsoft/typescript-go/shim/vfs"
16
- "github.com/microsoft/typescript-go/shim/vfs/cachedvfs"
17
- "github.com/microsoft/typescript-go/shim/vfs/osvfs"
13
+ "github.com/microsoft/typescript-go/shim/bundled"
14
+ shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
15
+ "github.com/microsoft/typescript-go/shim/vfs"
16
+ "github.com/microsoft/typescript-go/shim/vfs/cachedvfs"
17
+ "github.com/microsoft/typescript-go/shim/vfs/osvfs"
18
18
  )
19
19
 
20
20
  // DefaultFS returns an OS-backed filesystem wrapped with tsgo's bundled libs so
21
21
  // built-in definitions (lib.es*.d.ts, dom, etc.) resolve without a network
22
22
  // fetch. Mirrors tsgonest/tsgolint behavior.
23
23
  func DefaultFS() vfs.FS {
24
- return bundled.WrapFS(cachedvfs.From(osvfs.FS()))
24
+ return bundled.WrapFS(cachedvfs.From(osvfs.FS()))
25
25
  }
26
26
 
27
27
  // DefaultHost returns a CompilerHost anchored at cwd that can find tsgo's
28
28
  // bundled library files via `bundled.LibPath()`.
29
29
  func DefaultHost(cwd string, fs vfs.FS) shimcompiler.CompilerHost {
30
- return shimcompiler.NewCompilerHost(cwd, fs, bundled.LibPath(), nil, nil)
30
+ return shimcompiler.NewCompilerHost(cwd, fs, bundled.LibPath(), nil, nil)
31
31
  }