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
@@ -1213,16 +1213,16 @@ func advanceServeGraphProvenance(
1213
1213
  return graph.Provenance{}, graph.Provenance{}, false
1214
1214
  }
1215
1215
  physical := source.FileName()
1216
- index, ok := positions[physical]
1216
+ index, ok := positions[string(physical)]
1217
1217
  if !ok {
1218
1218
  return graph.Provenance{}, graph.Provenance{}, false
1219
1219
  }
1220
1220
  updated := graph.SourceDigest{
1221
- File: physical,
1221
+ File: string(physical),
1222
1222
  Checker: graph.Digest(sha256.Sum256([]byte(source.Text()))),
1223
- Disk: diskDigests[physical],
1223
+ Disk: diskDigests[string(physical)],
1224
1224
  }
1225
- wireFile, ok := wireSources[physical]
1225
+ wireFile, ok := wireSources[string(physical)]
1226
1226
  if !ok {
1227
1227
  return graph.Provenance{}, graph.Provenance{}, false
1228
1228
  }
@@ -1344,7 +1344,7 @@ func authoredGraphFiles(program *driver.Program) map[string]bool {
1344
1344
  if !graph.IsWorkspaceSourceFile(file) {
1345
1345
  continue
1346
1346
  }
1347
- authored[file.FileName()] = true
1347
+ authored[string(file.FileName())] = true
1348
1348
  }
1349
1349
  return authored
1350
1350
  }
@@ -1357,8 +1357,8 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
1357
1357
  if !graph.IsWorkspaceSourceFile(file) {
1358
1358
  continue
1359
1359
  }
1360
- authored[file.FileName()] = true
1361
- authoredByPath[string(file.Path())] = file.FileName()
1360
+ authored[string(file.FileName())] = true
1361
+ authoredByPath[string(shimast.SourceFilePathKey(file))] = string(file.FileName())
1362
1362
  }
1363
1363
  add := func(target, dependent string) {
1364
1364
  if !authored[target] || target == dependent {
@@ -1376,8 +1376,8 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
1376
1376
  continue
1377
1377
  }
1378
1378
  for _, referencedPath := range shimcompiler.GetReferencedFilePaths(program.TSProgram, source) {
1379
- if target, ok := authoredByPath[referencedPath]; ok {
1380
- add(target, source.FileName())
1379
+ if target, ok := authoredByPath[string(referencedPath)]; ok {
1380
+ add(target, string(source.FileName()))
1381
1381
  }
1382
1382
  }
1383
1383
  }
@@ -1393,25 +1393,36 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
1393
1393
  return reverse
1394
1394
  }
1395
1395
 
1396
+ // serveGraphResolutionDigests digests each source's resolved references.
1397
+ // Projecting a target resolves its symlinks on disk, and a widely imported
1398
+ // file is the target of many references, so each target is projected once per
1399
+ // call rather than once per import.
1396
1400
  func serveGraphResolutionDigests(program *driver.Program, project string) (map[string]string, error) {
1397
1401
  digests := map[string]string{}
1402
+ projected := map[string]string{}
1398
1403
  for _, source := range program.TSProgram.SourceFiles() {
1399
1404
  raw := shimcompiler.GetReferencedFilePaths(program.TSProgram, source)
1400
1405
  references := make([]string, 0, len(raw))
1401
1406
  for _, reference := range raw {
1402
- target := program.TSProgram.GetSourceFileByPath(shimtspath.Path(reference))
1407
+ target := program.TSProgram.GetSourceFileByPath(shimtspath.PathKey(reference))
1403
1408
  if target == nil {
1404
1409
  continue
1405
1410
  }
1406
- file, err := serveGraphFile(project, target.FileName(), program.TSProgram.UseCaseSensitiveFileNames())
1407
- if err != nil {
1408
- return nil, err
1411
+ name := string(target.FileName())
1412
+ file, ok := projected[name]
1413
+ if !ok {
1414
+ var err error
1415
+ file, err = serveGraphFile(project, name, program.TSProgram.UseCaseSensitiveFileNames())
1416
+ if err != nil {
1417
+ return nil, err
1418
+ }
1419
+ projected[name] = file
1409
1420
  }
1410
1421
  references = append(references, file)
1411
1422
  }
1412
1423
  sort.Strings(references)
1413
1424
  digest, _ := digestJSON(references)
1414
- digests[source.FileName()] = digest
1425
+ digests[string(source.FileName())] = digest
1415
1426
  }
1416
1427
  return digests, nil
1417
1428
  }
@@ -1421,7 +1432,7 @@ func serveGraphResolutionDigests(program *driver.Program, project string) (map[s
1421
1432
  // spelling and authored-source boundary remain the shard ownership coordinates.
1422
1433
  func graphSourceFile(program *driver.Program, file string) *shimast.SourceFile {
1423
1434
  source := program.SourceFile(file)
1424
- if graph.IsWorkspaceSourceFile(source) && source.FileName() == file {
1435
+ if graph.IsWorkspaceSourceFile(source) && string(source.FileName()) == file {
1425
1436
  return source
1426
1437
  }
1427
1438
  return nil
@@ -55,7 +55,7 @@ func TestServeShardsAbandonedGenerationConvergesOnRetry(t *testing.T) {
55
55
  if abandoned.Sequence != committed.Sequence+1 {
56
56
  t.Fatalf("abandoned sequence = %d, want %d", abandoned.Sequence, committed.Sequence+1)
57
57
  }
58
- abandonedKey := session.graphStore.sourceKeys[indexKeyFile]
58
+ abandonedKey := session.graphStore.sourceKeys[string(indexKeyFile)]
59
59
  if abandonedKey == "" {
60
60
  t.Fatal("abandoned source has no committed shard key")
61
61
  }
@@ -83,7 +83,7 @@ func TestServeShardsAbandonedGenerationConvergesOnRetry(t *testing.T) {
83
83
  if converged.Sequence != abandoned.Sequence+1 {
84
84
  t.Fatalf("converged sequence = %d, want %d", converged.Sequence, abandoned.Sequence+1)
85
85
  }
86
- convergedKey := session.graphStore.sourceKeys[indexKeyFile]
86
+ convergedKey := session.graphStore.sourceKeys[string(indexKeyFile)]
87
87
  if convergedKey == "" || convergedKey == abandonedKey {
88
88
  t.Fatalf("edited source kept the abandoned shard identity %q", convergedKey)
89
89
  }
@@ -40,7 +40,7 @@ func TestServeShardsDeleteRemovedSource(t *testing.T) {
40
40
  }
41
41
  removedKeyFile := removedSource.FileName()
42
42
  keepKeyFile := keepSource.FileName()
43
- removedKey := session.graphStore.sourceKeys[removedKeyFile]
43
+ removedKey := session.graphStore.sourceKeys[string(removedKeyFile)]
44
44
  if removedKey == "" {
45
45
  t.Fatal("initial generation omitted removable source shard")
46
46
  }
@@ -58,10 +58,10 @@ func TestServeShardsDeleteRemovedSource(t *testing.T) {
58
58
  if !containsString(replacement.Deletes, removedKey) {
59
59
  t.Fatalf("replacement did not delete removed source shard %q: %v", removedKey, replacement.Deletes)
60
60
  }
61
- if _, exists := session.graphStore.sourceKeys[removedKeyFile]; exists {
61
+ if _, exists := session.graphStore.sourceKeys[string(removedKeyFile)]; exists {
62
62
  t.Fatal("committed store retained removed source identity")
63
63
  }
64
- if session.graphStore.sourceKeys[keepKeyFile] == "" {
64
+ if session.graphStore.sourceKeys[string(keepKeyFile)] == "" {
65
65
  t.Fatal("replacement generation dropped remaining source")
66
66
  }
67
67
  }
@@ -39,7 +39,7 @@ func TestServeShardsPruneUnreferencedExternalEndpoints(t *testing.T) {
39
39
  if source == nil {
40
40
  t.Fatal("fixture source was absent from resident program")
41
41
  }
42
- sourceKey := session.graphStore.sourceKeys[source.FileName()]
42
+ sourceKey := session.graphStore.sourceKeys[string(source.FileName())]
43
43
  if sourceKey == "" || len(session.graphStore.sourceExternal[sourceKey]) != 1 {
44
44
  t.Fatalf("fixture source must own one external endpoint: key=%q targets=%v", sourceKey, session.graphStore.sourceExternal[sourceKey])
45
45
  }
@@ -48,7 +48,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
48
48
  t.Fatal("fixture source was absent from resident program")
49
49
  }
50
50
  consumerKeyFile := consumerSource.FileName()
51
- initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
51
+ initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
52
52
  if initialConsumerKey == "" {
53
53
  t.Fatal("initial generation omitted the dependent source shard")
54
54
  }
@@ -67,7 +67,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
67
67
  if createdSource == nil {
68
68
  t.Fatal("created source did not enter the resident program")
69
69
  }
70
- createdKey := session.graphStore.sourceKeys[createdSource.FileName()]
70
+ createdKey := session.graphStore.sourceKeys[string(createdSource.FileName())]
71
71
  if createdKey == "" {
72
72
  t.Fatal("created source did not acquire a committed shard identity")
73
73
  }
@@ -76,7 +76,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
76
76
  }
77
77
  // The unchanged consumer text must acquire a different published shard key;
78
78
  // the call-edge contents are not independently checked here.
79
- nextConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
79
+ nextConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
80
80
  if nextConsumerKey == "" || nextConsumerKey == initialConsumerKey {
81
81
  t.Fatalf("dependent shard identity %q survived a newly resolved import", nextConsumerKey)
82
82
  }
@@ -43,7 +43,7 @@ func TestServeShardsRefreshCrossFileImplementation(t *testing.T) {
43
43
  if serviceSource == nil {
44
44
  t.Fatal("service source was absent from resident program")
45
45
  }
46
- serviceKey := session.graphStore.sourceKeys[serviceSource.FileName()]
46
+ serviceKey := session.graphStore.sourceKeys[string(serviceSource.FileName())]
47
47
  initialService, exists := session.graphStore.shards[serviceKey]
48
48
  if serviceKey == "" || !exists || initialService.digest == "" {
49
49
  t.Fatal("initial Service shard has no committed identity or digest")
@@ -73,7 +73,7 @@ func TestServeShardsRefreshCrossFileImplementation(t *testing.T) {
73
73
  if session.graphStore.shards[serviceKey].digest == before {
74
74
  t.Fatal("declaration shard retained its cross-file implementation evidence")
75
75
  }
76
- currentServiceKey := session.graphStore.sourceKeys[serviceSource.FileName()]
76
+ currentServiceKey := session.graphStore.sourceKeys[string(serviceSource.FileName())]
77
77
  currentService, exists := session.graphStore.shards[currentServiceKey]
78
78
  if currentServiceKey == "" || !exists || currentService.digest == "" || currentService.digest == before {
79
79
  t.Fatalf("current Service shard was not replaced with a changed digest: key=%q shard=%#v", currentServiceKey, currentService)
@@ -42,7 +42,7 @@ func TestServeShardsRefreshDependentDiagnostics(t *testing.T) {
42
42
  if consumerSource == nil {
43
43
  t.Fatal("consumer source was absent from resident program")
44
44
  }
45
- consumerKey := session.graphStore.sourceKeys[consumerSource.FileName()]
45
+ consumerKey := session.graphStore.sourceKeys[string(consumerSource.FileName())]
46
46
  initialConsumer, exists := session.graphStore.shards[consumerKey]
47
47
  if consumerKey == "" || !exists || initialConsumer.digest == "" {
48
48
  t.Fatal("initial consumer shard has no committed identity or digest")
@@ -90,8 +90,8 @@ func TestServeShardsRefreshDependentDiagnostics(t *testing.T) {
90
90
  valueKeyFile := session.compiler.Program().SourceFile(value).FileName()
91
91
  consumerKeyFile := consumerSource.FileName()
92
92
  if len(session.graphStore.extractedFiles) != 2 ||
93
- session.graphStore.extractedFiles[0] != consumerKeyFile ||
94
- session.graphStore.extractedFiles[1] != valueKeyFile {
93
+ session.graphStore.extractedFiles[0] != string(consumerKeyFile) ||
94
+ session.graphStore.extractedFiles[1] != string(valueKeyFile) {
95
95
  t.Fatalf(
96
96
  "public API edit extracted %v, want reverse closure [%s %s]",
97
97
  session.graphStore.extractedFiles,
@@ -52,8 +52,8 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
52
52
  }
53
53
  originalKeyFile := originalSource.FileName()
54
54
  consumerKeyFile := consumerSource.FileName()
55
- originalKey := session.graphStore.sourceKeys[originalKeyFile]
56
- initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
55
+ originalKey := session.graphStore.sourceKeys[string(originalKeyFile)]
56
+ initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
57
57
  if originalKey == "" || initialConsumerKey == "" {
58
58
  t.Fatal("initial generation omitted a fixture source shard")
59
59
  }
@@ -74,14 +74,14 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
74
74
  if !containsString(next.Deletes, originalKey) {
75
75
  t.Fatalf("rename did not delete the superseded shard %q: %v", originalKey, next.Deletes)
76
76
  }
77
- if _, exists := session.graphStore.sourceKeys[originalKeyFile]; exists {
77
+ if _, exists := session.graphStore.sourceKeys[string(originalKeyFile)]; exists {
78
78
  t.Fatal("committed store retained the pre-rename source identity")
79
79
  }
80
80
  renamedSource := session.compiler.Program().SourceFile(renamed)
81
81
  if renamedSource == nil {
82
82
  t.Fatal("renamed source did not enter the resident program")
83
83
  }
84
- renamedKey := session.graphStore.sourceKeys[renamedSource.FileName()]
84
+ renamedKey := session.graphStore.sourceKeys[string(renamedSource.FileName())]
85
85
  if renamedKey == "" {
86
86
  t.Fatal("renamed source did not acquire a committed shard identity")
87
87
  }
@@ -91,7 +91,7 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
91
91
  if !containsUpsertedShardKey(next, renamedKey) {
92
92
  t.Fatalf("generation did not publish the renamed source shard %q", renamedKey)
93
93
  }
94
- nextConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
94
+ nextConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
95
95
  if nextConsumerKey == "" || nextConsumerKey == initialConsumerKey {
96
96
  t.Fatalf("dependent shard identity %q survived a repointed import", nextConsumerKey)
97
97
  }
@@ -55,16 +55,16 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
55
55
  valueKeyFile := valueSource.FileName()
56
56
  consumerKeyFile := consumerSource.FileName()
57
57
  unrelatedKeyFile := unrelatedSource.FileName()
58
- initialValueKey := session.graphStore.sourceKeys[valueKeyFile]
59
- initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
60
- initialUnrelatedKey := session.graphStore.sourceKeys[unrelatedKeyFile]
58
+ initialValueKey := session.graphStore.sourceKeys[string(valueKeyFile)]
59
+ initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
60
+ initialUnrelatedKey := session.graphStore.sourceKeys[string(unrelatedKeyFile)]
61
61
  if initialValueKey == "" || initialConsumerKey == "" || initialUnrelatedKey == "" {
62
62
  t.Fatal("initial generation omitted a fixture source key")
63
63
  }
64
- unrelatedWireFile := session.graphStore.wireSources[unrelatedKeyFile]
64
+ unrelatedWireFile := session.graphStore.wireSources[string(unrelatedKeyFile)]
65
65
  alteredUnrelatedProvenance := false
66
66
  for index := range session.graphStore.provenance.Sources {
67
- if session.graphStore.provenance.Sources[index].File != unrelatedKeyFile {
67
+ if session.graphStore.provenance.Sources[index].File != string(unrelatedKeyFile) {
68
68
  continue
69
69
  }
70
70
  if runtime.GOOS == "windows" {
@@ -92,7 +92,7 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
92
92
  if delta == nil || mode != serveModeIncremental || !changed || delta.BaseSequence != initial.Sequence || delta.BaseGeneration != initial.Generation {
93
93
  t.Fatalf("incremental coordinates: snapshot=%#v mode=%q changed=%v", delta, mode, changed)
94
94
  }
95
- nextValueKey := session.graphStore.sourceKeys[valueKeyFile]
95
+ nextValueKey := session.graphStore.sourceKeys[string(valueKeyFile)]
96
96
  if nextValueKey == "" || nextValueKey == initialValueKey {
97
97
  t.Fatal("changed source retained its content-addressed shard key")
98
98
  }
@@ -102,10 +102,10 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
102
102
  if !containsString(delta.Deletes, initialValueKey) {
103
103
  t.Fatalf("delta did not delete superseded source shard %q: %v", initialValueKey, delta.Deletes)
104
104
  }
105
- if session.graphStore.sourceKeys[consumerKeyFile] != initialConsumerKey || session.graphStore.sourceKeys[unrelatedKeyFile] != initialUnrelatedKey {
105
+ if session.graphStore.sourceKeys[string(consumerKeyFile)] != initialConsumerKey || session.graphStore.sourceKeys[string(unrelatedKeyFile)] != initialUnrelatedKey {
106
106
  t.Fatal("body edit moved an unchanged source shard identity")
107
107
  }
108
- if len(session.graphStore.extractedFiles) != 1 || session.graphStore.extractedFiles[0] != valueKeyFile {
108
+ if len(session.graphStore.extractedFiles) != 1 || session.graphStore.extractedFiles[0] != string(valueKeyFile) {
109
109
  t.Fatalf("private body edit extracted %v, want only %s", session.graphStore.extractedFiles, valueKeyFile)
110
110
  }
111
111
  wireFilePreserved := false
@@ -106,10 +106,10 @@ func TestServeSourceEncodingKeepsRawIdentityAndDecodedResidentText(t *testing.T)
106
106
  t.Errorf("%s %s decoded text=%q want=%q", stage, name, source.Text(), text(name, suffix))
107
107
  }
108
108
  rawHash := sha256.Sum256(bytesOf(name, text(name, suffix)))
109
- if hashes[source.FileName()] != rawHash {
109
+ if hashes[string(source.FileName())] != rawHash {
110
110
  t.Errorf("%s %s invalidation identity differs from raw bytes", stage, name)
111
111
  }
112
- if digests[source.FileName()] != graph.Digest(rawHash) {
112
+ if digests[string(source.FileName())] != graph.Digest(rawHash) {
113
113
  t.Errorf("%s %s disk digest differs from raw bytes", stage, name)
114
114
  }
115
115
  }
@@ -9,6 +9,7 @@ import (
9
9
  shimast "github.com/microsoft/typescript-go/shim/ast"
10
10
  shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
11
11
  shimprinter "github.com/microsoft/typescript-go/shim/printer"
12
+ shimtspath "github.com/microsoft/typescript-go/shim/tspath"
12
13
  )
13
14
 
14
15
  // TestBuildInformationUsesSelectedOutputIdentity Verifies incremental metadata
@@ -76,11 +77,11 @@ func TestBuildInformationUsesSelectedOutputIdentity(t *testing.T) {
76
77
  state = "tsconfig.tsbuildinfo"
77
78
  }
78
79
  expected := filepath.ToSlash(filepath.Join(root, state))
79
- if escaped := p.outputEscapesOutDir(expected); escaped == c.incremental {
80
+ if escaped := p.outputEscapesOutDir(shimtspath.RootedFilePathFromAbsolute(expected)); escaped == c.incremental {
80
81
  t.Errorf("selected state containment: escaped=%v incremental=%v", escaped, c.incremental)
81
82
  }
82
83
  for _, decoy := range []string{"cache/unrelated.tsbuildinfo", "cache/unrelated.map"} {
83
- if !p.outputEscapesOutDir(filepath.ToSlash(filepath.Join(root, decoy))) {
84
+ if !p.outputEscapesOutDir(shimtspath.RootedFilePathFromAbsolute(filepath.ToSlash(filepath.Join(root, decoy)))) {
84
85
  t.Errorf("unselected output escaped containment: %s", decoy)
85
86
  }
86
87
  }
@@ -105,8 +106,8 @@ func TestBuildInformationUsesSelectedOutputIdentity(t *testing.T) {
105
106
  for _, lane := range []string{"raw", "rewrite", "plugin"} {
106
107
  t.Run(lane, func(t *testing.T) {
107
108
  writes := map[string]string{}
108
- writer := func(file, text string, _ *shimcompiler.WriteFileData) error {
109
- writes[filepath.ToSlash(file)] = text
109
+ writer := func(file shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
110
+ writes[filepath.ToSlash(string(file))] = text
110
111
  return nil
111
112
  }
112
113
  var emitted []Diagnostic
@@ -41,7 +41,7 @@ func WriteCheckObservationsJSON(fileName string, program *Program) error {
41
41
  }
42
42
  if program != nil {
43
43
  if program.TSProgram != nil {
44
- graph = NewTransformGraph(program, program.TSProgram.GetCurrentDirectory())
44
+ graph = NewTransformGraph(program, string(program.TSProgram.GetCurrentDirectory()))
45
45
  }
46
46
  if recorded := program.PluginHostInputs(); recorded != nil {
47
47
  inputs = recorded
@@ -4,6 +4,7 @@ import (
4
4
  "os"
5
5
  "path/filepath"
6
6
 
7
+ "github.com/microsoft/typescript-go/shim/tspath"
7
8
  "github.com/microsoft/typescript-go/shim/vfs/osvfs"
8
9
  )
9
10
 
@@ -159,7 +160,10 @@ func ReportRejectedConfigCandidates(candidates []ConfigCandidate, hashReporter,
159
160
  // conflict and leave every persistent consumer unable to reuse.
160
161
  before, beforeErr := os.Stat(resolved)
161
162
  if beforeErr == nil && before.IsDir() {
162
- physical := osvfs.FS().Realpath(resolved)
163
+ physical := resolved
164
+ if rooted, ok := tspath.TryRootedPathFromAbsolute(resolved); ok {
165
+ physical = string(osvfs.FS().Realpath(rooted))
166
+ }
163
167
  // Realpath returns its argument if the native resolver fails. An
164
168
  // unchanged spelling is proof only when no component is an alias or
165
169
  // unknown reparse entry; SameFile alone cannot prove its spelling.
@@ -34,23 +34,21 @@ func (p *Program) DeclarationShapeDigest(file *ast.SourceFile) (string, error) {
34
34
  }
35
35
  var signature strings.Builder
36
36
  emitted := false
37
- p.TSProgram.Emit(context.Background(), shimcompiler.EmitOptions{
38
- TargetSourceFile: file,
39
- EmitOnly: shimcompiler.EmitOnlyForcedDts,
40
- WriteFile: func(_ string, text string, data *shimcompiler.WriteFileData) error {
41
- emitted = true
42
- if data != nil && data.SourceMapUrlPos >= 0 && data.SourceMapUrlPos <= len(text) {
43
- text = text[:data.SourceMapUrlPos]
37
+ // The forced declaration mode is upstream's declaration emit for
38
+ // incremental signatures; declarationShapeEmitOptions names each target's.
39
+ p.TSProgram.Emit(context.Background(), declarationShapeEmitOptions(file, func(_ shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
40
+ emitted = true
41
+ if data != nil && data.SourceMapUrlPos >= 0 && data.SourceMapUrlPos <= len(text) {
42
+ text = text[:data.SourceMapUrlPos]
43
+ }
44
+ signature.WriteString(text)
45
+ if data != nil {
46
+ for _, diagnostic := range data.Diagnostics {
47
+ appendDeclarationShapeDiagnostic(&signature, file, diagnostic)
44
48
  }
45
- signature.WriteString(text)
46
- if data != nil {
47
- for _, diagnostic := range data.Diagnostics {
48
- appendDeclarationShapeDiagnostic(&signature, file, diagnostic)
49
- }
50
- }
51
- return nil
52
- },
53
- })
49
+ }
50
+ return nil
51
+ }))
54
52
  if !emitted {
55
53
  // Mirrors tsgo's incremental fallback to the file version when forced
56
54
  // declaration emit has no output. This is conservative: any body movement
@@ -68,11 +66,7 @@ func appendDeclarationShapeDiagnostic(builder *strings.Builder, source *ast.Sour
68
66
  builder.WriteString("\n")
69
67
  diagnosticFile := diagnostic.File()
70
68
  if diagnosticFile != nil && diagnosticFile != source {
71
- builder.WriteString(shimtspath.EnsurePathIsNonModuleName(shimtspath.GetRelativePathFromDirectory(
72
- shimtspath.GetDirectoryPath(string(source.Path())),
73
- string(diagnosticFile.Path()),
74
- shimtspath.ComparePathsOptions{},
75
- )))
69
+ writeDeclarationShapeDiagnosticFile(builder, source, diagnosticFile)
76
70
  }
77
71
  if diagnosticFile != nil {
78
72
  builder.WriteString(fmt.Sprintf("(%d,%d): ", diagnostic.Pos(), diagnostic.Len()))
@@ -157,7 +157,7 @@ func (m *preambleMapper) viewOf(file *ast.SourceFile) *preambleView {
157
157
  // anchor against — an uncorrected position is still better than a nil file.
158
158
  func newPreambleView(file *ast.SourceFile, preamble string) *preambleView {
159
159
  text := file.Text()
160
- start, length, ok := sourcePreambleRegion(file.FileName(), text, preamble)
160
+ start, length, ok := sourcePreambleRegion(string(file.FileName()), text, preamble)
161
161
  if !ok {
162
162
  return nil
163
163
  }
@@ -253,7 +253,7 @@ func unanchoredPreambleDiagnostic(d *ast.Diagnostic) Diagnostic {
253
253
  Severity: SeverityError,
254
254
  }
255
255
  if file := d.File(); file != nil {
256
- out.File = file.FileName()
256
+ out.File = string(file.FileName())
257
257
  }
258
258
  return out
259
259
  }
@@ -15,7 +15,10 @@
15
15
  // same way tsc treats node_modules externals (no emit, no error).
16
16
  package driver
17
17
 
18
- import "github.com/microsoft/typescript-go/shim/tspath"
18
+ import (
19
+ shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
20
+ "github.com/microsoft/typescript-go/shim/tspath"
21
+ )
19
22
 
20
23
  // isBuildInfoOutput identifies the metadata artifact selected by this compiler
21
24
  // generation. Its configured extension does not determine its kind, and an
@@ -27,19 +30,16 @@ import "github.com/microsoft/typescript-go/shim/tspath"
27
30
  // Common: Clear and simple design: One artifact predicate serves containment and source-map correction rather than independent suffix rules.
28
31
  // Common: Prohibited implementation shortcuts: The real compiler-selected path replaces the suffix exception; no API-specific filename or consumer exemption compensates for output loss.
29
32
  // Common: Meaningful documentation: Native prose distinguishes selected artifact identity from filename extension and explains why unrelated metadata-looking paths remain ordinary outputs.
30
- // Portability: OS-neutral implementation: Native compiler path comparison uses the loaded Program's current directory and actual case policy, without assuming case behavior from the operating system.
33
+ // Portability: OS-neutral implementation: Native compiler path comparison of rooted paths uses the loaded Program's actual case policy, without assuming case behavior from the operating system.
31
34
  // Performance: Efficient algorithms: Upstream destination inference and lexical comparison process a bounded number of path strings with costs proportional to their text; no directory traversal or file read is added.
32
35
  // Performance: Reuse equivalent work: The current compiler generation owns destination selection; this predicate introduces no result cache or independent producer.
33
36
  // Performance: Bound retention and release resources: The predicate returns a boolean and retains no compiler generation, path history or external resource.
34
- func (p *Program) isBuildInfoOutput(fileName string) bool {
37
+ func (p *Program) isBuildInfoOutput(fileName tspath.RootedFilePath) bool {
35
38
  if p == nil || p.TSProgram == nil {
36
39
  return false
37
40
  }
38
41
  buildInfo := p.TSProgram.CommandLine().GetBuildInfoFileName()
39
- return buildInfo != "" && tspath.ComparePaths(buildInfo, fileName, tspath.ComparePathsOptions{
40
- UseCaseSensitiveFileNames: p.TSProgram.UseCaseSensitiveFileNames(),
41
- CurrentDirectory: p.TSProgram.GetCurrentDirectory(),
42
- }) == 0
42
+ return buildInfo != "" && tspath.CompareFilePaths(shimcompiler.ProgramCaseSensitivity(p.TSProgram), buildInfo, fileName) == 0
43
43
  }
44
44
 
45
45
  // outputEscapesOutDir reports whether fileName — an emit output path tsgo
@@ -48,7 +48,7 @@ func (p *Program) isBuildInfoOutput(fileName string) bool {
48
48
  // next to their sources by design, so the guard only applies when `outDir`
49
49
  // gives the project an output boundary. The compiler-selected build-information
50
50
  // artifact is exempt because its location can legitimately be outside outDir.
51
- func (p *Program) outputEscapesOutDir(fileName string) bool {
51
+ func (p *Program) outputEscapesOutDir(fileName tspath.RootedFilePath) bool {
52
52
  if p == nil || p.TSProgram == nil {
53
53
  return false
54
54
  }
@@ -59,14 +59,11 @@ func (p *Program) outputEscapesOutDir(fileName string) bool {
59
59
  if p.isBuildInfoOutput(fileName) {
60
60
  return false
61
61
  }
62
- cmp := tspath.ComparePathsOptions{
63
- UseCaseSensitiveFileNames: p.TSProgram.UseCaseSensitiveFileNames(),
64
- CurrentDirectory: p.TSProgram.GetCurrentDirectory(),
65
- }
66
- if tspath.ContainsPath(options.OutDir, fileName, cmp) {
62
+ caseSensitivity := shimcompiler.ProgramCaseSensitivity(p.TSProgram)
63
+ if tspath.ContainsPathWith(caseSensitivity, options.OutDir, tspath.RootedPath(fileName)) {
67
64
  return false
68
65
  }
69
- if options.DeclarationDir != "" && tspath.ContainsPath(options.DeclarationDir, fileName, cmp) {
66
+ if options.DeclarationDir != "" && tspath.ContainsPathWith(caseSensitivity, options.DeclarationDir, tspath.RootedPath(fileName)) {
70
67
  return false
71
68
  }
72
69
  return true