ttsc 0.33.0 → 0.34.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 (398) hide show
  1. package/README.md +2 -0
  2. package/cmd/ttsc/api_compile.go +3 -2
  3. package/cmd/ttsc/api_transform.go +1 -1
  4. package/cmd/ttsc/build.go +5 -4
  5. package/cmd/ttsc-cache/account.go +16 -0
  6. package/cmd/ttsc-cache/account_test.go +91 -0
  7. package/cmd/ttsc-cache/main.go +1 -1
  8. package/cmd/ttsc-cache/protocol_test.go +2 -2
  9. package/cmd/ttsc-cache/publisher_seal_test.go +1 -1
  10. package/cmd/ttsc-cache/stock_go_failure_test.go +1 -1
  11. package/cmd/ttsc-cache/stock_go_test.go +2 -2
  12. package/cmd/ttsc-cache/store.go +5 -0
  13. package/cmd/ttsc-cache/tuple.go +6 -2
  14. package/cmd/ttsc-cache/tuple_test.go +1 -1
  15. package/cmd/ttscgraph/main.go +6 -1
  16. package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +6 -1
  17. package/cmd/ttscgraph/serve.go +22 -20
  18. package/cmd/ttscgraph/serve_alternative_members_and_reads_refresh_test.go +95 -0
  19. package/cmd/ttscgraph/serve_shards.go +26 -15
  20. package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +2 -2
  21. package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +3 -3
  22. package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +1 -1
  23. package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +3 -3
  24. package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +2 -2
  25. package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +3 -3
  26. package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +5 -5
  27. package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +8 -8
  28. package/cmd/ttscgraph/serve_source_encoding_test.go +2 -2
  29. package/driver/build_information_uses_selected_output_identity_test.go +5 -4
  30. package/driver/check_observations.go +1 -1
  31. package/driver/config_discovery.go +5 -1
  32. package/driver/declaration_shape.go +15 -21
  33. package/driver/diagnostics_preamble.go +2 -2
  34. package/driver/emit_containment.go +11 -14
  35. package/driver/emit_plugin.go +51 -43
  36. package/driver/emit_plugin_output.go +6 -5
  37. package/driver/emit_provenance.go +12 -15
  38. package/driver/graph.go +8 -8
  39. package/driver/host.go +15 -5
  40. package/driver/input_observation.go +22 -21
  41. package/driver/input_observation_test.go +11 -10
  42. package/driver/overlay.go +11 -11
  43. package/driver/program.go +102 -51
  44. package/driver/resolution_candidates.go +50 -32
  45. package/driver/resolution_candidates_test.go +18 -5
  46. package/driver/rewrite.go +11 -13
  47. package/driver/session.go +13 -7
  48. package/driver/target_ts70.go +85 -0
  49. package/driver/target_ts71.go +97 -0
  50. package/driver/transform_dependencies.go +1 -1
  51. package/driver/transform_source_map.go +21 -20
  52. package/go.mod +3 -3
  53. package/go.sum +4 -4
  54. package/internal/graph/alternative_member_declarations_resolve_uses_test.go +145 -0
  55. package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +2 -2
  56. package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +2 -2
  57. package/internal/graph/build.go +75 -33
  58. package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +4 -4
  59. package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +1 -1
  60. package/internal/graph/declaration_members.go +143 -0
  61. package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +3 -3
  62. package/internal/graph/doc_tags.go +2 -2
  63. package/internal/graph/dump_paths.go +6 -5
  64. package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +1 -1
  65. package/internal/graph/edges.go +151 -68
  66. package/internal/graph/edges_cover_class_level_references_test.go +5 -5
  67. package/internal/graph/enum_initializer_calls_are_edges_test.go +2 -2
  68. package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +6 -6
  69. package/internal/graph/exports.go +6 -6
  70. package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +2 -2
  71. package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +1 -1
  72. package/internal/graph/function_locals_do_not_collide_test.go +3 -3
  73. package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +5 -5
  74. package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +2 -2
  75. package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +3 -3
  76. package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +3 -3
  77. package/internal/graph/literals.go +3 -3
  78. package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +2 -2
  79. package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +4 -4
  80. package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +2 -2
  81. package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +1 -1
  82. package/internal/graph/literals_resolve_through_alias_indirection_test.go +3 -3
  83. package/internal/graph/member_relation_edges_follow_checker_validity_test.go +7 -7
  84. package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +19 -19
  85. package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +11 -11
  86. package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +2 -2
  87. package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +7 -7
  88. package/internal/graph/namespace_private_declarations_keep_lexical_identity_test.go +85 -0
  89. package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +2 -2
  90. package/internal/graph/object_literal_declarations_resolve_calls_test.go +9 -9
  91. package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +1 -1
  92. package/internal/graph/overload_implementation_replaces_signature_test.go +2 -2
  93. package/internal/graph/property_member_edges_remain_owner_visible_test.go +6 -6
  94. package/internal/graph/resolve.go +37 -12
  95. package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +6 -6
  96. package/internal/graph/source.go +1 -1
  97. package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +7 -7
  98. package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +2 -2
  99. package/internal/graph/value_access_edges_cover_properties_test.go +5 -5
  100. package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +3 -3
  101. package/internal/graph/value_call_edges_cover_jsx_components_test.go +2 -2
  102. package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +3 -3
  103. package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +2 -2
  104. package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +4 -4
  105. package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +3 -3
  106. package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +2 -2
  107. package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +4 -4
  108. package/internal/graph/value_reads_cover_expression_positions_test.go +88 -0
  109. package/lib/compiler/internal/buildNativeCompiler.d.ts +5 -2
  110. package/lib/compiler/internal/buildNativeCompiler.js +12 -4
  111. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  112. package/lib/flags/COMPILER_ENUM_WHITESPACE.js +1 -1
  113. package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -1
  114. package/lib/flags/COMPILER_OPTIONS.js +1079 -149
  115. package/lib/flags/COMPILER_OPTIONS.js.map +1 -1
  116. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +1 -1
  117. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -1
  118. package/lib/flags/COMPILER_OPTION_KINDS.js +1 -1
  119. package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -1
  120. package/lib/flags/CompilerOptionSpec.d.ts +9 -2
  121. package/lib/internal/pluginSource.d.ts +1 -0
  122. package/lib/internal/pluginSource.js +1 -0
  123. package/lib/internal/pluginSource.js.map +1 -1
  124. package/lib/launcher/internal/TypeScriptSyncApi.d.ts +140 -0
  125. package/lib/launcher/internal/TypeScriptSyncApi.js +99 -0
  126. package/lib/launcher/internal/TypeScriptSyncApi.js.map +1 -0
  127. package/lib/launcher/internal/buildSingleRootInMemory.d.ts +80 -0
  128. package/lib/launcher/internal/buildSingleRootInMemory.js +253 -0
  129. package/lib/launcher/internal/buildSingleRootInMemory.js.map +1 -0
  130. package/lib/launcher/internal/buildSingleRootProject.d.ts +22 -18
  131. package/lib/launcher/internal/buildSingleRootProject.js +27 -18
  132. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
  133. package/lib/launcher/internal/compilerArgsAsConfigOptions.d.ts +39 -0
  134. package/lib/launcher/internal/compilerArgsAsConfigOptions.js +115 -0
  135. package/lib/launcher/internal/compilerArgsAsConfigOptions.js.map +1 -0
  136. package/lib/plugin/CapabilityPluginResolver.js +3 -0
  137. package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
  138. package/lib/plugin/internal/load/loadProjectPlugins.js +6 -2
  139. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
  140. package/lib/plugin/internal/source/CompilerTarget.d.ts +127 -0
  141. package/lib/plugin/internal/source/CompilerTarget.js +231 -0
  142. package/lib/plugin/internal/source/CompilerTarget.js.map +1 -0
  143. package/lib/plugin/internal/source/NativeSourcePackages.js +6 -5
  144. package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
  145. package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +18 -1
  146. package/lib/plugin/internal/source/SourcePluginAdmission.js +24 -2
  147. package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -1
  148. package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +6 -3
  149. package/lib/plugin/internal/source/SourcePluginWorkspace.js +31 -13
  150. package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
  151. package/lib/plugin/internal/source/buildSourcePlugin.js +3 -1
  152. package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
  153. package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +1 -1
  154. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +9 -1
  155. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
  156. package/package.json +14 -9
  157. package/shim/ast/enums_gen.go +1 -0
  158. package/shim/ast/go.mod +2 -2
  159. package/shim/ast/go.sum +4 -4
  160. package/shim/ast/neutral.go +141 -0
  161. package/shim/astnav/go.mod +2 -2
  162. package/shim/astnav/go.sum +4 -4
  163. package/shim/bundled/go.mod +2 -2
  164. package/shim/bundled/go.sum +4 -4
  165. package/shim/checker/go.mod +2 -2
  166. package/shim/checker/go.sum +4 -4
  167. package/shim/compiler/go.mod +2 -2
  168. package/shim/compiler/go.sum +4 -4
  169. package/shim/compiler/neutral.go +213 -0
  170. package/shim/core/go.mod +2 -2
  171. package/shim/core/go.sum +4 -4
  172. package/shim/diagnosticwriter/go.mod +2 -2
  173. package/shim/diagnosticwriter/go.sum +4 -4
  174. package/shim/lsp/go.mod +2 -2
  175. package/shim/lsp/go.sum +4 -4
  176. package/shim/parser/go.mod +2 -2
  177. package/shim/parser/go.sum +4 -4
  178. package/shim/printer/go.mod +2 -2
  179. package/shim/printer/go.sum +4 -4
  180. package/shim/scanner/go.mod +2 -2
  181. package/shim/scanner/go.sum +4 -4
  182. package/shim/stringutil/go.mod +1 -1
  183. package/shim/stringutil/go.sum +2 -2
  184. package/shim/stringutil/shim.go +15 -0
  185. package/shim/transformers/go.mod +2 -2
  186. package/shim/transformers/go.sum +4 -4
  187. package/shim/tsoptions/go.mod +2 -2
  188. package/shim/tsoptions/go.sum +4 -4
  189. package/shim/tsoptions/neutral.go +56 -0
  190. package/shim/tspath/go.mod +1 -1
  191. package/shim/tspath/go.sum +2 -2
  192. package/shim/tspath/neutral.go +150 -0
  193. package/shim/tspath/typed_paths.go +266 -0
  194. package/shim/vfs/cachedvfs/go.mod +2 -2
  195. package/shim/vfs/cachedvfs/go.sum +4 -4
  196. package/shim/vfs/go.mod +2 -2
  197. package/shim/vfs/go.sum +4 -4
  198. package/shim/vfs/neutral.go +20 -0
  199. package/shim/vfs/osvfs/go.mod +2 -2
  200. package/shim/vfs/osvfs/go.sum +4 -4
  201. package/src/compiler/internal/buildNativeCompiler.ts +13 -4
  202. package/src/flags/COMPILER_ENUM_WHITESPACE.ts +1 -1
  203. package/src/flags/COMPILER_OPTIONS.ts +1080 -150
  204. package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +1 -1
  205. package/src/flags/COMPILER_OPTION_KINDS.ts +1 -1
  206. package/src/flags/CompilerOptionSpec.ts +11 -2
  207. package/src/internal/pluginSource.ts +1 -0
  208. package/src/launcher/internal/TypeScriptSyncApi.ts +186 -0
  209. package/src/launcher/internal/buildSingleRootInMemory.ts +319 -0
  210. package/src/launcher/internal/buildSingleRootProject.ts +26 -18
  211. package/src/launcher/internal/compilerArgsAsConfigOptions.ts +112 -0
  212. package/src/plugin/CapabilityPluginResolver.ts +4 -1
  213. package/src/plugin/internal/load/loadProjectPlugins.ts +12 -2
  214. package/src/plugin/internal/source/CompilerTarget.ts +249 -0
  215. package/src/plugin/internal/source/NativeSourcePackages.ts +10 -4
  216. package/src/plugin/internal/source/SourcePluginAdmission.ts +28 -2
  217. package/src/plugin/internal/source/SourcePluginWorkspace.ts +45 -19
  218. package/src/plugin/internal/source/buildSourcePlugin.ts +3 -1
  219. package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +9 -1
  220. package/targets/7.1/bridge/ast/enums_gen.go +174 -0
  221. package/targets/7.1/bridge/ast/extra-shim.json +4 -0
  222. package/targets/7.1/bridge/ast/go.mod +14 -0
  223. package/targets/7.1/bridge/ast/go.sum +20 -0
  224. package/targets/7.1/bridge/ast/lint.go +1412 -0
  225. package/targets/7.1/bridge/ast/neutral.go +141 -0
  226. package/targets/7.1/bridge/ast/parent.go +60 -0
  227. package/targets/7.1/bridge/ast/safe_text.go +108 -0
  228. package/targets/7.1/bridge/ast/shim.go +1656 -0
  229. package/targets/7.1/bridge/ast/surface.go +686 -0
  230. package/targets/7.1/bridge/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
  231. package/targets/7.1/bridge/ast/test/node_text_joins_multi_hop_qualified_name_test.go +47 -0
  232. package/targets/7.1/bridge/ast/test/node_text_joins_one_hop_qualified_name_test.go +35 -0
  233. package/targets/7.1/bridge/ast/test/node_text_returns_empty_for_nil_test.go +31 -0
  234. package/targets/7.1/bridge/ast/test/node_text_returns_identifier_text_test.go +34 -0
  235. package/targets/7.1/bridge/ast/test/node_text_skips_empty_qualified_left_test.go +60 -0
  236. package/targets/7.1/bridge/astnav/go.mod +14 -0
  237. package/targets/7.1/bridge/astnav/go.sum +22 -0
  238. package/targets/7.1/bridge/astnav/shim.go +24 -0
  239. package/targets/7.1/bridge/bundled/extra-shim.json +1 -0
  240. package/targets/7.1/bridge/bundled/go.mod +10 -0
  241. package/targets/7.1/bridge/bundled/go.sum +10 -0
  242. package/targets/7.1/bridge/bundled/shim.go +24 -0
  243. package/targets/7.1/bridge/checker/enums_gen.go +150 -0
  244. package/targets/7.1/bridge/checker/extra-shim.json +37 -0
  245. package/targets/7.1/bridge/checker/go.mod +15 -0
  246. package/targets/7.1/bridge/checker/go.sum +24 -0
  247. package/targets/7.1/bridge/checker/node_builder_fields_gen.go +19 -0
  248. package/targets/7.1/bridge/checker/shim.go +1390 -0
  249. package/targets/7.1/bridge/compiler/contentmapper_process.go +70 -0
  250. package/targets/7.1/bridge/compiler/emit_sourcemap.go +296 -0
  251. package/targets/7.1/bridge/compiler/emitassemble.go +81 -0
  252. package/targets/7.1/bridge/compiler/emithook.go +44 -0
  253. package/targets/7.1/bridge/compiler/extra-shim.json +4 -0
  254. package/targets/7.1/bridge/compiler/go.mod +15 -0
  255. package/targets/7.1/bridge/compiler/go.sum +24 -0
  256. package/targets/7.1/bridge/compiler/incremental.go +185 -0
  257. package/targets/7.1/bridge/compiler/neutral.go +256 -0
  258. package/targets/7.1/bridge/compiler/resolution.go +571 -0
  259. package/targets/7.1/bridge/compiler/shim.go +70 -0
  260. package/targets/7.1/bridge/core/enums_gen.go +15 -0
  261. package/targets/7.1/bridge/core/extra-shim.json +4 -0
  262. package/targets/7.1/bridge/core/go.mod +7 -0
  263. package/targets/7.1/bridge/core/go.sum +8 -0
  264. package/targets/7.1/bridge/core/modulekind.go +19 -0
  265. package/targets/7.1/bridge/core/shim.go +272 -0
  266. package/targets/7.1/bridge/diagnosticwriter/go.mod +14 -0
  267. package/targets/7.1/bridge/diagnosticwriter/go.sum +20 -0
  268. package/targets/7.1/bridge/diagnosticwriter/lint.go +411 -0
  269. package/targets/7.1/bridge/diagnosticwriter/shim.go +56 -0
  270. package/targets/7.1/bridge/lsp/extra-shim.json +4 -0
  271. package/targets/7.1/bridge/lsp/go.mod +16 -0
  272. package/targets/7.1/bridge/lsp/go.sum +26 -0
  273. package/targets/7.1/bridge/lsp/shim.go +112 -0
  274. package/targets/7.1/bridge/parser/extra-shim.json +4 -0
  275. package/targets/7.1/bridge/parser/go.mod +14 -0
  276. package/targets/7.1/bridge/parser/go.sum +24 -0
  277. package/targets/7.1/bridge/parser/shim.go +61 -0
  278. package/targets/7.1/bridge/printer/emithost.go +69 -0
  279. package/targets/7.1/bridge/printer/go.mod +15 -0
  280. package/targets/7.1/bridge/printer/go.sum +24 -0
  281. package/targets/7.1/bridge/printer/shim.go +168 -0
  282. package/targets/7.1/bridge/printer/sourcemap.go +49 -0
  283. package/targets/7.1/bridge/scanner/extra-shim.json +4 -0
  284. package/targets/7.1/bridge/scanner/go.mod +14 -0
  285. package/targets/7.1/bridge/scanner/go.sum +20 -0
  286. package/targets/7.1/bridge/scanner/regexp.go +42 -0
  287. package/targets/7.1/bridge/scanner/shim.go +137 -0
  288. package/targets/7.1/bridge/stringutil/extra-shim.json +1 -0
  289. package/targets/7.1/bridge/stringutil/go.mod +5 -0
  290. package/targets/7.1/bridge/stringutil/go.sum +2 -0
  291. package/targets/7.1/bridge/stringutil/shim.go +131 -0
  292. package/targets/7.1/bridge/transformers/go.mod +15 -0
  293. package/targets/7.1/bridge/transformers/go.sum +24 -0
  294. package/targets/7.1/bridge/transformers/shim.go +24 -0
  295. package/targets/7.1/bridge/tsoptions/command_line_raw.go +44 -0
  296. package/targets/7.1/bridge/tsoptions/extra-shim.json +4 -0
  297. package/targets/7.1/bridge/tsoptions/go.mod +15 -0
  298. package/targets/7.1/bridge/tsoptions/go.sum +24 -0
  299. package/targets/7.1/bridge/tsoptions/neutral.go +47 -0
  300. package/targets/7.1/bridge/tsoptions/shim.go +193 -0
  301. package/targets/7.1/bridge/tspath/extra-shim.json +4 -0
  302. package/targets/7.1/bridge/tspath/go.mod +5 -0
  303. package/targets/7.1/bridge/tspath/go.sum +6 -0
  304. package/targets/7.1/bridge/tspath/neutral.go +142 -0
  305. package/targets/7.1/bridge/tspath/shim.go +382 -0
  306. package/targets/7.1/bridge/vfs/cachedvfs/extra-shim.json +4 -0
  307. package/targets/7.1/bridge/vfs/cachedvfs/go.mod +5 -0
  308. package/targets/7.1/bridge/vfs/cachedvfs/go.sum +10 -0
  309. package/targets/7.1/bridge/vfs/cachedvfs/shim.go +12 -0
  310. package/targets/7.1/bridge/vfs/decode.go +26 -0
  311. package/targets/7.1/bridge/vfs/decode_test.go +42 -0
  312. package/targets/7.1/bridge/vfs/extra-shim.json +4 -0
  313. package/targets/7.1/bridge/vfs/go.mod +10 -0
  314. package/targets/7.1/bridge/vfs/go.sum +10 -0
  315. package/targets/7.1/bridge/vfs/neutral.go +23 -0
  316. package/targets/7.1/bridge/vfs/osvfs/extra-shim.json +4 -0
  317. package/targets/7.1/bridge/vfs/osvfs/go.mod +10 -0
  318. package/targets/7.1/bridge/vfs/osvfs/go.sum +10 -0
  319. package/targets/7.1/bridge/vfs/osvfs/shim.go +14 -0
  320. package/targets/7.1/bridge/vfs/shim.go +27 -0
  321. package/targets/7.1/facade/ast/facade_gen.go +2691 -0
  322. package/targets/7.1/facade/ast/go.mod +20 -0
  323. package/targets/7.1/facade/ast/go.sum +20 -0
  324. package/targets/7.1/facade/astnav/facade_gen.go +15 -0
  325. package/targets/7.1/facade/astnav/go.mod +22 -0
  326. package/targets/7.1/facade/astnav/go.sum +22 -0
  327. package/targets/7.1/facade/bundled/facade_gen.go +32 -0
  328. package/targets/7.1/facade/bundled/go.mod +21 -0
  329. package/targets/7.1/facade/bundled/go.sum +10 -0
  330. package/targets/7.1/facade/checker/facade_gen.go +563 -0
  331. package/targets/7.1/facade/checker/go.mod +26 -0
  332. package/targets/7.1/facade/checker/go.sum +24 -0
  333. package/targets/7.1/facade/compiler/facade_gen.go +198 -0
  334. package/targets/7.1/facade/compiler/go.mod +41 -0
  335. package/targets/7.1/facade/compiler/go.sum +24 -0
  336. package/targets/7.1/facade/core/facade_gen.go +130 -0
  337. package/targets/7.1/facade/core/go.mod +12 -0
  338. package/targets/7.1/facade/core/go.sum +8 -0
  339. package/targets/7.1/facade/diagnosticwriter/facade_gen.go +36 -0
  340. package/targets/7.1/facade/diagnosticwriter/go.mod +22 -0
  341. package/targets/7.1/facade/diagnosticwriter/go.sum +20 -0
  342. package/targets/7.1/facade/lsp/facade_gen.go +31 -0
  343. package/targets/7.1/facade/lsp/go.mod +19 -0
  344. package/targets/7.1/facade/lsp/go.sum +26 -0
  345. package/targets/7.1/facade/parser/facade_gen.go +102 -0
  346. package/targets/7.1/facade/parser/go.mod +25 -0
  347. package/targets/7.1/facade/parser/go.sum +24 -0
  348. package/targets/7.1/facade/printer/facade_gen.go +74 -0
  349. package/targets/7.1/facade/printer/go.mod +26 -0
  350. package/targets/7.1/facade/printer/go.sum +24 -0
  351. package/targets/7.1/facade/scanner/facade_gen.go +191 -0
  352. package/targets/7.1/facade/scanner/go.mod +25 -0
  353. package/targets/7.1/facade/scanner/go.sum +20 -0
  354. package/targets/7.1/facade/stringutil/facade_gen.go +176 -0
  355. package/targets/7.1/facade/stringutil/go.mod +9 -0
  356. package/targets/7.1/facade/stringutil/go.sum +2 -0
  357. package/targets/7.1/facade/transformers/facade_gen.go +12 -0
  358. package/targets/7.1/facade/transformers/go.mod +18 -0
  359. package/targets/7.1/facade/transformers/go.sum +24 -0
  360. package/targets/7.1/facade/tsoptions/facade_gen.go +274 -0
  361. package/targets/7.1/facade/tsoptions/go.mod +32 -0
  362. package/targets/7.1/facade/tsoptions/go.sum +24 -0
  363. package/targets/7.1/facade/tspath/facade_gen.go +550 -0
  364. package/targets/7.1/facade/tspath/go.mod +9 -0
  365. package/targets/7.1/facade/tspath/go.sum +6 -0
  366. package/targets/7.1/facade/vfs/cachedvfs/facade_gen.go +17 -0
  367. package/targets/7.1/facade/vfs/cachedvfs/go.mod +18 -0
  368. package/targets/7.1/facade/vfs/cachedvfs/go.sum +10 -0
  369. package/targets/7.1/facade/vfs/facade_gen.go +47 -0
  370. package/targets/7.1/facade/vfs/go.mod +18 -0
  371. package/targets/7.1/facade/vfs/go.sum +10 -0
  372. package/targets/7.1/facade/vfs/osvfs/facade_gen.go +20 -0
  373. package/targets/7.1/facade/vfs/osvfs/go.mod +21 -0
  374. package/targets/7.1/facade/vfs/osvfs/go.sum +10 -0
  375. package/tools/gen_facade/committed_facades_match_their_bridges_test.go +57 -0
  376. package/tools/gen_facade/facade_manifest_points_into_the_bridge_root_test.go +75 -0
  377. package/tools/gen_facade/facade_spells_internal_types_through_bridge_aliases_test.go +75 -0
  378. package/tools/gen_facade/facade_types_are_their_bridge_types_test.go +99 -0
  379. package/tools/gen_facade/go.mod +10 -0
  380. package/tools/gen_facade/go.sum +8 -0
  381. package/tools/gen_facade/main.go +734 -0
  382. package/tools/gen_shims/go.mod +4 -4
  383. package/tools/gen_shims/go.sum +6 -6
  384. package/tools/gen_shims/main.go +124 -66
  385. package/tools/gen_shims/mirror_structs_terminate_on_unexported_cycles_test.go +101 -0
  386. package/tools/shim_audit/baseline-7.1.json +720 -0
  387. package/tools/shim_audit/baseline.json +5 -4
  388. package/tools/shim_audit/go.mod +4 -4
  389. package/tools/shim_audit/go.sum +6 -6
  390. package/tools/shim_audit/linkname_signatures.go +178 -0
  391. package/tools/shim_audit/linkname_signatures_match_their_targets_test.go +64 -0
  392. package/tools/shim_audit/linkname_targets_follow_the_audited_compiler_test.go +38 -0
  393. package/tools/shim_audit/main.go +29 -4
  394. package/tools/shim_audit/neutral_api.go +160 -0
  395. package/tools/shim_audit/neutral_api_must_match_across_targets_test.go +74 -0
  396. package/utility/host.go +5 -4
  397. package/utility/preamble_output.go +15 -15
  398. package/utility/serve.go +1 -1
@@ -0,0 +1,411 @@
1
+ // Lint diagnostic helpers.
2
+ //
3
+ // Plugins that participate in `ttsc check` / `ttsc build` (e.g. `@ttsc/lint`)
4
+ // need to emit findings that ride the same color/context renderer as tsgo's
5
+ // own typecheck diagnostics. The plumbing has to live next to the existing
6
+ // shim so the renderer keeps its single owner of `internal/diagnosticwriter`
7
+ // and `internal/diagnostics`.
8
+ //
9
+ // Consumers construct a `LintDiagnostic` from `(file, pos, end, code,
10
+ // category, message)` and pass it to `FormatMixedDiagnostics` together with
11
+ // any raw tsgo diagnostics. The renderer treats both the same way.
12
+ package diagnosticwriter
13
+
14
+ import (
15
+ "cmp"
16
+ "io"
17
+ "slices"
18
+ "strings"
19
+
20
+ "github.com/microsoft/TypeScript/tsc/internal/ast"
21
+ "github.com/microsoft/TypeScript/tsc/internal/diagnostics"
22
+ inner "github.com/microsoft/TypeScript/tsc/internal/diagnosticwriter"
23
+ "github.com/microsoft/TypeScript/tsc/internal/locale"
24
+ "github.com/microsoft/TypeScript/tsc/internal/tspath"
25
+ )
26
+
27
+ // LintCategory selects warning vs error rendering. Warnings render yellow,
28
+ // errors render red; the exit-code decision lives in the caller.
29
+ // Any value other than LintCategoryError maps to warning.
30
+ //
31
+ // @evidence contracts/common.md#principled-implementation Separate category constants preserve error versus warning; Category and IsError share the exact error discriminator, so display and error counting agree even for other integer values.
32
+ // @evidence contracts/common.md#clear-and-simple-design One category value drives both rendering and caller error classification without coupling the diagnostic to a process exit.
33
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Category constants express the renderer contract, not severity guesses based on message text or a rule's consumer.
34
+ // @evidence contracts/common.md#meaningful-documentation Native prose identifies display categories, caller-owned exit decisions and the non-error fallback.
35
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
36
+ // @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
37
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
38
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
39
+ type LintCategory int
40
+
41
+ const (
42
+ LintCategoryWarning LintCategory = iota
43
+ LintCategoryError
44
+ )
45
+
46
+ // NormalizeLintRange returns a renderer-safe half-open source span. Diagnostic
47
+ // producers are a plugin trust boundary, so offsets are clamped even when the
48
+ // caller's contract says they point inside the current file. Reversed and
49
+ // zero-width ranges select one byte when one exists at pos; EOF and empty-file
50
+ // ranges remain zero-width instead of manufacturing a byte past the source.
51
+ //
52
+ // @evidence contracts/common.md#principled-implementation Clamping both byte endpoints into [0, source length] and extending a nonpositive span only before EOF establishes 0 <= pos <= end <= length; nil source yields an empty project-wide span.
53
+ // @evidence contracts/common.md#clear-and-simple-design One boundary normalizer owns producer-range sanitation for every NewLintDiagnostic instead of requiring each renderer method to repair offsets.
54
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Clamping addresses untrusted producer coordinates against the actual source length; it does not substitute canned diagnostic ranges or hide an out-of-file byte.
55
+ // @evidence contracts/common.md#meaningful-documentation Native prose states half-open units, why sanitation belongs at the producer boundary, and the reversed/EOF/empty-file effects.
56
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources NormalizeLintRange acquires no handle, buffer or cache and retains nothing after it returns.
57
+ // @evidence contracts/performance.md#efficient-algorithms Reading the existing source text length and clamping two scalar endpoints takes constant work and space independent of source bytes; selecting one byte before EOF avoids scanning text or allocating a replacement span.
58
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work This scalar sanitizer owns no cross-request producer, cache or in-flight coordinator; construction stores its result so renderer accessors do not repeat sanitation for the same diagnostic.
59
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation NormalizeLintRange computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
60
+ func NormalizeLintRange(file *ast.SourceFile, pos, end int) (int, int) {
61
+ if file == nil {
62
+ return 0, 0
63
+ }
64
+ sourceLen := len(file.Text())
65
+ if pos < 0 {
66
+ pos = 0
67
+ } else if pos > sourceLen {
68
+ pos = sourceLen
69
+ }
70
+ if end < 0 {
71
+ end = 0
72
+ } else if end > sourceLen {
73
+ end = sourceLen
74
+ }
75
+ if end <= pos {
76
+ end = pos
77
+ if pos < sourceLen {
78
+ end++
79
+ }
80
+ }
81
+ return pos, end
82
+ }
83
+
84
+ // LintDiagnostic is a public, plugin-emittable diagnostic shaped like the
85
+ // `internal/diagnosticwriter.Diagnostic` interface. The upstream interface lives
86
+ // in an internal package that outside plugin modules cannot import directly.
87
+ // This public implementation lets their findings share the compiler renderer.
88
+ //
89
+ // The source file is retained, not copied; its text must remain the version the
90
+ // diagnostic range describes. Stored-field accessors require a nonnil
91
+ // receiver; File, Message and the empty-metadata accessors are nil-safe.
92
+ //
93
+ // @evidence contracts/common.md#principled-implementation Private source, normalized byte endpoints, severity and message implement the upstream Diagnostic methods without losing project-wide nil source or already-localized lint prose.
94
+ // @evidence contracts/common.md#clear-and-simple-design One immutable-by-public-API value implements the renderer boundary, with construction owning range validation and accessors supplying stored facts.
95
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Lint findings enter the same formatter through an explicit interface implementation rather than modifying upstream diagnostics or injecting global output.
96
+ // @evidence contracts/common.md#meaningful-documentation Separate native paragraphs explain the internal-package import boundary, retained source version and nil-receiver limits; public accessors document units and optional metadata.
97
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
98
+ // @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
99
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
100
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
101
+ type LintDiagnostic struct {
102
+ file *ast.SourceFile
103
+ pos int
104
+ end int
105
+ code int32
106
+ category LintCategory
107
+ message string
108
+ }
109
+
110
+ // NewLintDiagnostic builds a lint diagnostic anchored at [pos, end) in the
111
+ // supplied source file. `code` shows up in the rendered banner; the
112
+ // convention is to give each rule its own stable integer.
113
+ // A nil file creates a project-wide message with an empty range.
114
+ // The returned value borrows the source file and message backing storage;
115
+ // it does not validate code uniqueness, category membership or localization.
116
+ //
117
+ // @evidence contracts/common.md#principled-implementation Construction normalizes the caller's byte span before storing the supplied source identity, code, category and message; nil source retains project-wide absence, while code stability and final prose remain producer responsibilities.
118
+ // @evidence contracts/common.md#clear-and-simple-design One constructor establishes the range invariant for the private fields; renderer accessors need no repeated sanitation.
119
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The value contains actual producer findings; stable codes identify rules rather than synthesizing expected compiler messages.
120
+ // @evidence contracts/common.md#meaningful-documentation Native prose states half-open anchoring, code identity convention and nil-file meaning, with range normalization explained on its owner.
121
+ // @evidence contracts/performance.md#bound-retention-and-release-resources Each returned record retains the borrowed source graph and message backing storage until its consumers release their references; construction copies scalar coordinates and metadata, not source or message bytes, and opens no handle.
122
+ // @evidenceExclude contracts/performance.md#efficient-algorithms Range sanitation belongs to NormalizeLintRange; this constructor only transfers its normalized scalar result and supplied fields into the returned record, without an independent traversal or lookup strategy.
123
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work This constructor does not own a cache, keyed producer or request coordinator; the caller decides whether existing diagnostic records can be reused for its source version and finding.
124
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation NewLintDiagnostic computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
125
+ func NewLintDiagnostic(file *ast.SourceFile, pos, end int, code int32, category LintCategory, message string) *LintDiagnostic {
126
+ pos, end = NormalizeLintRange(file, pos, end)
127
+ return &LintDiagnostic{
128
+ file: file,
129
+ pos: pos,
130
+ end: end,
131
+ code: code,
132
+ category: category,
133
+ message: message,
134
+ }
135
+ }
136
+
137
+ // File supplies the retained source, or nil for a project-wide/nil diagnostic.
138
+ // Returning an untyped nil avoids a non-nil interface containing a nil pointer.
139
+ //
140
+ // @evidence contracts/common.md#principled-implementation The explicit nil branch preserves absent source at the interface boundary; present files retain their original compiler identity and text.
141
+ // @evidence contracts/common.md#clear-and-simple-design One accessor owns pointer-to-interface absence conversion without a wrapper file representation.
142
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Missing source remains absent rather than a fabricated file used to satisfy the renderer.
143
+ // @evidence contracts/common.md#meaningful-documentation Native prose explains retained provenance, project-wide absence and the Go typed-nil interface consequence.
144
+ // @evidence contracts/performance.md#bound-retention-and-release-resources A nonnil returned interface borrows the stored SourceFile and can keep its source/AST/semantic graph reachable under the caller's lifetime. Nil cases carry no source. The diagnostic and compiler owners retain their existing graph ownership; this accessor allocates no independent source copy or history registry and does not release that graph on return.
145
+ // @evidence contracts/performance.md#efficient-algorithms Two nil checks select true interface absence or the existing source pointer; no source-content scan, wrapper file allocation or coordinate conversion is needed.
146
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Existing source identity belongs to the diagnostic/compiler owners; this accessor coordinates no completed/in-flight source producer or source-version cache.
147
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation File computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
148
+ func (d *LintDiagnostic) File() inner.FileLike {
149
+ if d == nil || d.file == nil {
150
+ return nil
151
+ }
152
+ return d.file
153
+ }
154
+
155
+ // Pos returns the normalized inclusive UTF-8 byte offset.
156
+ //
157
+ // @evidence contracts/common.md#principled-implementation Reading the constructor-normalized start preserves the source interval used by the renderer; the receiver must be non-nil.
158
+ // @evidence contracts/common.md#clear-and-simple-design The accessor supplies one stored endpoint without reinterpreting coordinates.
159
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The offset remains producer/source data rather than a guessed JavaScript character position.
160
+ // @evidence contracts/common.md#meaningful-documentation Native prose identifies normalized origin and byte units; the type states the non-nil receiver premise.
161
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Pos acquires no handle, buffer or cache and retains nothing after it returns.
162
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This accessor projects the constructor-normalized scalar start; it chooses no independent range-validation, source traversal or coordinate-conversion algorithm.
163
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Stored endpoint state belongs to the diagnostic owner; this accessor coordinates no completed/in-flight producer or source-version cache.
164
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Pos computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
165
+ func (d *LintDiagnostic) Pos() int { return d.pos }
166
+
167
+ // End returns the normalized exclusive UTF-8 byte offset.
168
+ //
169
+ // @evidence contracts/common.md#principled-implementation Reading the constructor-normalized end retains the half-open interval and its source-length bound; the receiver must be non-nil.
170
+ // @evidence contracts/common.md#clear-and-simple-design One endpoint accessor keeps interval facts distinct from derived length.
171
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The end is not extended past EOF to invent a visible diagnostic byte.
172
+ // @evidence contracts/common.md#meaningful-documentation Native prose states normalized exclusive endpoint and byte units, with receiver requirements on the type.
173
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources End acquires no handle, buffer or cache and retains nothing after it returns.
174
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This accessor projects the endpoint already normalized by construction; it chooses no independent range-validation, coordinate-conversion or traversal algorithm.
175
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Stored endpoint state belongs to the diagnostic owner; this accessor coordinates no completed/in-flight producer or cache invalidation.
176
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation End computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
177
+ func (d *LintDiagnostic) End() int { return d.end }
178
+
179
+ // Len returns the normalized span length in UTF-8 bytes, including zero at EOF.
180
+ //
181
+ // @evidence contracts/common.md#principled-implementation End minus start is a nonnegative byte length because construction establishes ordered endpoints within the source; the receiver must be non-nil.
182
+ // @evidence contracts/common.md#clear-and-simple-design Deriving length from the two stored endpoints avoids another mutable field that could diverge from them.
183
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Zero-width spans remain real absence of covered bytes rather than a fabricated length beyond the source.
184
+ // @evidence contracts/common.md#meaningful-documentation Native prose states byte length and the EOF zero-width case before acknowledgment tags.
185
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Len acquires no handle, buffer or cache and retains nothing after it returns.
186
+ // @evidence contracts/performance.md#efficient-algorithms Subtract the two constructor-normalized scalar endpoints directly; no source scan, repeated sanitation or byte-to-character conversion is required for the stored span length.
187
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Stored range state belongs to the diagnostic owner; this scalar derived-value query coordinates no completed/in-flight producer or source-version cache.
188
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Len computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
189
+ func (d *LintDiagnostic) Len() int { return d.end - d.pos }
190
+
191
+ // Code returns the producer-supplied diagnostic identifier unchanged.
192
+ // The receiver must be nonnil; uniqueness and stability are producer policy.
193
+ //
194
+ // @evidence contracts/common.md#principled-implementation The stored int32 code passes through unchanged, retaining the rule identity used by formatter banners and consumers.
195
+ // @evidence contracts/common.md#clear-and-simple-design One accessor exposes producer identity independently from severity and message presentation.
196
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Codes are supplied by the producer rather than inferred from expected message text.
197
+ // @evidence contracts/common.md#meaningful-documentation Native prose names stable producer identity; construction explains the per-rule convention.
198
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Code acquires no handle, buffer or cache and retains nothing after it returns.
199
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This accessor projects a stored scalar chosen by the producer; it chooses no independent code lookup, validation, conversion or traversal algorithm.
200
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Stored diagnostic identity belongs to the producer; this accessor coordinates no completed/in-flight computation or cache invalidation policy.
201
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Code computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
202
+ func (d *LintDiagnostic) Code() int32 { return d.code }
203
+
204
+ // Category translates the exact error discriminator; every other value is warning.
205
+ // The receiver must be nonnil; stored category values are not validated here.
206
+ //
207
+ // @evidence contracts/common.md#principled-implementation The same LintCategoryError comparison used by IsError maps stored categories to upstream error/warning values, keeping rendering and failure counting consistent.
208
+ // @evidence contracts/common.md#clear-and-simple-design One translation boundary adapts the public lint category to the internal formatter enum.
209
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Explicit category data determines severity without message heuristics or consumer-specific reclassification.
210
+ // @evidence contracts/common.md#meaningful-documentation Native prose states the exact discriminator and fallback, rather than implying arbitrary integers form validated enum values.
211
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Category acquires no handle, buffer or cache and retains nothing after it returns.
212
+ // @evidence contracts/performance.md#efficient-algorithms One exact scalar comparison selects the upstream error category, with warning as the fallback; no message/path scan, lookup table or allocation is needed for translation.
213
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work This stored-category projection coordinates no completed/in-flight producer or cache; the diagnostic owner controls the category value and its lifetime.
214
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Category computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
215
+ func (d *LintDiagnostic) Category() diagnostics.Category {
216
+ if d.category == LintCategoryError {
217
+ return diagnostics.CategoryError
218
+ }
219
+ return diagnostics.CategoryWarning
220
+ }
221
+
222
+ // Localize returns the producer's already-localized message; locale is unused.
223
+ // The receiver must be nonnil. The producer supplies final prose; this method
224
+ // does not verify its language or perform translation.
225
+ //
226
+ // @evidence contracts/common.md#principled-implementation Returning stored prose preserves the producer's chosen message without applying another locale transformation to an already-localized value.
227
+ // @evidence contracts/common.md#clear-and-simple-design One formatter adapter supplies stored prose while message creation stays with the rule.
228
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The message is not replaced by a canned compiler diagnostic or inferred translation.
229
+ // @evidence contracts/common.md#meaningful-documentation Native prose explicitly states already-localized input and ignored locale semantics.
230
+ // @evidence contracts/performance.md#bound-retention-and-release-resources The returned string borrows the stored message backing bytes, which a caller can keep reachable after the diagnostic's own lifetime. No independent message copy, native handle or historical localization registry is acquired by this accessor; the producer and caller own those bytes and retention.
231
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This accessor projects stored text without scanning, translating or validating it; the producer owns message construction and localization algorithms.
232
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Already-produced message state belongs to the diagnostic owner; this accessor coordinates no completed/in-flight translation producer or locale-keyed cache.
233
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Localize computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
234
+ func (d *LintDiagnostic) Localize(_ locale.Locale) string { return d.message }
235
+
236
+ // Source returns the empty prefix, so lint codes render with the formatter's
237
+ // default "TS" prefix exactly as they did before upstream added the prefix.
238
+ //
239
+ // @evidence contracts/common.md#principled-implementation The upstream interface defines an empty Source as its default code prefix; returning it preserves the established rendered lint banner.
240
+ // @evidence contracts/common.md#clear-and-simple-design One constant accessor satisfies the interface without a configurable prefix nobody supplies.
241
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts No external-source marker is invented for findings that ttsc has always rendered under the default prefix.
242
+ // @evidence contracts/common.md#meaningful-documentation Native prose states the prefix meaning and the preserved rendering.
243
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Source acquires no handle, buffer or cache and retains nothing after it returns.
244
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This accessor returns a constant and chooses no processing strategy.
245
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work No computation is performed, so there is no work to share.
246
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Source computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
247
+ func (d *LintDiagnostic) Source() string { return "" }
248
+
249
+ // MessageChain returns nil because this diagnostic contains one flat message.
250
+ //
251
+ // @evidence contracts/common.md#principled-implementation Nil represents the absent chain in the upstream interface; the value stores a flat message rather than structured children.
252
+ // @evidence contracts/common.md#clear-and-simple-design The adapter states its flat-message capability without an unused child-diagnostic hierarchy.
253
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Missing structured metadata remains absent rather than manufactured chain nodes.
254
+ // @evidence contracts/common.md#meaningful-documentation Native prose explains the absence and its representation premise.
255
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources MessageChain acquires no handle, buffer or cache and retains nothing after it returns.
256
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This capability projection supplies absent structured metadata and chooses no child-graph construction, traversal or formatting algorithm.
257
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work No message-chain computation or completed/in-flight producer is coordinated here; structured metadata is absent in this diagnostic representation.
258
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation MessageChain computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
259
+ func (d *LintDiagnostic) MessageChain() []inner.Diagnostic { return nil }
260
+
261
+ // RelatedInformation returns nil; this value carries no auxiliary diagnostics.
262
+ //
263
+ // @evidence contracts/common.md#principled-implementation Nil preserves the absence of related diagnostics under the upstream formatter interface.
264
+ // @evidence contracts/common.md#clear-and-simple-design A focused flat diagnostic does not acquire an unused related-information store.
265
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Auxiliary source sites are not fabricated from message spelling.
266
+ // @evidence contracts/common.md#meaningful-documentation Native prose states the unsupported auxiliary metadata capability directly.
267
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources RelatedInformation acquires no handle, buffer or cache and retains nothing after it returns.
268
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This capability projection supplies absent auxiliary metadata and chooses no related-site construction, source lookup or diagnostic-graph traversal algorithm.
269
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work No auxiliary-diagnostic computation or completed/in-flight producer is coordinated here; related information is absent in this flat representation.
270
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation RelatedInformation computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
271
+ func (d *LintDiagnostic) RelatedInformation() []inner.Diagnostic { return nil }
272
+
273
+ // Message returns the already-localized lint message.
274
+ // It returns an empty string for a nil receiver.
275
+ //
276
+ // @evidence contracts/common.md#principled-implementation The accessor preserves producer prose on present diagnostics and supplies the documented empty absence value for a nil receiver.
277
+ // @evidence contracts/common.md#clear-and-simple-design The public string accessor is separate from the locale-shaped formatter method, while both use the same stored message.
278
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Nil does not cause a fabricated finding or a guessed diagnostic message.
279
+ // @evidence contracts/common.md#meaningful-documentation Native prose names already-localized content and the nil-receiver result.
280
+ // @evidence contracts/performance.md#bound-retention-and-release-resources A present receiver returns borrowed message backing bytes that callers may retain after return; the nil branch returns the empty string. The accessor creates no independent text copy, native handle or historical message registry, and producer/caller owners determine the stored text's lifetime.
281
+ // @evidence contracts/performance.md#efficient-algorithms One receiver nil check chooses empty absence or a stored string projection; no message scan, formatting, localization or copy is required here.
282
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Stored producer text belongs to the diagnostic owner; this accessor coordinates no completed/in-flight message computation or localization cache.
283
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation Message computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
284
+ func (d *LintDiagnostic) Message() string {
285
+ if d == nil {
286
+ return ""
287
+ }
288
+ return d.message
289
+ }
290
+
291
+ // IsError reports whether the diagnostic should fail the build. Lint plugins
292
+ // use this to compute their exit code separately from the renderer.
293
+ // The receiver must be nonnil; only the exact error discriminator is true.
294
+ //
295
+ // @evidence contracts/common.md#principled-implementation The exact error-category comparison matches Category's upstream mapping, so callers count the same diagnostics that render as errors.
296
+ // @evidence contracts/common.md#clear-and-simple-design A boolean category query leaves process exit-code policy with the caller instead of embedding it in a rendered diagnostic.
297
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Stored category data determines failure classification without matching consumer or message names.
298
+ // @evidence contracts/common.md#meaningful-documentation Native prose explains caller-owned exit decisions and the separation from rendering.
299
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources IsError acquires no handle, buffer or cache and retains nothing after it returns.
300
+ // @evidence contracts/performance.md#efficient-algorithms One exact stored-category comparison supplies the scalar classification without scanning message/path text or allocating state; caller build policy is not recomputed here.
301
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Diagnostic category state belongs to its producer; this predicate coordinates no completed/in-flight work or cross-version result cache.
302
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation IsError computes from its arguments only; it opens no file, builds no path and calls no platform or process API.
303
+ func (d *LintDiagnostic) IsError() bool { return d.category == LintCategoryError }
304
+
305
+ // FormatMixedDiagnostics renders raw tsgo diagnostics and lint diagnostics
306
+ // together with TypeScript-style colors and source context, followed by the
307
+ // `Found N errors` summary. Returns the count of error-level diagnostics so
308
+ // callers can decide on an exit code.
309
+ // Nil entries from either producer are ignored. Source files must remain the
310
+ // versions described by their diagnostic byte ranges throughout rendering.
311
+ // The writer and nonnil diagnostic graphs must satisfy upstream formatting
312
+ // premises. Individual write errors are not returned; the count classifies
313
+ // findings and is not a successful-output-delivery receipt.
314
+ //
315
+ // @evidence contracts/common.md#principled-implementation Upstream AST adapters and the lint interface implementation share one renderer; exact category comparisons count errors, and deterministic source/range/code/message ordering preserves both producers' complete findings.
316
+ // @evidence contracts/common.md#clear-and-simple-design One mixed rendering entry owns filtering, ordering and summary composition, with a private comparator centralizing tie-breaking and upstream owning snippet formatting.
317
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Real findings flow through a caller-supplied writer rather than a swapped global stream; nil filtering does not drop present findings or manufacture successful diagnostics.
318
+ // @evidence contracts/common.md#meaningful-documentation Native prose explains mixed source context, returned error count, nil-entry handling and retained source-version requirements before these tags.
319
+ // @evidence contracts/performance.md#bound-retention-and-release-resources The combined array, AST adapters, comparator-created message/related arrays and formatter/summary state are invocation-local and borrow diagnostic/source graphs. Writer buffers and source-owner caches can survive under their owners after return; this renderer does not close the writer, keep a historical batch registry or impose fixed byte/population limits. Unreferenced local state is eligible for collection rather than explicitly reclaimed at the last write.
320
+ // @evidence contracts/performance.md#efficient-algorithms Collect and count nonnil diagnostics, then sort by source/range/code/category and localized/nested content before rendering and summary construction. Sorting adds comparison-dependent work over path/message bytes and recursive diagnostic graphs; upstream snippets, location conversion, summary grouping/sort and writer operations add further work. A single formatting call does not remove those scans or make the total linear in diagnostic count.
321
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work This renderer coordinates no completed/in-flight formatted-batch cache. The combined array is rebuilt per invocation; upstream/source owners manage reusable localization or position state, while output reuse for an equivalent diagnostic/context snapshot belongs to callers.
322
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation This renderer sorts diagnostic data and delegates display-path formatting using supplied cwd; it does not establish native file identity or select an executable/filesystem capability. The supplied writer's native destination and lifetime belong to its caller, and display spelling is not certified as a case-policy answer.
323
+ func FormatMixedDiagnostics(
324
+ output io.Writer,
325
+ astDiags []*ast.Diagnostic,
326
+ lintDiags []*LintDiagnostic,
327
+ currentDirectory string,
328
+ ) int {
329
+ if len(astDiags) == 0 && len(lintDiags) == 0 {
330
+ return 0
331
+ }
332
+ all := make([]inner.Diagnostic, 0, len(astDiags)+len(lintDiags))
333
+ errors := 0
334
+ for _, d := range astDiags {
335
+ if d == nil {
336
+ continue
337
+ }
338
+ all = append(all, inner.WrapASTDiagnostic(d))
339
+ if d.Category() == diagnostics.CategoryError {
340
+ errors++
341
+ }
342
+ }
343
+ for _, d := range lintDiags {
344
+ if d == nil {
345
+ continue
346
+ }
347
+ all = append(all, d)
348
+ if d.IsError() {
349
+ errors++
350
+ }
351
+ }
352
+ if len(all) == 0 {
353
+ return 0
354
+ }
355
+ options := &inner.FormattingOptions{
356
+ Locale: locale.Default,
357
+ CaseSensitivity: tspath.CaseSensitive,
358
+ CurrentDirectory: displayDirectory(currentDirectory),
359
+ NewLine: "\n",
360
+ }
361
+ slices.SortFunc(all, compareMixedDiagnostics)
362
+ inner.FormatDiagnosticsWithColorAndContext(output, all, options)
363
+ inner.WriteErrorSummaryText(output, all, options)
364
+ return errors
365
+ }
366
+
367
+ // compareMixedDiagnostics imposes one deterministic source order on tsgo and
368
+ // lint diagnostics before the upstream renderer consumes them. The renderer
369
+ // intentionally writes its input order, while the two producers have separate
370
+ // collection paths; ordering here keeps neither producer's traversal visible
371
+ // in CLI output.
372
+ func compareMixedDiagnostics(a, b inner.Diagnostic) int {
373
+ if c := strings.Compare(mixedDiagnosticFileName(a), mixedDiagnosticFileName(b)); c != 0 {
374
+ return c
375
+ }
376
+ if c := cmp.Compare(a.Pos(), b.Pos()); c != 0 {
377
+ return c
378
+ }
379
+ if c := cmp.Compare(a.End(), b.End()); c != 0 {
380
+ return c
381
+ }
382
+ if c := cmp.Compare(a.Code(), b.Code()); c != 0 {
383
+ return c
384
+ }
385
+ if c := cmp.Compare(a.Category(), b.Category()); c != 0 {
386
+ return c
387
+ }
388
+ if c := strings.Compare(a.Localize(locale.Default), b.Localize(locale.Default)); c != 0 {
389
+ return c
390
+ }
391
+ if c := compareMixedDiagnosticLists(a.MessageChain(), b.MessageChain()); c != 0 {
392
+ return c
393
+ }
394
+ return compareMixedDiagnosticLists(a.RelatedInformation(), b.RelatedInformation())
395
+ }
396
+
397
+ func mixedDiagnosticFileName(d inner.Diagnostic) string {
398
+ if file := d.File(); file != nil {
399
+ return file.FileName().AsString()
400
+ }
401
+ return ""
402
+ }
403
+
404
+ func compareMixedDiagnosticLists(a, b []inner.Diagnostic) int {
405
+ for i := 0; i < len(a) && i < len(b); i++ {
406
+ if c := compareMixedDiagnostics(a[i], b[i]); c != 0 {
407
+ return c
408
+ }
409
+ }
410
+ return cmp.Compare(len(a), len(b))
411
+ }
@@ -0,0 +1,56 @@
1
+ // Package diagnosticwriter re-exports the subset of typescript-go's
2
+ // internal/diagnosticwriter surface that the ttsc driver uses. It provides
3
+ // FormatASTDiagnosticsWithColorAndContext for rendering pure tsgo diagnostics
4
+ // and delegates the mixed lint+tsgo rendering path to the adjacent lint.go.
5
+ package diagnosticwriter
6
+
7
+ import (
8
+ "io"
9
+
10
+ "github.com/microsoft/TypeScript/tsc/internal/ast"
11
+ inner "github.com/microsoft/TypeScript/tsc/internal/diagnosticwriter"
12
+ "github.com/microsoft/TypeScript/tsc/internal/locale"
13
+ "github.com/microsoft/TypeScript/tsc/internal/tspath"
14
+ )
15
+
16
+ // FormatASTDiagnosticsWithColorAndContext writes TypeScript-style pretty
17
+ // diagnostics using the same internal formatter as typescript-go.
18
+ // diagnostics must contain non-nil compiler diagnostics; output and source
19
+ // files retain their caller-owned lifetimes.
20
+ // The writer must be usable, and locations/message chains must satisfy the
21
+ // formatter's compiler-data premises. Upstream ignores individual write errors;
22
+ // this void operation neither reports successful delivery nor closes the writer.
23
+ //
24
+ // @evidence contracts/common.md#principled-implementation Upstream AST adapters implement the formatter's Diagnostic interface, and the same rendering/summary operations receive them with the caller's current directory and default locale.
25
+ // @evidence contracts/common.md#clear-and-simple-design One pure-AST rendering entry composes adaptation, contextual formatting and summary emission; mixed lint rendering stays in its separate adjacent entry.
26
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The supplied output writer receives real compiler messages; no global stream replacement or source-pattern diagnostic approximation is involved.
27
+ // @evidence contracts/common.md#meaningful-documentation Native prose identifies upstream formatting, non-nil input requirements and caller-owned writer/source lifetime before these tags.
28
+ // @evidence contracts/performance.md#bound-retention-and-release-resources Adapted diagnostic and related/message-chain arrays, snippet strings and summary grouping/sorting state are invocation-local, borrowing caller diagnostic/source graphs. Supplied writer storage and any source-position caches remain with their owners; output can remain retained by that writer after return. This adapter neither closes it nor imposes a fixed byte/population cap, and local state becoming unreachable does not promise immediate reclamation.
29
+ // @evidence contracts/performance.md#efficient-algorithms Adapt the input once, render diagnostics in supplied order, then build the error summary. Actual work includes nested messages/related data, path text, source-position lookup and snippet bytes, plus a second diagnostic scan and filename grouping/sort for the summary. Writer operations contribute their own cost; one formatter call does not make the whole operation a single linear pass over diagnostic count.
30
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work This call-local renderer coordinates no completed/in-flight formatted-result cache. Upstream and source owners manage reusable message/localization or source-position state, while the caller owns whether emitted output can be reused for equivalent diagnostics and context.
31
+ // @evidence contracts/portability.md#os-neutral-implementation The path comparison options carry the supplied current directory and a fixed case-sensitive policy because the writer only renders display paths and compares no filesystem identities.
32
+ func FormatASTDiagnosticsWithColorAndContext(output io.Writer, diagnostics []*ast.Diagnostic, currentDirectory string) {
33
+ if len(diagnostics) == 0 {
34
+ return
35
+ }
36
+ formatted := inner.FromASTDiagnostics(diagnostics)
37
+ options := &inner.FormattingOptions{
38
+ Locale: locale.Default,
39
+ CaseSensitivity: tspath.CaseSensitive,
40
+ CurrentDirectory: displayDirectory(currentDirectory),
41
+ NewLine: "\n",
42
+ }
43
+ inner.FormatDiagnosticsWithColorAndContext(output, formatted, options)
44
+ inner.WriteErrorSummaryText(output, formatted, options)
45
+ }
46
+
47
+ // displayDirectory is the rooted base the formatter renders file names
48
+ // relative to. An absent or relative currentDirectory has no rooted spelling,
49
+ // so it yields the empty base and the formatter prints absolute file names.
50
+ func displayDirectory(currentDirectory string) tspath.RootedDirectoryPath {
51
+ path, ok := tspath.TryRootedPathFromAbsolute(currentDirectory)
52
+ if !ok {
53
+ return ""
54
+ }
55
+ return tspath.RootedDirectoryPathFromPath(path)
56
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "ExtraMethods": {},
3
+ "ExtraFields": {}
4
+ }
@@ -0,0 +1,16 @@
1
+ module github.com/microsoft/TypeScript/tsc/shim/lsp
2
+
3
+ go 1.27
4
+
5
+ require github.com/microsoft/TypeScript/tsc v0.0.0-20261019224239-28534d760906
6
+
7
+ require (
8
+ github.com/Microsoft/go-winio v0.6.2 // indirect
9
+ github.com/klauspost/compress v1.20.0 // indirect
10
+ github.com/klauspost/cpuid/v2 v2.2.10 // indirect
11
+ github.com/mackerelio/go-osstat v0.2.8 // indirect
12
+ github.com/zeebo/xxh3 v1.1.0 // indirect
13
+ golang.org/x/sync v0.23.0 // indirect
14
+ golang.org/x/sys v0.48.0 // indirect
15
+ golang.org/x/text v0.42.0 // indirect
16
+ )
@@ -0,0 +1,26 @@
1
+ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
2
+ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
3
+ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
4
+ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
5
+ github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA=
6
+ github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
7
+ github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
8
+ github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
9
+ github.com/mackerelio/go-osstat v0.2.8 h1:I2duicTaCGWoM53XwAwA9OIe1inu0xnVs8/pqOWWVr4=
10
+ github.com/mackerelio/go-osstat v0.2.8/go.mod h1:SyS3XxKdoSKJnTGTkN5Yrh6VUQVuAURACfE6y+2DN4k=
11
+ github.com/microsoft/TypeScript/tsc v0.0.0-20261019224239-28534d760906 h1:Wn+Kp4ORyay6jJwvOng7G8pTD6HOP+Fwx8si66Wq7Bk=
12
+ github.com/microsoft/TypeScript/tsc v0.0.0-20261019224239-28534d760906/go.mod h1:28hWKaTYwRARPm0T9Y0XvdvYpU2HtjONzsMqAdYLucY=
13
+ github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
14
+ github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
15
+ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
16
+ github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
17
+ github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
18
+ github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
19
+ golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
20
+ golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
21
+ golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
22
+ golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
23
+ golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
24
+ golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
25
+ gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
26
+ gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=