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,571 @@
1
+ // gen_shims:hand-maintained
2
+
3
+ package compiler
4
+
5
+ import (
6
+ "time"
7
+
8
+ "github.com/microsoft/TypeScript/tsc/internal/ast"
9
+ "github.com/microsoft/TypeScript/tsc/internal/collections"
10
+ "github.com/microsoft/TypeScript/tsc/internal/core"
11
+ "github.com/microsoft/TypeScript/tsc/internal/module"
12
+ "github.com/microsoft/TypeScript/tsc/internal/symlinks"
13
+ "github.com/microsoft/TypeScript/tsc/internal/tsoptions"
14
+ "github.com/microsoft/TypeScript/tsc/internal/tspath"
15
+ "github.com/microsoft/TypeScript/tsc/internal/vfs"
16
+ "github.com/microsoft/TypeScript/tsc/internal/vfs/cachedvfs"
17
+ )
18
+
19
+ // ProgramResolutionKind distinguishes module and type-reference resolution.
20
+ //
21
+ // @evidence contracts/common.md#principled-implementation The two discriminants select the compiler's distinct module-name and type-directive algorithms, retaining their different result semantics.
22
+ // @evidence contracts/common.md#clear-and-simple-design One small enum selects the replay operation without encoding the distinction in task names or separate task containers.
23
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The constants identify actual resolver operations rather than expected results or consumer-specific behavior.
24
+ // @evidence contracts/common.md#meaningful-documentation Native prose identifies both resolution categories before the acknowledgment block.
25
+ // @evidenceExclude contracts/portability.md#os-neutral-implementation The enum selects a semantic operation and carries no native path or platform capability.
26
+ // @evidenceExclude contracts/performance.md#efficient-algorithms The discriminant representation does not own resolution processing.
27
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work The enum does not coordinate shared computation.
28
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The enum owns no retained state or running resource.
29
+ type ProgramResolutionKind uint8
30
+
31
+ const (
32
+ ProgramResolutionKindModule ProgramResolutionKind = iota
33
+ ProgramResolutionKindTypeReference
34
+ )
35
+
36
+ // ProgramResolutionTask is one resolution already performed by a resident
37
+ // Program. Exported fields let a host explicitly sort and group tasks; the
38
+ // record itself imposes no order. The
39
+ // unexported fields retain the exact compiler context needed for replay.
40
+ // Keep tasks with their originating Program options and project-reference
41
+ // metadata unchanged; ReplayProgramResolutions accepts one coherent source's
42
+ // task group, not arbitrary tasks from different programs.
43
+ //
44
+ // @evidence contracts/common.md#principled-implementation The record retains name, resolution mode, lexical containing path, expected target and originating options/project redirects, preserving the inputs needed to compare compiler resolution rather than only resolved filenames.
45
+ // @evidence contracts/common.md#clear-and-simple-design Public ordering/provenance fields are distinct from private replay context, allowing hosts to group tasks without manufacturing the compiler state used for semantic replay.
46
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Expected results preserve actual package and symlink identities; task construction does not synthesize answers for consumer names.
47
+ // @evidence contracts/common.md#meaningful-documentation Native paragraphs state resident-program provenance and coherent-group ownership; documented public fields have blank source lines between them.
48
+ // @evidence contracts/portability.md#os-neutral-implementation Lexical containing and resolved filenames remain distinct from loaded source/target filenames and canonical cache keys, preserving casing and project-reference spelling needed by native resolution.
49
+ // @evidenceExclude contracts/performance.md#efficient-algorithms This task record represents work selected by its producer, not the resolution algorithm owner.
50
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work The task type does not independently validate or coordinate reuse.
51
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Retention of task arrays and referenced Program metadata belongs to producer and caller operations, not independently to the record declaration.
52
+ type ProgramResolutionTask struct {
53
+ // ContainingFile is recovered source/config context when available, otherwise
54
+ // the resident canonical cache-key spelling used for replay.
55
+ ContainingFile tspath.RootedFilePath
56
+
57
+ // Kind selects module or type-reference resolution.
58
+ Kind ProgramResolutionKind
59
+
60
+ // Mode carries the compiler's import-versus-require resolution mode.
61
+ Mode core.ResolutionMode
62
+
63
+ // Name is the original module or type-directive specifier.
64
+ Name string
65
+
66
+ // ResolvedFile is the resident resolver's target spelling, or empty if unresolved.
67
+ ResolvedFile tspath.RootedFilePath
68
+
69
+ // SourceFile names the loaded containing source, or is empty when none was
70
+ // found, including automatic directives.
71
+ SourceFile tspath.RootedFilePath
72
+
73
+ // TargetFile names the loaded target after project-reference substitution, if available.
74
+ TargetFile tspath.RootedFilePath
75
+
76
+ // Universal marks automatic directives whose containing context is synthetic.
77
+ Universal bool
78
+
79
+ compilerOptions *core.CompilerOptions
80
+ currentDirectory tspath.RootedDirectoryPath
81
+ extraExtensions []string
82
+ expected programResolutionResult
83
+ projectReferences *projectReferenceResolutionContext
84
+ redirectedReference module.ResolvedProjectReference
85
+ }
86
+
87
+ // ProgramResolutionTasks returns every cached module and type-reference
88
+ // resolution, including unresolved entries and automatic type directives.
89
+ // A nil Program returns nil. Returned tasks retain Program option and redirect
90
+ // pointers; the caller owns their storage and must preserve that context.
91
+ // Enumeration order follows compiler maps and is not sorted. TargetFile is
92
+ // populated only when the target resolves to a loaded source. Extraction may
93
+ // initialize referenced configs' input/output maps and query a native realpath
94
+ // for a preserved symlink redirect; it does not replay module resolution.
95
+ //
96
+ // @evidence contracts/common.md#principled-implementation Enumerating the resident compiler's module and type-directive caches retains both successes and failures; containing paths recover loaded-source or semantic-config spelling, and expected results include package, target and link identity.
97
+ // @evidence contracts/common.md#clear-and-simple-design One append closure shares task construction across both compiler cache traversals, while private helpers own source-redirect and project-reference context reconstruction.
98
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts The inferred-types filename is the compiler's automatic-directive context, and recovering its lexical directory addresses actual case-canonical cache keys without relaxing result comparison.
99
+ // @evidence contracts/common.md#meaningful-documentation Native prose states cache coverage, nil behavior and retained Program-pointer lifetime; task fields document the lexical-versus-loaded path distinctions.
100
+ // @evidence contracts/portability.md#os-neutral-implementation Compiler canonical cache keys are not replayed as lexical filenames: source/config context restores spelling, and redirects use actual filesystem Realpath plus Program case policy rather than OS guesses.
101
+ // @evidence contracts/performance.md#efficient-algorithms Two cache traversals append one task per resolution and share one reference-context snapshot. Additional work includes reference-graph traversal, source/output map scans and first-use output-path construction, path hashing/canonicalization and selected native Realpath queries for symlink context. Map/string backing and referenced config/source population matter beyond just the returned task count; extraction does not independently replay imports.
102
+ // @evidence contracts/performance.md#reuse-equivalent-work Cached resident resolutions and one shared project-reference context are reused across tasks from the same Program, preserving their option and redirect identity rather than sharing across changed programs.
103
+ // @evidence contracts/performance.md#bound-retention-and-release-resources The returned task slice retains option, expected-result strings and redirect metadata, plus a shared context's directory set and output-to-reference map when present. These pointers can keep parsed project/config/source graphs reachable beyond the shallow map size. First-use input/output maps remain owned by referenced configs; invocation-local traversal/snapshot containers add no independent historical registry or running task, and callers bound how long they retain the result.
104
+ func ProgramResolutionTasks(program *Program) []ProgramResolutionTask {
105
+ if program == nil {
106
+ return nil
107
+ }
108
+ projectReferences := newProjectReferenceResolutionContext(program)
109
+ tasks := []ProgramResolutionTask{}
110
+ appendTask := func(kind ProgramResolutionKind, name string, mode core.ResolutionMode, filePath tspath.PathKey, expected programResolutionResult, target *module.ResolvedModule) {
111
+ // A cache key is canonical rooted text (lowercased on case-insensitive
112
+ // filesystems); it stands in for the lexical name only when no loaded
113
+ // source or configuration context recovers that spelling.
114
+ containingFile, _ := tspath.TryRootedFilePathFromNormalized(filePath.AsString())
115
+ sourceFile := tspath.RootedFilePath("")
116
+ targetFile := tspath.RootedFilePath("")
117
+ var redirectedReference module.ResolvedProjectReference
118
+ if source := program.GetSourceFileByPath(filePath); source != nil {
119
+ sourceFile = source.FileName()
120
+ redirectedReference, containingFile = programResolutionContext(program, source)
121
+ } else if kind == ProgramResolutionKindTypeReference && filePath.BaseName() == module.InferredTypesContainingFile {
122
+ // filePath is a cache key, lowercased on case-insensitive filesystems,
123
+ // not the lexical filename used by the resolver. Automatic types have
124
+ // no SourceFile to recover that spelling from. Mirror upstream
125
+ // fileLoader.addAutomaticTypeDirectiveTasks: the configuration's base
126
+ // directory owns their containing file. Secondary lookup (package
127
+ // subpaths and relative types) preserves this spelling in
128
+ // resolvedFileName or a symlink's originalPath. Replaying a lowercased
129
+ // key would falsely reject unchanged programs. Restore the input context
130
+ // here; keep the strict result comparison below so actual target,
131
+ // package and link changes still invalidate the program.
132
+ containingFile = program.BaseDirectory().ResolveFile(module.InferredTypesContainingFile)
133
+ }
134
+ if target != nil && target.ResolvedFileName != "" {
135
+ if loaded := program.GetSourceFileForResolvedModule(target); loaded != nil {
136
+ targetFile = loaded.FileName()
137
+ }
138
+ }
139
+ tasks = append(tasks, ProgramResolutionTask{
140
+ ContainingFile: containingFile,
141
+ Kind: kind,
142
+ Mode: mode,
143
+ Name: name,
144
+ ResolvedFile: expected.resolvedFileName,
145
+ SourceFile: sourceFile,
146
+ TargetFile: targetFile,
147
+ Universal: containingFile != "" && containingFile.BaseName() == module.InferredTypesContainingFile,
148
+ compilerOptions: program.Options(),
149
+ currentDirectory: program.GetCurrentDirectory(),
150
+ extraExtensions: program.ContentMapperExtensions(),
151
+ expected: expected,
152
+ projectReferences: projectReferences,
153
+ redirectedReference: redirectedReference,
154
+ })
155
+ }
156
+ program.ForEachResolvedModule(func(resolution *module.ResolvedModule, name string, mode core.ResolutionMode, filePath tspath.PathKey) {
157
+ appendTask(ProgramResolutionKindModule, name, mode, filePath, moduleResolutionResult(resolution), resolution)
158
+ }, nil)
159
+ program.ForEachResolvedTypeReferenceDirective(func(resolution *module.ResolvedTypeReferenceDirective, name string, mode core.ResolutionMode, filePath tspath.PathKey) {
160
+ var target *module.ResolvedModule
161
+ if resolution != nil {
162
+ // GetSourceFileForResolvedModule reads only the resolved name and key,
163
+ // which a type-reference resolution carries under the same fields.
164
+ target = &module.ResolvedModule{ResolvedFileName: resolution.ResolvedFileName, ResolvedPath: resolution.ResolvedPath}
165
+ }
166
+ appendTask(ProgramResolutionKindTypeReference, name, mode, filePath, typeReferenceResolutionResult(resolution), target)
167
+ }, nil)
168
+ return tasks
169
+ }
170
+
171
+ // programResolutionContext mirrors projectReferenceFileMapper's containing
172
+ // file substitution using the public Program maps. The selected source path is
173
+ // part of resolution semantics, not merely diagnostic provenance.
174
+ func programResolutionContext(program *Program, source ast.HasFileName) (module.ResolvedProjectReference, tspath.RootedFilePath) {
175
+ if redirected := program.GetProjectReferenceFromSource(source.PathKey()); redirected != nil {
176
+ return redirected.Resolved, redirected.Source
177
+ }
178
+ if redirected := program.GetProjectReferenceFromOutputDts(source.PathKey()); redirected != nil {
179
+ return redirected.Resolved, redirected.Source
180
+ }
181
+ redirect := program.GetRedirectForResolution(source)
182
+ if redirect == nil {
183
+ return nil, source.FileName()
184
+ }
185
+ // The remaining redirect form is a preserved node_modules symlink whose
186
+ // physical declaration belongs to a project reference. Resolve the same
187
+ // physical key the compiler mapper used and retain the original source name.
188
+ realpath := tspath.RootedFilePathFromPath(program.Host().FS().Realpath(source.FileName().AsPath()))
189
+ if redirected := program.GetProjectReferenceFromOutputDts(program.PathKeyForFileName(realpath)); redirected != nil {
190
+ return redirected.Resolved, redirected.Source
191
+ }
192
+ // A concurrent retarget can make the public lookup disappear after the
193
+ // resident redirect was cached. Keep the redirect so replay necessarily
194
+ // disagrees with the resident result or its observed identity proof fails.
195
+ return redirect, source.FileName()
196
+ }
197
+
198
+ // ReplayProgramResolutions resolves one source's tasks with one fresh upstream
199
+ // resolver and reports whether every result still matches the resident Program.
200
+ // Tasks must share compiler options, current directory and project-reference
201
+ // context. An empty group, nil filesystem or missing options returns false.
202
+ // Every supported task is submitted even after a mismatch; group-local caches
203
+ // can satisfy equivalent lookups without repeating native reads. Equality is
204
+ // over the projected result fields, not a complete filesystem snapshot proof.
205
+ //
206
+ // @evidence contracts/common.md#principled-implementation A fresh upstream resolver replays each kind with its original name, mode, lexical containing file and redirect, then compares the complete projected result including unresolved, package and symlink identity; tasks require one coherent originating context.
207
+ // @evidence contracts/common.md#clear-and-simple-design One resolver and project-reference filesystem view belong to a group, while result projection centralizes equality and the loop continues submitting tasks after a mismatch instead of stopping at the first changed result.
208
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Virtual declaration existence follows actual project-reference source mappings; unsupported resolver write operations panic rather than silently fabricating effects, and full result equality is not weakened to hide changed identities.
209
+ // @evidence contracts/common.md#meaningful-documentation Native prose explains coherent-group premises, invalid-input refusal and why replay continues after a mismatch, with separate descriptive and acknowledgment sections.
210
+ // @evidence contracts/portability.md#os-neutral-implementation The supplied filesystem determines case sensitivity, existence and realpaths; the virtual declaration view uses canonical compiler paths and tracks native symlinks while preserving lexical resolver inputs.
211
+ // @evidence contracts/performance.md#efficient-algorithms Each supported task makes one resolver call and compares projected string/scalar fields, with group-local caches sharing eligible lookups. Actual resolver work includes ancestor/package probing, manifest bytes and path processing; tracing can bypass result-cache hits. Virtual declaration and known-link fallback scans can multiply directory/link population across existence queries, with native source-existence and realpath work in addition to map membership.
212
+ // @evidence contracts/performance.md#reuse-equivalent-work One fresh resolver and cached virtual filesystem share equivalent lookups within a coherent group; a new replay filesystem prevents prior observation results from hiding changed native inputs.
213
+ // @evidence contracts/performance.md#bound-retention-and-release-resources Fresh resolver and optional virtual/cached filesystem state retain entries, manifest buffers, projected results and known links for the synchronous group. This adapter keeps no historical registry or spawned task after return, making otherwise-unreferenced local state eligible for collection without promising immediate reclamation. Borrowed task/config graphs and observations retained by the supplied filesystem stay under their owners, with no fixed population or byte cap imposed here.
214
+ func ReplayProgramResolutions(tasks []ProgramResolutionTask, filesystem vfs.FS) bool {
215
+ if len(tasks) == 0 || filesystem == nil || tasks[0].compilerOptions == nil {
216
+ return false
217
+ }
218
+ first := tasks[0]
219
+ host := resolutionHost{
220
+ filesystem: first.projectReferences.filesystem(filesystem),
221
+ currentDirectory: first.currentDirectory,
222
+ }
223
+ resolver := module.NewResolver(module.ResolverOptions{
224
+ Host: host,
225
+ CompilerOptions: first.compilerOptions,
226
+ ExtraExtensions: first.extraExtensions,
227
+ })
228
+ matches := true
229
+ for _, task := range tasks {
230
+ var actual programResolutionResult
231
+ switch task.Kind {
232
+ case ProgramResolutionKindModule:
233
+ resolution, _, _ := resolver.ResolveModuleName(task.Name, task.ContainingFile, task.Mode, task.redirectedReference)
234
+ actual = moduleResolutionResult(resolution)
235
+ case ProgramResolutionKindTypeReference:
236
+ resolution, _ := resolver.ResolveTypeReferenceDirective(task.Name, task.ContainingFile, task.Mode, task.redirectedReference)
237
+ actual = typeReferenceResolutionResult(resolution)
238
+ default:
239
+ matches = false
240
+ continue
241
+ }
242
+ if actual != task.expected {
243
+ matches = false
244
+ }
245
+ }
246
+ return matches
247
+ }
248
+
249
+ // projectReferenceResolutionContext snapshots the immutable metadata needed to
250
+ // recreate fileLoader's project-reference declaration view for every replay
251
+ // filesystem. A referenced output declaration may be absent on disk while its
252
+ // source exists; the resolver must see the virtual declaration before Program
253
+ // substitutes that source into the loaded graph.
254
+ type projectReferenceResolutionContext struct {
255
+ dtsDirectories collections.Set[tspath.PathKey]
256
+ outputDtsToProjectReference map[tspath.PathKey]*tsoptions.SourceOutputAndProjectReference
257
+ }
258
+
259
+ func newProjectReferenceResolutionContext(program *Program) *projectReferenceResolutionContext {
260
+ if program == nil {
261
+ return nil
262
+ }
263
+ outputDtsToProjectReference := map[tspath.PathKey]*tsoptions.SourceOutputAndProjectReference{}
264
+ dtsDirectories := collections.Set[tspath.PathKey]{}
265
+ useSourceOfProjectReference := false
266
+ program.RangeResolvedProjectReference(func(_ tspath.PathKey, config *tsoptions.ParsedCommandLine, _ *tsoptions.ParsedCommandLine, _ int) bool {
267
+ if config == nil {
268
+ return true
269
+ }
270
+ config.ParseInputOutputNames()
271
+ for path := range config.SourceToProjectReference() {
272
+ useSourceOfProjectReference = useSourceOfProjectReference || program.IsSourceFromProjectReference(path)
273
+ }
274
+ for path, reference := range config.OutputDtsToProjectReference() {
275
+ outputDtsToProjectReference[path] = reference
276
+ }
277
+ declarationDirectory := config.CompilerOptions().DeclarationDir
278
+ if declarationDirectory == "" {
279
+ declarationDirectory = config.CompilerOptions().OutDir
280
+ }
281
+ if declarationDirectory != "" {
282
+ dtsDirectories.Add(program.CaseSensitivity().PathKey(declarationDirectory.AsPath()))
283
+ }
284
+ return true
285
+ })
286
+ if !useSourceOfProjectReference || len(outputDtsToProjectReference) == 0 {
287
+ return nil
288
+ }
289
+ return &projectReferenceResolutionContext{
290
+ dtsDirectories: dtsDirectories,
291
+ outputDtsToProjectReference: outputDtsToProjectReference,
292
+ }
293
+ }
294
+
295
+ func (context *projectReferenceResolutionContext) filesystem(filesystem vfs.FS) vfs.FS {
296
+ if context == nil || filesystem == nil {
297
+ return filesystem
298
+ }
299
+ return cachedvfs.From(&projectReferenceResolutionFS{
300
+ filesystem: filesystem,
301
+ dtsDirectories: context.dtsDirectories,
302
+ knownSymlinks: symlinks.KnownSymlinks{},
303
+ outputDtsToProjectReference: context.outputDtsToProjectReference,
304
+ })
305
+ }
306
+
307
+ // projectReferenceResolutionFS mirrors TypeScript-Go's
308
+ // projectReferenceDtsFakingVfs over the caller's observation filesystem.
309
+ type projectReferenceResolutionFS struct {
310
+ filesystem vfs.FS
311
+ dtsDirectories collections.Set[tspath.PathKey]
312
+ knownSymlinks symlinks.KnownSymlinks
313
+ outputDtsToProjectReference map[tspath.PathKey]*tsoptions.SourceOutputAndProjectReference
314
+ }
315
+
316
+ var _ vfs.FS = (*projectReferenceResolutionFS)(nil)
317
+
318
+ func (fs *projectReferenceResolutionFS) CaseSensitivity() tspath.CaseSensitivity {
319
+ return fs.filesystem.CaseSensitivity()
320
+ }
321
+
322
+ func (fs *projectReferenceResolutionFS) FileExists(path tspath.RootedFilePath) bool {
323
+ if fs.filesystem.FileExists(path) {
324
+ return true
325
+ }
326
+ if !path.IsDeclarationFile() {
327
+ return false
328
+ }
329
+ return fs.fileExistsUsingSource(path)
330
+ }
331
+
332
+ func (fs *projectReferenceResolutionFS) ReadFile(path tspath.RootedFilePath) (string, bool) {
333
+ return fs.filesystem.ReadFile(path)
334
+ }
335
+
336
+ func (fs *projectReferenceResolutionFS) WriteFile(tspath.RootedFilePath, string) error {
337
+ panic("should not be called by resolver")
338
+ }
339
+
340
+ func (fs *projectReferenceResolutionFS) AppendFile(tspath.RootedFilePath, string) error {
341
+ panic("should not be called by resolver")
342
+ }
343
+
344
+ func (fs *projectReferenceResolutionFS) Remove(tspath.RootedPath) error {
345
+ panic("should not be called by resolver")
346
+ }
347
+
348
+ func (fs *projectReferenceResolutionFS) Chtimes(tspath.RootedPath, time.Time, time.Time) error {
349
+ panic("should not be called by resolver")
350
+ }
351
+
352
+ func (fs *projectReferenceResolutionFS) DirectoryExists(path tspath.RootedDirectoryPath) bool {
353
+ if fs.filesystem.DirectoryExists(path) {
354
+ fs.handleDirectoryCouldBeSymlink(path)
355
+ return true
356
+ }
357
+ return fs.directoryExistsUsingSource(path)
358
+ }
359
+
360
+ func (fs *projectReferenceResolutionFS) GetAccessibleEntries(tspath.RootedDirectoryPath) vfs.Entries {
361
+ panic("should not be called by resolver")
362
+ }
363
+
364
+ func (fs *projectReferenceResolutionFS) Stat(tspath.RootedPath) vfs.FileInfo {
365
+ panic("should not be called by resolver")
366
+ }
367
+
368
+ func (fs *projectReferenceResolutionFS) Realpath(path tspath.RootedPath) tspath.RootedPath {
369
+ if result, ok := fs.knownSymlinks.Files().Load(fs.pathKey(path)); ok {
370
+ return result.AsPath()
371
+ }
372
+ return fs.filesystem.Realpath(path)
373
+ }
374
+
375
+ func (fs *projectReferenceResolutionFS) pathKey(path tspath.RootedPath) tspath.PathKey {
376
+ return fs.CaseSensitivity().PathKey(path)
377
+ }
378
+
379
+ func (fs *projectReferenceResolutionFS) handleDirectoryCouldBeSymlink(directory tspath.RootedDirectoryPath) {
380
+ if tspath.ContainsIgnoredDirectory(directory) || !directory.ContainsLowercaseDirectorySequence("/node_modules/") {
381
+ return
382
+ }
383
+ directoryPath := fs.pathKey(directory.AsPath())
384
+ if _, ok := fs.knownSymlinks.Directories().Load(directoryPath); ok {
385
+ return
386
+ }
387
+ realDirectory := tspath.RootedDirectoryPathFromPath(fs.Realpath(directory.AsPath()))
388
+ if realDirectory == directory {
389
+ return
390
+ }
391
+ realPath := fs.pathKey(realDirectory.AsPath())
392
+ if realPath == directoryPath {
393
+ return
394
+ }
395
+ fs.knownSymlinks.SetDirectory(directory, directoryPath, &symlinks.KnownDirectoryLink{
396
+ Real: realDirectory,
397
+ RealPath: realPath,
398
+ })
399
+ }
400
+
401
+ func (fs *projectReferenceResolutionFS) fileExistsUsingSource(file tspath.RootedFilePath) bool {
402
+ filePath := fs.pathKey(file.AsPath())
403
+ return fs.fileOrDirectoryExistsUsingSource(
404
+ file.AsPath(),
405
+ func(path tspath.RootedPath) core.Tristate {
406
+ return fs.fileExistsIfProjectReferenceDeclaration(tspath.RootedFilePathFromPath(path))
407
+ },
408
+ module.NodeModulePackageRootForFile(file),
409
+ func(realFile tspath.RootedFilePath) {
410
+ fs.knownSymlinks.SetFile(file, filePath, realFile)
411
+ },
412
+ )
413
+ }
414
+
415
+ func (fs *projectReferenceResolutionFS) directoryExistsUsingSource(directory tspath.RootedDirectoryPath) bool {
416
+ return fs.fileOrDirectoryExistsUsingSource(
417
+ directory.AsPath(),
418
+ func(path tspath.RootedPath) core.Tristate {
419
+ return fs.directoryExistsIfProjectReferenceDeclarationDirectory(tspath.RootedDirectoryPathFromPath(path))
420
+ },
421
+ module.NodeModulePackageRootForDirectory(directory),
422
+ nil,
423
+ )
424
+ }
425
+
426
+ func (fs *projectReferenceResolutionFS) fileOrDirectoryExistsUsingSource(
427
+ fileOrDirectory tspath.RootedPath,
428
+ existsUsingSource func(tspath.RootedPath) core.Tristate,
429
+ packageRoot tspath.RootedDirectoryPath,
430
+ onFileExists func(tspath.RootedFilePath),
431
+ ) bool {
432
+ result := existsUsingSource(fileOrDirectory)
433
+ if result != core.TSUnknown {
434
+ return result == core.TSTrue
435
+ }
436
+ fileOrDirectoryPath := fs.pathKey(fileOrDirectory)
437
+ if !fileOrDirectoryPath.ContainsLowercaseDirectorySequence("/node_modules/") {
438
+ return false
439
+ }
440
+ if packageRoot != "" {
441
+ fs.handleDirectoryCouldBeSymlink(packageRoot)
442
+ }
443
+ knownDirectoryLinks := fs.knownSymlinks.Directories()
444
+ if knownDirectoryLinks.Size() == 0 {
445
+ return false
446
+ }
447
+ if onFileExists != nil {
448
+ if _, ok := fs.knownSymlinks.Files().Load(fileOrDirectoryPath); ok {
449
+ return true
450
+ }
451
+ }
452
+ exists := false
453
+ knownDirectoryLinks.Range(func(directoryPath tspath.PathKey, knownDirectoryLink *symlinks.KnownDirectoryLink) bool {
454
+ if directoryPath == fileOrDirectoryPath || !directoryPath.ContainsPath(fileOrDirectoryPath) {
455
+ return true
456
+ }
457
+ realFileOrDirectory, ok := knownDirectoryLink.ResolveFilePath(tspath.RootedFilePathFromPath(fileOrDirectory), fs.CaseSensitivity())
458
+ if !ok {
459
+ panic("canonical symlink path did not match its presentation path")
460
+ }
461
+ if exists = existsUsingSource(realFileOrDirectory.AsPath()).IsTrue(); exists {
462
+ if onFileExists != nil {
463
+ onFileExists(realFileOrDirectory)
464
+ }
465
+ return false
466
+ }
467
+ return true
468
+ })
469
+ return exists
470
+ }
471
+
472
+ func (fs *projectReferenceResolutionFS) fileExistsIfProjectReferenceDeclaration(file tspath.RootedFilePath) core.Tristate {
473
+ reference := fs.outputDtsToProjectReference[fs.pathKey(file.AsPath())]
474
+ if reference == nil {
475
+ return core.TSUnknown
476
+ }
477
+ return core.IfElse(fs.filesystem.FileExists(reference.Source), core.TSTrue, core.TSFalse)
478
+ }
479
+
480
+ func (fs *projectReferenceResolutionFS) directoryExistsIfProjectReferenceDeclarationDirectory(directory tspath.RootedDirectoryPath) core.Tristate {
481
+ directoryPath := fs.pathKey(directory.AsPath())
482
+ for declarationDirectoryPath := range fs.dtsDirectories.Keys() {
483
+ if directoryPath.ContainsPath(declarationDirectoryPath) || declarationDirectoryPath.ContainsPath(directoryPath) {
484
+ return core.TSTrue
485
+ }
486
+ }
487
+ return core.TSUnknown
488
+ }
489
+
490
+ // ReplayAutomaticTypeDirectiveDiscovery repeats the compiler's exact wildcard
491
+ // type-root enumeration over filesystem so a host can observe its inputs.
492
+ // Nil program, filesystem or compiler options performs no discovery.
493
+ // Explicit non-wildcard types can return without filesystem enumeration.
494
+ // Wildcard discovery also reads package manifests to omit typings-null packages;
495
+ // this function discards the returned names, not filesystem observation state.
496
+ // Default wildcard roots derive from the Program's base directory, the same
497
+ // base the compiler's own file loader passes to the upstream helper.
498
+ //
499
+ // @evidence contracts/common.md#principled-implementation The compiler's automatic-type directive enumeration receives the resident options and base directory over the observation filesystem, reproducing wildcard discovery inputs rather than inferring them from only previously resolved targets.
500
+ // @evidence contracts/common.md#clear-and-simple-design The observation filesystem and base directory go directly to the owning discovery helper; enumeration results need not be retained because observation is the required effect.
501
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Replay preserves real enumeration effects through a supported host instead of injecting assumed type-package names or patching the compiler's cache.
502
+ // @evidence contracts/common.md#meaningful-documentation Native prose states wildcard discovery's observation purpose and nil-input no-op behavior, with separate tags.
503
+ // @evidence contracts/portability.md#os-neutral-implementation Discovery obtains directories and entries from the caller's filesystem and the Program's rooted base directory, without inferring type-root availability or casing from the OS.
504
+ // @evidenceExclude contracts/performance.md#efficient-algorithms Upstream owns effective-root construction, directory enumeration, package-manifest reads/parsing, wildcard substitution and name deduplication. Costs include ancestor/path text, entries, manifest bytes and selected type-name population; this direct adapter chooses no separate discovery algorithm and discards only the returned names.
505
+ // @evidence contracts/performance.md#reuse-equivalent-work Enumeration itself is the input-observation effect, so a resident list cannot replace traversal on a new filesystem observation; callers may share the resulting observation proof only when its filesystem snapshot is equivalent.
506
+ // @evidence contracts/performance.md#bound-retention-and-release-resources Upstream discovery can allocate root/name lists, package buffers and parsed manifest state during the synchronous call. The result is discarded here, while compiler options and any filesystem caches or collected observation entries remain under their existing owners. This adapter keeps no independent historical name registry or running task and imposes no bound on caller-owned observation retention.
507
+ func ReplayAutomaticTypeDirectiveDiscovery(program *Program, filesystem vfs.FS) {
508
+ if program == nil || filesystem == nil || program.Options() == nil {
509
+ return
510
+ }
511
+ module.GetAutomaticTypeDirectiveNames(program.Options(), program.BaseDirectory(), filesystem)
512
+ }
513
+
514
+ type resolutionHost struct {
515
+ filesystem vfs.FS
516
+ currentDirectory tspath.RootedDirectoryPath
517
+ }
518
+
519
+ func (host resolutionHost) FS() vfs.FS { return host.filesystem }
520
+
521
+ func (host resolutionHost) GetCurrentDirectory() tspath.RootedDirectoryPath {
522
+ return host.currentDirectory
523
+ }
524
+
525
+ type programResolutionResult struct {
526
+ alternateResult tspath.RootedFilePath
527
+ extension string
528
+ isExternalLibraryImport bool
529
+ originalPath tspath.RootedFilePath
530
+ packageName string
531
+ packagePeerDependencies string
532
+ packageSubModuleName string
533
+ packageVersion string
534
+ primary bool
535
+ resolvedFileName tspath.RootedFilePath
536
+ resolvedUsingTsExtension bool
537
+ }
538
+
539
+ func moduleResolutionResult(resolution *module.ResolvedModule) programResolutionResult {
540
+ if resolution == nil {
541
+ return programResolutionResult{}
542
+ }
543
+ return programResolutionResult{
544
+ alternateResult: resolution.AlternateResult,
545
+ extension: resolution.Extension,
546
+ isExternalLibraryImport: resolution.IsExternalLibraryImport,
547
+ originalPath: resolution.OriginalPath,
548
+ packageName: resolution.PackageId.Name,
549
+ packagePeerDependencies: resolution.PackageId.PeerDependencies,
550
+ packageSubModuleName: resolution.PackageId.SubModuleName,
551
+ packageVersion: resolution.PackageId.Version,
552
+ resolvedFileName: resolution.ResolvedFileName,
553
+ resolvedUsingTsExtension: resolution.ResolvedUsingTsExtension,
554
+ }
555
+ }
556
+
557
+ func typeReferenceResolutionResult(resolution *module.ResolvedTypeReferenceDirective) programResolutionResult {
558
+ if resolution == nil {
559
+ return programResolutionResult{}
560
+ }
561
+ return programResolutionResult{
562
+ isExternalLibraryImport: resolution.IsExternalLibraryImport,
563
+ originalPath: resolution.OriginalPath,
564
+ packageName: resolution.PackageId.Name,
565
+ packagePeerDependencies: resolution.PackageId.PeerDependencies,
566
+ packageSubModuleName: resolution.PackageId.SubModuleName,
567
+ packageVersion: resolution.PackageId.Version,
568
+ primary: resolution.Primary,
569
+ resolvedFileName: resolution.ResolvedFileName,
570
+ }
571
+ }
@@ -0,0 +1,70 @@
1
+ // Code generated by packages/ttsc/tools/gen_shims. DO NOT EDIT.
2
+
3
+ package compiler
4
+
5
+ import "context"
6
+ import "github.com/microsoft/TypeScript/tsc/internal/ast"
7
+ import "github.com/microsoft/TypeScript/tsc/internal/compiler"
8
+ import "github.com/microsoft/TypeScript/tsc/internal/contentmapper"
9
+ import "github.com/microsoft/TypeScript/tsc/internal/core"
10
+ import "github.com/microsoft/TypeScript/tsc/internal/diagnostics"
11
+ import "github.com/microsoft/TypeScript/tsc/internal/tsoptions"
12
+ import "github.com/microsoft/TypeScript/tsc/internal/tspath"
13
+ import "github.com/microsoft/TypeScript/tsc/internal/vfs"
14
+ import _ "unsafe"
15
+
16
+ type CheckerPool = compiler.CheckerPool
17
+
18
+ //go:linkname CombineEmitResults github.com/microsoft/TypeScript/tsc/internal/compiler.CombineEmitResults
19
+ func CombineEmitResults(results []*compiler.EmitResult) *compiler.EmitResult
20
+
21
+ type CompilerHost = compiler.CompilerHost
22
+ type DuplicateSourceFile = compiler.DuplicateSourceFile
23
+
24
+ const EmitAll = compiler.EmitAll
25
+
26
+ type EmitHost = compiler.EmitHost
27
+ type EmitOnly = compiler.EmitOnly
28
+
29
+ const EmitOnlyBuilderSignature = compiler.EmitOnlyBuilderSignature
30
+ const EmitOnlyDts = compiler.EmitOnlyDts
31
+ const EmitOnlyJs = compiler.EmitOnlyJs
32
+
33
+ type EmitOptions = compiler.EmitOptions
34
+ type EmitResult = compiler.EmitResult
35
+ type FileIncludeReason = compiler.FileIncludeReason
36
+
37
+ //go:linkname FilterNoEmitSemanticDiagnostics github.com/microsoft/TypeScript/tsc/internal/compiler.FilterNoEmitSemanticDiagnostics
38
+ func FilterNoEmitSemanticDiagnostics(diagnostics []*ast.Diagnostic, options *core.CompilerOptions) []*ast.Diagnostic
39
+
40
+ //go:linkname GetDiagnosticsOfAnyProgram github.com/microsoft/TypeScript/tsc/internal/compiler.GetDiagnosticsOfAnyProgram
41
+ func GetDiagnosticsOfAnyProgram(ctx context.Context, program compiler.ProgramLike, files []*ast.SourceFile, skipNoEmitCheckForDtsDiagnostics bool, getBindDiagnostics func(context.Context, *ast.SourceFile) []*ast.Diagnostic, getSemanticDiagnostics func(context.Context, *ast.SourceFile) []*ast.Diagnostic) []*ast.Diagnostic
42
+
43
+ //go:linkname HandleNoEmitOptions github.com/microsoft/TypeScript/tsc/internal/compiler.HandleNoEmitOptions
44
+ func HandleNoEmitOptions(ctx context.Context, program compiler.ProgramLike, files []*ast.SourceFile, emitBuildInfo func() *compiler.EmitResult) *compiler.EmitResult
45
+
46
+ type LibFile = compiler.LibFile
47
+
48
+ //go:linkname NewCachedFSCompilerHost github.com/microsoft/TypeScript/tsc/internal/compiler.NewCachedFSCompilerHost
49
+ func NewCachedFSCompilerHost(fs vfs.FS, defaultLibraryPath tspath.RootedDirectoryPath, extendedConfigCache tsoptions.ExtendedConfigCache, trace func(msg *diagnostics.Message, args ...any), contentMapperProject contentmapper.Project) compiler.CompilerHost
50
+
51
+ //go:linkname NewCompilerHost github.com/microsoft/TypeScript/tsc/internal/compiler.NewCompilerHost
52
+ func NewCompilerHost(fs vfs.FS, defaultLibraryPath tspath.RootedDirectoryPath, extendedConfigCache tsoptions.ExtendedConfigCache, trace func(msg *diagnostics.Message, args ...any), contentMapperProject contentmapper.Project) compiler.CompilerHost
53
+
54
+ //go:linkname NewProgram github.com/microsoft/TypeScript/tsc/internal/compiler.NewProgram
55
+ func NewProgram(opts compiler.ProgramOptions) *compiler.Program
56
+
57
+ type Program = compiler.Program
58
+ type ProgramConfig = compiler.ProgramConfig
59
+ type ProgramFactories = compiler.ProgramFactories
60
+ type ProgramHosts = compiler.ProgramHosts
61
+ type ProgramLike = compiler.ProgramLike
62
+ type ProgramOptions = compiler.ProgramOptions
63
+
64
+ //go:linkname SortAndDeduplicateDiagnostics github.com/microsoft/TypeScript/tsc/internal/compiler.SortAndDeduplicateDiagnostics
65
+ func SortAndDeduplicateDiagnostics(diagnostics []*ast.Diagnostic) []*ast.Diagnostic
66
+
67
+ type SourceFileMayBeEmittedHost = compiler.SourceFileMayBeEmittedHost
68
+ type SourceMapEmitResult = compiler.SourceMapEmitResult
69
+ type WriteFile = compiler.WriteFile
70
+ type WriteFileData = compiler.WriteFileData
@@ -0,0 +1,15 @@
1
+ // Code generated by packages/ttsc/tools/shim_audit -fix. DO NOT EDIT.
2
+ //
3
+ // Completes every exposed enum family: re-exports each member not already
4
+ // re-exported elsewhere in the shim package, so a plugin that can name the
5
+ // enum type can name all of its values. Prevents a partially re-exported
6
+ // family (a sibling const silently missing). Regenerate after a typescript-go bump with
7
+ // `pnpm --filter ttsc shim:audit -fix`.
8
+
9
+ package core
10
+
11
+ import innercore "github.com/microsoft/TypeScript/tsc/internal/core"
12
+
13
+ const (
14
+ TSUnknown = innercore.TSUnknown
15
+ )
@@ -0,0 +1,4 @@
1
+ {
2
+ "ExtraMethods": {},
3
+ "ExtraFields": {}
4
+ }