ttsc 0.22.0 → 0.24.0

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 (91) hide show
  1. package/cmd/ttscgraph/serve.go +264 -48
  2. package/cmd/ttscgraph/serve_early_error_encode_failure_is_observable_test.go +40 -0
  3. package/cmd/ttscgraph/serve_graph_snapshot_version_matches_typescript_client_test.go +32 -0
  4. package/cmd/ttscgraph/serve_phase_trace_accounts_for_load_failure_test.go +45 -0
  5. package/cmd/ttscgraph/serve_phase_trace_is_opt_in_and_payload_free_test.go +52 -0
  6. package/cmd/ttscgraph/serve_protocol_negotiates_incremental_shards_test.go +44 -0
  7. package/cmd/ttscgraph/serve_session_reloads_commonjs_package_entry_for_esm_test.go +2 -2
  8. package/cmd/ttscgraph/serve_session_reloads_superseding_module_candidates_test.go +46 -20
  9. package/cmd/ttscgraph/serve_session_retries_failed_dump_test.go +9 -9
  10. package/cmd/ttscgraph/serve_shards.go +1390 -0
  11. package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +92 -0
  12. package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +57 -0
  13. package/cmd/ttscgraph/serve_shards_external_endpoints_test.go +53 -0
  14. package/cmd/ttscgraph/serve_shards_keep_source_distributed_dependencies_at_the_boundary_test.go +108 -0
  15. package/cmd/ttscgraph/serve_shards_match_full_dump_oracle_test.go +88 -0
  16. package/cmd/ttscgraph/serve_shards_merge_pending_and_new_edits_test.go +50 -0
  17. package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +65 -0
  18. package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +92 -0
  19. package/cmd/ttscgraph/serve_shards_rebuild_declaration_edit_test.go +43 -0
  20. package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +63 -0
  21. package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +80 -0
  22. package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +95 -0
  23. package/cmd/ttscgraph/serve_shards_retry_preserves_committed_generation_test.go +48 -0
  24. package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +121 -0
  25. package/driver/declaration_shape.go +85 -0
  26. package/driver/program.go +39 -10
  27. package/go.mod +1 -1
  28. package/internal/graph/build.go +62 -10
  29. package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +87 -0
  30. package/internal/graph/build_keeps_source_distributed_dependencies_at_the_external_boundary_test.go +74 -0
  31. package/internal/graph/dump.go +84 -43
  32. package/internal/graph/dump_path_mapper_caches_alias_resolution_test.go +29 -0
  33. package/internal/graph/dump_paths.go +134 -11
  34. package/internal/graph/dump_paths_canonicalize_windows_short_root_test.go +39 -0
  35. package/internal/graph/dump_rejects_provenance_only_path_errors_test.go +32 -0
  36. package/internal/graph/dump_serializes_the_full_graph_test.go +2 -2
  37. package/internal/graph/dump_symlink_project_publishes_matching_base_test.go +82 -0
  38. package/internal/graph/edges.go +58 -16
  39. package/internal/graph/exports.go +9 -2
  40. package/internal/graph/graph.go +47 -7
  41. package/internal/graph/graph_kind_contracts_match_their_producers_test.go +121 -0
  42. package/internal/graph/node_modifiers_emit_union_strings_test.go +1 -1
  43. package/internal/graph/provenance.go +11 -1
  44. package/internal/graph/resolve.go +1 -4
  45. package/internal/graph/source.go +23 -0
  46. package/internal/graph/wire_node_ids_share_alias_resolution_test.go +29 -0
  47. package/internal/lspserver/lsp_launcher_reload_directory_fingerprint_parity_windows_test.go +94 -0
  48. package/internal/lspserver/lsp_project_input_glob_path_other.go +16 -0
  49. package/internal/lspserver/lsp_project_input_glob_path_windows.go +36 -0
  50. package/internal/lspserver/lsp_project_input_path_key_other.go +17 -0
  51. package/internal/lspserver/lsp_project_input_path_key_windows.go +228 -0
  52. package/internal/lspserver/lsp_project_input_path_key_windows_test.go +460 -0
  53. package/internal/lspserver/lsp_project_inputs.go +117 -49
  54. package/internal/lspserver/lsp_reload_directories_separate_glob_territory_test.go +181 -0
  55. package/lib/flags/schema.js +1 -1
  56. package/lib/flags/schema.js.map +1 -1
  57. package/lib/internal/projectInputPathIdentity.d.ts +13 -5
  58. package/lib/internal/projectInputPathIdentity.js +95 -41
  59. package/lib/internal/projectInputPathIdentity.js.map +1 -1
  60. package/lib/internal/windowsDirectoryCaseSensitivity.d.ts +10 -0
  61. package/lib/internal/windowsDirectoryCaseSensitivity.js +34 -0
  62. package/lib/internal/windowsDirectoryCaseSensitivity.js.map +1 -0
  63. package/lib/launcher/internal/runTtsc.js +5 -0
  64. package/lib/launcher/internal/runTtsc.js.map +1 -1
  65. package/lib/launcher/internal/runTtscserver.js +59 -8
  66. package/lib/launcher/internal/runTtscserver.js.map +1 -1
  67. package/lib/launcher/internal/runTtsx.js +61 -7
  68. package/lib/launcher/internal/runTtsx.js.map +1 -1
  69. package/lib/launcher/internal/runtimeHooks.d.ts +6 -5
  70. package/lib/launcher/internal/runtimeHooks.js +7 -15
  71. package/lib/launcher/internal/runtimeHooks.js.map +1 -1
  72. package/lib/launcher/internal/watchTopology.d.ts +82 -8
  73. package/lib/launcher/internal/watchTopology.js +535 -187
  74. package/lib/launcher/internal/watchTopology.js.map +1 -1
  75. package/lib/plugin/internal/descriptorProcessFailure.d.ts +32 -0
  76. package/lib/plugin/internal/descriptorProcessFailure.js +73 -0
  77. package/lib/plugin/internal/descriptorProcessFailure.js.map +1 -0
  78. package/lib/plugin/internal/loadProjectPlugins.js +29 -8
  79. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
  80. package/package.json +12 -8
  81. package/src/flags/schema.ts +2 -1
  82. package/src/internal/projectInputPathIdentity.ts +150 -46
  83. package/src/internal/windowsDirectoryCaseSensitivity.ts +33 -0
  84. package/src/launcher/internal/runTtsc.ts +7 -0
  85. package/src/launcher/internal/runTtscserver.ts +81 -11
  86. package/src/launcher/internal/runTtsx.ts +87 -10
  87. package/src/launcher/internal/runtimeHooks.ts +16 -16
  88. package/src/launcher/internal/watchTopology.ts +679 -208
  89. package/src/plugin/internal/descriptorProcessFailure.ts +100 -0
  90. package/src/plugin/internal/loadProjectPlugins.ts +41 -8
  91. package/tools/shim_audit/baseline.json +0 -9
@@ -0,0 +1,36 @@
1
+ //go:build windows
2
+
3
+ package lspserver
4
+
5
+ import (
6
+ "path/filepath"
7
+ "strings"
8
+ )
9
+
10
+ func projectInputGlobMatchesCandidate(
11
+ pattern string,
12
+ candidate string,
13
+ ) bool {
14
+ resolvedPattern := resolveWindowsProjectInputPath(pattern)
15
+ resolvedCandidate := resolveWindowsProjectInputPath(candidate)
16
+ if !resolvedPattern.found || !resolvedCandidate.found {
17
+ return false
18
+ }
19
+ patternVolume := strings.ToLower(
20
+ filepath.ToSlash(filepath.VolumeName(resolvedPattern.physical)),
21
+ )
22
+ candidateVolume := strings.ToLower(
23
+ filepath.ToSlash(filepath.VolumeName(resolvedCandidate.physical)),
24
+ )
25
+ if patternVolume != candidateVolume {
26
+ return false
27
+ }
28
+ patternSegments, _ := windowsProjectInputSegments(resolvedPattern)
29
+ candidateSegments, candidateSensitivities :=
30
+ windowsProjectInputSegments(resolvedCandidate)
31
+ return matchProjectInputGlob(
32
+ patternSegments,
33
+ candidateSegments,
34
+ candidateSensitivities,
35
+ )
36
+ }
@@ -0,0 +1,17 @@
1
+ //go:build !windows
2
+
3
+ package lspserver
4
+
5
+ import "path/filepath"
6
+
7
+ func physicalProjectInputPath(location string) (string, error) {
8
+ return filepath.EvalSymlinks(location)
9
+ }
10
+
11
+ func projectInputPhysicalPathKey(location string) string {
12
+ return filepath.ToSlash(realProjectInputPath(location))
13
+ }
14
+
15
+ func projectInputPathKey(location string) string {
16
+ return filepath.ToSlash(filepath.Clean(filepath.FromSlash(location)))
17
+ }
@@ -0,0 +1,228 @@
1
+ //go:build windows
2
+
3
+ package lspserver
4
+
5
+ import (
6
+ "path/filepath"
7
+ "strings"
8
+ "unsafe"
9
+
10
+ "golang.org/x/sys/windows"
11
+ )
12
+
13
+ type windowsProjectInputPath struct {
14
+ found bool
15
+ missing []string
16
+ physical string
17
+ }
18
+
19
+ // projectInputPathKey resolves existing spelling through the filesystem and
20
+ // applies case folding to each segment according to the directory that owns
21
+ // that name. Windows case semantics are per directory, not per volume or OS.
22
+ func projectInputPathKey(location string) string {
23
+ normalized := filepath.Clean(projectInputFilesystemPath(location))
24
+ if !filepath.IsAbs(normalized) {
25
+ return strings.ToLower(filepath.ToSlash(normalized))
26
+ }
27
+ volume := filepath.VolumeName(normalized)
28
+ segments := splitWindowsProjectInputSegments(
29
+ strings.TrimPrefix(normalized, volume),
30
+ )
31
+ current := windowsProjectInputVolumeRoot(volume)
32
+ sensitive := false
33
+ for index, segment := range segments {
34
+ if currentSensitivity, ok :=
35
+ tryQueryProjectInputDirectoryCaseSensitivity(current); ok {
36
+ sensitive = currentSensitivity
37
+ }
38
+ if !sensitive {
39
+ segments[index] = strings.ToLower(segments[index])
40
+ }
41
+ current = filepath.Join(current, segment)
42
+ }
43
+ return windowsProjectInputKey(normalized, segments)
44
+ }
45
+
46
+ func resolveWindowsProjectInputPath(location string) windowsProjectInputPath {
47
+ normalized := filepath.Clean(projectInputFilesystemPath(location))
48
+ if !filepath.IsAbs(normalized) {
49
+ return windowsProjectInputPath{physical: normalized}
50
+ }
51
+ probe := normalized
52
+ missing := []string{}
53
+ for {
54
+ physical, err := physicalProjectInputPath(probe)
55
+ if err == nil {
56
+ return windowsProjectInputPath{
57
+ found: true,
58
+ missing: reverseWindowsProjectInputSegments(missing),
59
+ physical: filepath.Clean(physical),
60
+ }
61
+ }
62
+ parent := filepath.Dir(probe)
63
+ if parent == probe {
64
+ return windowsProjectInputPath{physical: normalized}
65
+ }
66
+ missing = append(missing, filepath.Base(probe))
67
+ probe = parent
68
+ }
69
+ }
70
+
71
+ func physicalProjectInputPath(location string) (string, error) {
72
+ pointer, err := windows.UTF16PtrFromString(location)
73
+ if err != nil {
74
+ return "", err
75
+ }
76
+ handle, err := windows.CreateFile(
77
+ pointer,
78
+ windows.FILE_READ_ATTRIBUTES,
79
+ windows.FILE_SHARE_READ|windows.FILE_SHARE_WRITE|windows.FILE_SHARE_DELETE,
80
+ nil,
81
+ windows.OPEN_EXISTING,
82
+ windows.FILE_FLAG_BACKUP_SEMANTICS,
83
+ 0,
84
+ )
85
+ if err != nil {
86
+ return "", err
87
+ }
88
+ defer windows.CloseHandle(handle)
89
+
90
+ buffer := make([]uint16, windows.MAX_PATH)
91
+ for {
92
+ length, err := windows.GetFinalPathNameByHandle(
93
+ handle,
94
+ &buffer[0],
95
+ uint32(len(buffer)),
96
+ 0,
97
+ )
98
+ if err != nil {
99
+ return "", err
100
+ }
101
+ if length < uint32(len(buffer)) {
102
+ return filepath.Clean(
103
+ projectInputFilesystemPath(
104
+ windows.UTF16ToString(buffer[:length]),
105
+ ),
106
+ ), nil
107
+ }
108
+ buffer = make([]uint16, length+1)
109
+ }
110
+ }
111
+
112
+ func projectInputPhysicalPathKey(location string) string {
113
+ resolved := resolveWindowsProjectInputPath(location)
114
+ volume := filepath.VolumeName(resolved.physical)
115
+ segments := splitWindowsProjectInputSegments(
116
+ strings.TrimPrefix(resolved.physical, volume),
117
+ )
118
+ if len(resolved.missing) != 0 {
119
+ missing := append([]string{}, resolved.missing...)
120
+ if !queryProjectInputDirectoryCaseSensitivity(resolved.physical) {
121
+ for index := range missing {
122
+ missing[index] = strings.ToLower(missing[index])
123
+ }
124
+ }
125
+ segments = append(segments, missing...)
126
+ }
127
+ prefix := filepath.ToSlash(volume)
128
+ if len(segments) == 0 {
129
+ return prefix + "/"
130
+ }
131
+ return prefix + "/" + strings.Join(segments, "/")
132
+ }
133
+
134
+ func windowsProjectInputSegments(
135
+ resolved windowsProjectInputPath,
136
+ ) ([]string, []bool) {
137
+ volume := filepath.VolumeName(resolved.physical)
138
+ existing := splitWindowsProjectInputSegments(
139
+ strings.TrimPrefix(resolved.physical, volume),
140
+ )
141
+ segments := append(append([]string{}, existing...), resolved.missing...)
142
+ sensitivities := make([]bool, 0, len(segments))
143
+ current := windowsProjectInputVolumeRoot(volume)
144
+ for _, segment := range existing {
145
+ sensitivities = append(
146
+ sensitivities,
147
+ queryProjectInputDirectoryCaseSensitivity(current),
148
+ )
149
+ current = filepath.Join(current, segment)
150
+ }
151
+ if len(resolved.missing) != 0 {
152
+ missingSensitivity := queryProjectInputDirectoryCaseSensitivity(
153
+ resolved.physical,
154
+ )
155
+ for range resolved.missing {
156
+ sensitivities = append(sensitivities, missingSensitivity)
157
+ }
158
+ }
159
+ return segments, sensitivities
160
+ }
161
+
162
+ func windowsProjectInputKey(location string, segments []string) string {
163
+ volume := filepath.VolumeName(location)
164
+ prefix := strings.ToLower(filepath.ToSlash(volume))
165
+ if len(segments) == 0 {
166
+ return prefix + "/"
167
+ }
168
+ return prefix + "/" + strings.Join(segments, "/")
169
+ }
170
+
171
+ func windowsProjectInputVolumeRoot(volume string) string {
172
+ if strings.HasSuffix(volume, `\`) || strings.HasSuffix(volume, "/") {
173
+ return volume
174
+ }
175
+ return volume + `\`
176
+ }
177
+
178
+ func splitWindowsProjectInputSegments(location string) []string {
179
+ return strings.FieldsFunc(location, func(character rune) bool {
180
+ return character == '/' || character == '\\'
181
+ })
182
+ }
183
+
184
+ func reverseWindowsProjectInputSegments(segments []string) []string {
185
+ reversed := make([]string, len(segments))
186
+ for index := range segments {
187
+ reversed[len(segments)-index-1] = segments[index]
188
+ }
189
+ return reversed
190
+ }
191
+
192
+ func queryProjectInputDirectoryCaseSensitivity(directory string) bool {
193
+ sensitive, _ := tryQueryProjectInputDirectoryCaseSensitivity(directory)
194
+ return sensitive
195
+ }
196
+
197
+ func tryQueryProjectInputDirectoryCaseSensitivity(
198
+ directory string,
199
+ ) (bool, bool) {
200
+ pointer, err := windows.UTF16PtrFromString(directory)
201
+ if err != nil {
202
+ return false, false
203
+ }
204
+ handle, err := windows.CreateFile(
205
+ pointer,
206
+ windows.FILE_READ_ATTRIBUTES,
207
+ windows.FILE_SHARE_READ|windows.FILE_SHARE_WRITE|windows.FILE_SHARE_DELETE,
208
+ nil,
209
+ windows.OPEN_EXISTING,
210
+ windows.FILE_FLAG_BACKUP_SEMANTICS,
211
+ 0,
212
+ )
213
+ if err != nil {
214
+ return false, false
215
+ }
216
+ defer windows.CloseHandle(handle)
217
+
218
+ var flags uint32
219
+ if err := windows.GetFileInformationByHandleEx(
220
+ handle,
221
+ windows.FileCaseSensitiveInfo,
222
+ (*byte)(unsafe.Pointer(&flags)),
223
+ uint32(unsafe.Sizeof(flags)),
224
+ ); err != nil {
225
+ return false, false
226
+ }
227
+ return flags&windows.FILE_CS_FLAG_CASE_SENSITIVE_DIR != 0, true
228
+ }