Skip to content

Commit f1cb04c

Browse files
samchonclaude
andcommitted
fix: compile the remaining first-party sources on both TypeScript lines
The first CI run of the dual-target lanes found two causes. - Go: the version-neutral port left 7.1-only path calls in four Go sources. Neither go.work's tests nor the 7.1 workspace builds these modules: the unplugin compile-probe and vite-serve fixtures, the vite-optimizer E2E fixture, and the website playground. `.AsString()` exists only on 7.1's typed paths, so the 7.0 E2E linked hosts and the website build failed. They now convert with `string(path)`, which both targets accept. The optimizer probe also passed a 7.1 path to filepath.Rel. Each module now vets on both targets, except the website playground on 7.1, where typia's native code is 7.0-only. - TypeScript: the 7.1 E2E lane builds ttsc with the 7.1 nightly. That nightly reports TS7031 on CapabilityPluginResolver's `({ signal } = {})`, because it drops the contextual type of a defaulted binding pattern. The regression is microsoft/TypeScript#64431, with the fix in #64671. The option type is now spelled out. A sweep of every package with the nightly found no other new error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtwEfbkRSvQe93qSVMBKff
1 parent 1197649 commit f1cb04c

6 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎packages/ttsc/src/plugin/CapabilityPluginResolver.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ export class CapabilityPluginResolver {
6969
return {
7070
status: value.status,
7171
plugins: value.plugins,
72-
isCurrent: async ({ signal } = {}) =>
72+
// TypeScript 7.1 nightlies drop the contextual type of a defaulted
73+
// binding pattern (microsoft/TypeScript#64431, fix in #64671), so the
74+
// option type is spelled out for both compiler lines.
75+
isCurrent: async ({ signal }: { signal?: AbortSignal } = {}) =>
7376
released || this.closed
7477
? false
7578
: ((await this.request(

‎packages/unplugin/test/fixtures/compile-probe-module/cmd/public-probe/driver_emit.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func runBuild(args []string) (status int) {
132132
fmt.Fprintln(os.Stderr, err)
133133
return 2
134134
}
135-
emitted = append(emitted, name.AsString())
135+
emitted = append(emitted, string(name))
136136
}
137137
if *manifest != "" {
138138
manifestPath := *manifest
@@ -176,7 +176,7 @@ func replaceBeforeLiteral(ec *shimprinter.EmitContext, sf *shimast.SourceFile) *
176176
}
177177

178178
func writeFile(file shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
179-
fileName := file.AsString()
179+
fileName := string(file)
180180
if err := os.MkdirAll(filepath.Dir(fileName), 0o755); err != nil {
181181
return err
182182
}

‎packages/unplugin/test/fixtures/compile-probe-module/compile-probe/probe.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (plugin) EmitTransform(context driver.PluginContext) (driver.PluginTransfor
4343
return nil, fmt.Errorf("unknown shared native pipeline operation %q", operation)
4444
}
4545
return func(ec *shimprinter.EmitContext, sf *shimast.SourceFile) *shimast.SourceFile {
46-
nativeEmissionSource := sf != nil && strings.HasSuffix(filepath.ToSlash(sf.FileName().AsString()), "/tools/native-emission/src/main.ts")
46+
nativeEmissionSource := sf != nil && strings.HasSuffix(filepath.ToSlash(string(sf.FileName())), "/tools/native-emission/src/main.ts")
4747
var visitor *shimast.NodeVisitor
4848
visitor = ec.NewNodeVisitor(func(node *shimast.Node) *shimast.Node {
4949
if node != nil && node.Kind == shimast.KindVariableDeclaration {
@@ -252,13 +252,13 @@ func reportConfiguredDependencies(program *driver.Program, context driver.Plugin
252252
continue
253253
}
254254
if programSourcesPresent {
255-
actual = append(actual, source.FileName().AsString())
255+
actual = append(actual, string(source.FileName()))
256256
continue
257257
}
258-
key := resolve(source.FileName().AsString())
258+
key := resolve(string(source.FileName()))
259259
if seen, wanted := selected[key]; wanted && !seen {
260260
selected[key] = true
261-
actual = append(actual, source.FileName().AsString())
261+
actual = append(actual, string(source.FileName()))
262262
}
263263
}
264264
for file, found := range selected {

‎packages/unplugin/test/fixtures/vite-serve-module/serve-probe/probe.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (plugin) ApplyProgram(program *driver.Program, context driver.PluginContext
3535
}
3636
found := false
3737
for _, source := range program.TSProgram.GetSourceFiles() {
38-
if filepath.Clean(source.FileName().AsString()) == filepath.Clean(selected) {
38+
if filepath.Clean(string(source.FileName())) == filepath.Clean(selected) {
3939
found = true
4040
break
4141
}
@@ -117,9 +117,9 @@ func (plugin) ApplyProgram(program *driver.Program, context driver.PluginContext
117117
continue
118118
}
119119
for _, dependency := range dependencies {
120-
context.ReportFileDependency(source.FileName().AsString(), dependency)
120+
context.ReportFileDependency(string(source.FileName()), dependency)
121121
}
122-
context.ReportFileDependenciesComplete(source.FileName().AsString())
122+
context.ReportFileDependenciesComplete(string(source.FileName()))
123123
}
124124
return nil
125125
}

‎tests/test-e2e/fixtures/unplugin/vite_optimizer_discovers_transform_imports/native/optimizer-probe/probe.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (plugin) ApplyProgram(program *driver.Program, context driver.PluginContext
5353
if source.IsDeclarationFile {
5454
continue
5555
}
56-
relative, err := filepath.Rel(context.Cwd, source.FileName())
56+
relative, err := filepath.Rel(context.Cwd, string(source.FileName()))
5757
if err != nil {
5858
// Project-relative selectors cannot name a source on another volume.
5959
continue

‎website/compiler/cmd/playground/typia_plugin.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func runTypiaBuild(args []string, stdout, stderr io.Writer) int {
184184
emitted := 0
185185
writeFile := shimcompiler.WriteFile(func(fileName shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
186186
emitted++
187-
return driver.DefaultWriteFile(fileName.AsString(), text)
187+
return driver.DefaultWriteFile(string(fileName), text)
188188
})
189189
eDiags, err := prog.EmitWithPluginTransformers([]driver.PluginTransform{typiaTransform}, writeFile)
190190
if err != nil {
@@ -305,7 +305,7 @@ func runTypiaTransformProject(
305305
if sf.IsDeclarationFile {
306306
continue
307307
}
308-
key := typiaSourceFileKey(cwd, filepath.ToSlash(sf.FileName().AsString()))
308+
key := typiaSourceFileKey(cwd, filepath.ToSlash(string(sf.FileName())))
309309
if filepath.IsAbs(key) || key == ".." || strings.HasPrefix(key, "../") {
310310
continue
311311
}
@@ -371,7 +371,7 @@ func runTypiaTransformSingleJS(
371371
found := false
372372
targetKey := filepath.ToSlash(absFile)
373373
writeFile := shimcompiler.WriteFile(func(fileName shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
374-
if sameSourceStem(targetKey, fileName.AsString()) {
374+
if sameSourceStem(targetKey, string(fileName)) {
375375
captured = text
376376
found = true
377377
}

0 commit comments

Comments
 (0)