ttsc 0.30.4 → 0.31.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 (2081) hide show
  1. package/cmd/graphbench/main.go +2 -3
  2. package/cmd/graphdump/main.go +42 -16
  3. package/cmd/graphdump/run_declares_the_capability_its_output_carries_test.go +32 -18
  4. package/cmd/graphdump/run_reports_an_unknown_flag_without_exiting_the_process_test.go +10 -9
  5. package/cmd/graphdump/run_reports_an_unloadable_project_without_printing_a_dump_test.go +8 -7
  6. package/cmd/platform/command_operation_families_test.go +192 -0
  7. package/cmd/platform/main.go +11 -1
  8. package/cmd/ttsc/api_compile.go +166 -46
  9. package/cmd/ttsc/api_compile_branches_test.go +97 -10
  10. package/cmd/ttsc/api_transform.go +134 -46
  11. package/cmd/ttsc/api_transform_branches_test.go +10 -7
  12. package/cmd/ttsc/build.go +177 -68
  13. package/cmd/ttsc/build_branches_test.go +35 -7
  14. package/cmd/ttsc/cli_command_operation_families_test.go +1287 -0
  15. package/cmd/ttsc/cli_contract_helpers_test.go +82 -0
  16. package/cmd/ttsc/compiler_argument_cwd_test.go +57 -0
  17. package/cmd/ttsc/filter.go +31 -14
  18. package/cmd/ttsc/filter_resolves_flag_names_case_insensitively_test.go +10 -13
  19. package/cmd/ttsc/filter_strips_unknown_forwarded_flag_test.go +10 -16
  20. package/cmd/ttsc/flags_gen.go +2 -2
  21. package/cmd/ttsc/helpers_test.go +67 -10
  22. package/cmd/ttsc/main.go +122 -21
  23. package/cmd/ttsc/main_alias_branches_test.go +35 -9
  24. package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/ambient.d.ts +1 -0
  25. package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/main.ts +2 -0
  26. package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/mytype.ts +1 -0
  27. package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/tsconfig.base.json +3 -0
  28. package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/tsconfig.json +5 -0
  29. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/index.ts +1 -0
  30. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/decorated/main.ts +10 -0
  31. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/decorated/types.ts +3 -0
  32. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/helpers.ts +1 -0
  33. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/isolated.ts +1 -0
  34. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/main.ts +7 -0
  35. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/nested/model.ts +1 -0
  36. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/tsconfig.json +14 -0
  37. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPITransformUsesCurrentDirectory/index.ts +1 -0
  38. package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPITransformUsesCurrentDirectory/tsconfig.json +7 -0
  39. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildAllowsUnusedTypeParametersOnOverloadSignatures/index.ts +4 -0
  40. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildAllowsUnusedTypeParametersOnOverloadSignatures/tsconfig.json +11 -0
  41. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSemanticDiagnostics/index.ts +2 -0
  42. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSemanticDiagnostics/tsconfig.json +9 -0
  43. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSyntacticDiagnostics/index.ts +2 -0
  44. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSyntacticDiagnostics/tsconfig.json +8 -0
  45. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksUnusedParameters/index.ts +3 -0
  46. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksUnusedParameters/tsconfig.json +10 -0
  47. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildEmitErrorRejectsManifest/index.ts +1 -0
  48. package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildEmitErrorRejectsManifest/tsconfig.json +1 -0
  49. package/cmd/ttsc/testdata/cli_operation_families/TestCLIReportsDiagnosticsWithoutEmit/index.ts +1 -0
  50. package/cmd/ttsc/testdata/cli_operation_families/TestCLIReportsDiagnosticsWithoutEmit/tsconfig.json +8 -0
  51. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/emit.json +8 -0
  52. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/flag-shaped.json +7 -0
  53. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/index.ts +2 -0
  54. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/nested/tsconfig.app.json +11 -0
  55. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/outside.json +8 -0
  56. package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/tsconfig.json +8 -0
  57. package/cmd/ttscgraph/auxiliary_identity_state_tracks_retargets_not_source_contents_test.go +26 -15
  58. package/cmd/ttscgraph/disk_realpath_other.go +2 -0
  59. package/cmd/ttscgraph/dump.go +46 -29
  60. package/cmd/ttscgraph/prepared_projection.go +61 -0
  61. package/cmd/ttscgraph/projection_fixture_test.go +96 -0
  62. package/cmd/ttscgraph/run_dump_claims_artifacts_only_when_it_asked_test.go +30 -5
  63. package/cmd/ttscgraph/run_dump_declares_the_capability_its_output_carries_test.go +6 -1
  64. package/cmd/ttscgraph/run_dump_emits_only_checker_verified_member_relations_test.go +12 -5
  65. package/cmd/ttscgraph/run_dump_prints_the_graph_as_json_test.go +17 -12
  66. package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +8 -3
  67. package/cmd/ttscgraph/serve.go +116 -79
  68. package/cmd/ttscgraph/serve_adopts_a_republished_artifact_set_test.go +16 -167
  69. package/cmd/ttscgraph/serve_adopts_a_republished_set_over_the_shard_protocol_test.go +122 -0
  70. package/cmd/ttscgraph/serve_answers_a_project_that_implements_its_own_ambient_declaration_test.go +35 -7
  71. package/cmd/ttscgraph/serve_early_error_encode_failure_is_observable_test.go +5 -0
  72. package/cmd/ttscgraph/serve_error_response_still_names_its_mode_test.go +10 -5
  73. package/cmd/ttscgraph/serve_git_ignore_projection_test.go +150 -0
  74. package/cmd/ttscgraph/serve_keeps_a_startup_set_a_client_never_mentions_test.go +69 -0
  75. package/cmd/ttscgraph/serve_object_members_refresh_without_identity_collisions_test.go +82 -0
  76. package/cmd/ttscgraph/serve_phase_trace_accounts_for_load_failure_test.go +9 -3
  77. package/cmd/ttscgraph/serve_phase_trace_is_opt_in_and_payload_free_test.go +12 -6
  78. package/cmd/ttscgraph/serve_projects_an_artifact_no_source_owns_test.go +13 -16
  79. package/cmd/ttscgraph/serve_protocol_fails_the_stream_on_an_unaddressable_request_line_test.go +10 -9
  80. package/cmd/ttscgraph/serve_protocol_negotiates_incremental_shards_test.go +37 -2
  81. package/cmd/ttscgraph/serve_protocol_retries_session_creation_test.go +7 -2
  82. package/cmd/ttscgraph/serve_protocol_reuses_session_test.go +13 -3
  83. package/cmd/ttscgraph/serve_session_applies_source_edit_incrementally_test.go +12 -7
  84. package/cmd/ttscgraph/serve_session_fails_closed_on_deleted_config_test.go +12 -7
  85. package/cmd/ttscgraph/serve_session_fails_closed_on_invalid_config_test.go +8 -3
  86. package/cmd/ttscgraph/serve_session_keeps_base_url_fallback_unchanged_test.go +7 -2
  87. package/cmd/ttscgraph/serve_session_keeps_change_detection_live_after_initial_dump_error_test.go +66 -0
  88. package/cmd/ttscgraph/serve_session_keeps_esm_directory_candidate_unchanged_test.go +12 -3
  89. package/cmd/ttscgraph/serve_session_keeps_exports_blocked_file_candidates_unchanged_test.go +8 -3
  90. package/cmd/ttscgraph/serve_session_keeps_inactive_conditional_export_unchanged_test.go +12 -3
  91. package/cmd/ttscgraph/serve_session_keeps_lower_priority_module_candidate_unchanged_test.go +14 -8
  92. package/cmd/ttscgraph/serve_session_keeps_lower_priority_paths_pattern_unchanged_test.go +12 -3
  93. package/cmd/ttscgraph/serve_session_keeps_missing_literal_root_unchanged_test.go +7 -2
  94. package/cmd/ttscgraph/serve_session_keeps_nonlongest_root_dirs_candidate_unchanged_test.go +12 -3
  95. package/cmd/ttscgraph/serve_session_rebuilds_import_graph_change_test.go +17 -8
  96. package/cmd/ttscgraph/serve_session_reloads_commonjs_package_entry_for_esm_test.go +11 -2
  97. package/cmd/ttscgraph/serve_session_reloads_created_literal_root_test.go +7 -2
  98. package/cmd/ttscgraph/serve_session_reloads_extended_config_change_test.go +9 -4
  99. package/cmd/ttscgraph/serve_session_reloads_module_suffix_candidate_test.go +13 -4
  100. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_conditional_export_test.go +13 -8
  101. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_config_types_test.go +7 -2
  102. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_excluded_import_test.go +11 -3
  103. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_export_test.go +11 -2
  104. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_import_test.go +11 -2
  105. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_path_alias_test.go +11 -2
  106. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_reference_path_test.go +11 -2
  107. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_root_dirs_target_test.go +11 -2
  108. package/cmd/ttscgraph/serve_session_reloads_newly_resolved_type_reference_test.go +11 -2
  109. package/cmd/ttscgraph/serve_session_reloads_root_file_set_test.go +11 -5
  110. package/cmd/ttscgraph/serve_session_reloads_source_deleted_during_load_test.go +16 -9
  111. package/cmd/ttscgraph/serve_session_reloads_superseding_module_candidates_test.go +18 -13
  112. package/cmd/ttscgraph/serve_session_reloads_transitive_project_reference_test.go +14 -5
  113. package/cmd/ttscgraph/serve_session_reloads_when_program_plugin_linked_test.go +13 -8
  114. package/cmd/ttscgraph/serve_session_retries_a_pending_dump_before_unchanged_test.go +62 -0
  115. package/cmd/ttscgraph/serve_session_reuses_unchanged_preamble_source_test.go +21 -0
  116. package/cmd/ttscgraph/serve_session_reuses_unchanged_snapshot_test.go +12 -7
  117. package/cmd/ttscgraph/serve_session_revisits_source_edited_during_load_test.go +18 -8
  118. package/cmd/ttscgraph/serve_session_tolerates_os_invalid_resolution_candidate_test.go +13 -9
  119. package/cmd/ttscgraph/serve_session_tracks_all_module_specifier_forms_test.go +12 -3
  120. package/cmd/ttscgraph/serve_session_tracks_diamond_project_references_once_test.go +12 -8
  121. package/cmd/ttscgraph/serve_shards.go +356 -279
  122. package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +41 -16
  123. package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +14 -4
  124. package/cmd/ttscgraph/serve_shards_external_endpoints_test.go +18 -2
  125. package/cmd/ttscgraph/serve_shards_keep_source_distributed_dependencies_at_the_boundary_test.go +36 -5
  126. package/cmd/ttscgraph/serve_shards_match_full_dump_oracle_test.go +12 -3
  127. package/cmd/ttscgraph/serve_shards_merge_pending_and_new_edits_test.go +36 -3
  128. package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +18 -2
  129. package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +16 -13
  130. package/cmd/ttscgraph/serve_shards_rebuild_declaration_edit_test.go +14 -4
  131. package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +24 -5
  132. package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +30 -7
  133. package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +14 -11
  134. package/cmd/ttscgraph/serve_shards_retry_preserves_committed_generation_test.go +17 -7
  135. package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +21 -7
  136. package/cmd/ttscgraph/serve_snapshot_proves_its_program_without_a_second_read_test.go +57 -16
  137. package/cmd/ttscgraph/serve_source_encoding_test.go +133 -0
  138. package/cmd/ttscserver/command_operation_families_test.go +207 -0
  139. package/cmd/ttscserver/main.go +121 -39
  140. package/cmd/ttscserver/resolve_launch_uses_native_flag_authority_test.go +147 -0
  141. package/cmd/ttscserver/run_lsp_forwards_execute_command_advertisement_flags_test.go +7 -0
  142. package/cmd/ttscserver/run_lsp_prefers_tsgo_flag_test.go +13 -1
  143. package/cmd/ttscserver/run_lsp_reports_getwd_error_test.go +5 -0
  144. package/cmd/ttscserver/run_lsp_reports_server_error_test.go +10 -3
  145. package/cmd/ttscserver/run_lsp_uses_native_plugin_manifest_source_test.go +13 -10
  146. package/cmd/ttscserver/run_lsp_uses_tsgo_environment_test.go +10 -3
  147. package/driver/authored_region_maps_positions_around_the_preamble_test.go +95 -0
  148. package/driver/build_information_uses_selected_output_identity_test.go +148 -0
  149. package/driver/check_observations.go +67 -0
  150. package/driver/config_discovery.go +93 -24
  151. package/driver/declaration_shape.go +9 -0
  152. package/driver/diagnostics_preamble.go +8 -7
  153. package/driver/emit_containment.go +29 -8
  154. package/driver/emit_plugin.go +106 -36
  155. package/driver/emit_plugin_output.go +26 -2
  156. package/driver/emit_provenance.go +155 -0
  157. package/driver/graph.go +54 -20
  158. package/driver/host.go +26 -3
  159. package/driver/input_observation.go +78 -16
  160. package/driver/input_observation_test.go +34 -11
  161. package/driver/lsp.go +401 -30
  162. package/driver/overlay.go +69 -2
  163. package/driver/plugins.go +256 -24
  164. package/driver/private_result.go +43 -0
  165. package/driver/program.go +439 -95
  166. package/driver/resolution_candidates.go +63 -14
  167. package/driver/resolution_candidates_test.go +28 -0
  168. package/driver/resolutioninputs/recorder.cjs +1149 -0
  169. package/driver/resolutioninputs/resolutioninputs.go +37 -0
  170. package/driver/rewrite.go +373 -420
  171. package/driver/session.go +80 -12
  172. package/driver/sourcemap_preamble.go +38 -16
  173. package/driver/transform_dependencies.go +38 -10
  174. package/driver/transform_dependencies_declares_every_file_without_a_contributor_test.go +9 -8
  175. package/driver/transform_dependencies_drops_a_self_reported_dependency_test.go +7 -6
  176. package/driver/transform_dependencies_keys_a_reported_path_like_the_envelope_test.go +9 -9
  177. package/driver/transform_dependencies_requires_every_contributor_to_declare_test.go +10 -5
  178. package/driver/transform_dependencies_stays_silent_for_an_undeclared_contributor_test.go +8 -6
  179. package/driver/transform_dependencies_withdraws_completeness_after_an_unusable_dependency_test.go +9 -5
  180. package/driver/transform_source_map.go +388 -0
  181. package/driver/windowsjunction/create_preserves_existing_directory_windows_test.go +48 -0
  182. package/driver/windowsjunction/create_treats_paths_as_data_windows_test.go +55 -0
  183. package/driver/windowsjunction/windowsjunction.go +17 -1
  184. package/go.mod +10 -10
  185. package/go.sum +10 -10
  186. package/internal/cwd/cwd.go +13 -0
  187. package/internal/e2etrace/artifact.go +147 -0
  188. package/internal/e2etrace/completion_hints.go +35 -0
  189. package/internal/e2etrace/completion_hints_test.go +76 -0
  190. package/internal/e2etrace/e2etrace.go +303 -0
  191. package/internal/e2etrace/output.go +50 -0
  192. package/internal/graph/artifacts.go +69 -12
  193. package/internal/graph/artifacts_index_what_a_plugin_published_test.go +19 -8
  194. package/internal/graph/artifacts_survive_a_partial_rebuild_test.go +11 -12
  195. package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +10 -12
  196. package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +7 -1
  197. package/internal/graph/build.go +122 -38
  198. package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +9 -3
  199. package/internal/graph/build_keeps_source_distributed_dependencies_at_the_external_boundary_test.go +10 -1
  200. package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +10 -4
  201. package/internal/graph/build_releases_the_scratch_it_no_longer_reads_test.go +22 -15
  202. package/internal/graph/decorators.go +18 -0
  203. package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +9 -4
  204. package/internal/graph/diagnostics.go +21 -8
  205. package/internal/graph/doc_refs_are_the_use_the_checker_already_counts_test.go +25 -13
  206. package/internal/graph/doc_refs_resolve_documentation_links_test.go +19 -15
  207. package/internal/graph/doc_tags.go +28 -19
  208. package/internal/graph/doc_tags_are_claimed_before_they_are_read_test.go +16 -6
  209. package/internal/graph/doc_tags_capture_every_unrecognized_tag_test.go +9 -2
  210. package/internal/graph/doc_tags_read_only_what_the_parser_attached_test.go +12 -8
  211. package/internal/graph/doc_tags_stop_at_the_external_boundary_test.go +11 -1
  212. package/internal/graph/doc_tags_survive_line_endings_and_repeated_blocks_test.go +16 -6
  213. package/internal/graph/dump.go +200 -51
  214. package/internal/graph/dump_checkout_paths_are_stable_test.go +9 -2
  215. package/internal/graph/dump_diagnostics_ride_the_generation_that_built_it_test.go +10 -11
  216. package/internal/graph/dump_evidence_skips_leading_trivia_test.go +8 -2
  217. package/internal/graph/dump_is_a_function_of_the_source_test.go +12 -13
  218. package/internal/graph/dump_never_serializes_a_list_as_null_test.go +9 -9
  219. package/internal/graph/dump_path_mapper_caches_alias_resolution_test.go +10 -2
  220. package/internal/graph/dump_path_mapper_rejects_unportable_roots_and_collisions_test.go +53 -0
  221. package/internal/graph/{dump_paths_are_portable_and_injective_test.go → dump_path_mapper_uses_portable_coordinates_test.go} +8 -43
  222. package/internal/graph/dump_paths.go +61 -25
  223. package/internal/graph/dump_paths_canonicalize_windows_short_root_test.go +45 -8
  224. package/internal/graph/dump_rejects_provenance_only_path_errors_test.go +5 -0
  225. package/internal/graph/dump_serializes_the_full_graph_test.go +13 -19
  226. package/internal/graph/dump_symlink_project_publishes_matching_base_test.go +8 -0
  227. package/internal/graph/dump_uses_ecma_line_terminators_test.go +12 -6
  228. package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +11 -8
  229. package/internal/graph/edge_spans_point_to_resolved_usage_test.go +13 -5
  230. package/internal/graph/edges.go +44 -47
  231. package/internal/graph/edges_cover_class_level_references_test.go +14 -11
  232. package/internal/graph/enum_initializer_calls_are_edges_test.go +13 -3
  233. package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +19 -26
  234. package/internal/graph/exports.go +3 -5
  235. package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +9 -4
  236. package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +11 -5
  237. package/internal/graph/function_locals_do_not_collide_test.go +27 -7
  238. package/internal/graph/gitignore.go +25 -12
  239. package/internal/graph/graph.go +167 -52
  240. package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +11 -3
  241. package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +6 -0
  242. package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +9 -3
  243. package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +11 -4
  244. package/internal/graph/line_model.go +44 -25
  245. package/internal/graph/literals.go +6 -7
  246. package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +10 -5
  247. package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +15 -17
  248. package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +10 -9
  249. package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +11 -11
  250. package/internal/graph/literals_resolve_through_alias_indirection_test.go +11 -11
  251. package/internal/graph/member_relation_edges_follow_checker_validity_test.go +11 -2
  252. package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +11 -1
  253. package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +12 -7
  254. package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +12 -3
  255. package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +12 -2
  256. package/internal/graph/node_identity_is_position_invariant_test.go +8 -2
  257. package/internal/graph/node_ids_preserve_hash_bearing_components_test.go +10 -2
  258. package/internal/graph/node_modifiers_emit_union_strings_test.go +13 -12
  259. package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +12 -14
  260. package/internal/graph/object_literal_declarations_resolve_calls_test.go +170 -0
  261. package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +14 -13
  262. package/internal/graph/object_member_signatures_preserve_literal_whitespace_test.go +11 -7
  263. package/internal/graph/object_members.go +100 -1
  264. package/internal/graph/overload_implementation_replaces_signature_test.go +13 -2
  265. package/internal/graph/property_member_edges_remain_owner_visible_test.go +9 -3
  266. package/internal/graph/provenance.go +172 -87
  267. package/internal/graph/resolve.go +46 -12
  268. package/internal/graph/resolve_prefers_implementation_declaration_test.go +10 -2
  269. package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +16 -20
  270. package/internal/graph/source.go +16 -6
  271. package/internal/graph/source_texts_cover_every_resident_program_source_test.go +11 -7
  272. package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +21 -2
  273. package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +8 -3
  274. package/internal/graph/value_access_edges_cover_properties_test.go +11 -3
  275. package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +10 -4
  276. package/internal/graph/value_call_edges_cover_jsx_components_test.go +12 -8
  277. package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +12 -9
  278. package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +9 -3
  279. package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +10 -3
  280. package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +12 -9
  281. package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +10 -3
  282. package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +16 -5
  283. package/internal/graph/wire_node_ids_share_alias_resolution_test.go +10 -4
  284. package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +16 -4
  285. package/internal/graphsymbols/provider.go +278 -113
  286. package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +14 -12
  287. package/internal/lspserver/lsp_completion_gate_never_refuses_a_matching_line_test.go +7 -1
  288. package/internal/lspserver/lsp_completion_hints_longest_trigger_wins_test.go +30 -5
  289. package/internal/lspserver/lsp_completion_hints_nearest_trigger_wins_test.go +5 -0
  290. package/internal/lspserver/lsp_completion_merges_into_upstream_response_test.go +23 -10
  291. package/internal/lspserver/lsp_completion_nearest_hint_replaces_nearest_filter_test.go +7 -1
  292. package/internal/lspserver/lsp_completion_preserves_completion_list_extensions_test.go +13 -5
  293. package/internal/lspserver/lsp_completion_refuses_hints_inside_a_string_literal_test.go +11 -7
  294. package/internal/lspserver/lsp_completion_replaces_full_filter_in_rank_order_test.go +12 -2
  295. package/internal/lspserver/lsp_completion_request.go +5 -26
  296. package/internal/lspserver/lsp_completion_scope.go +13 -10
  297. package/internal/lspserver/lsp_completion_scope_bench_test.go +11 -5
  298. package/internal/lspserver/lsp_completion_scope_classifies_regex_statement_and_operator_boundaries_test.go +8 -1
  299. package/internal/lspserver/lsp_completion_scope_ignores_jsdoc_bytes_in_literals_test.go +11 -10
  300. package/internal/lspserver/lsp_completion_scope_refuses_regex_hints_test.go +7 -3
  301. package/internal/lspserver/lsp_completion_trigger_uses_last_rune_test.go +6 -0
  302. package/internal/lspserver/lsp_deleted_watched_file_withdraws_plugin_diagnostics_test.go +11 -10
  303. package/internal/lspserver/lsp_didsave_keeps_the_incremental_changed_uri_path_test.go +12 -9
  304. package/internal/lspserver/lsp_document_diagnostics_omits_cached_project_when_current_result_has_none_test.go +17 -5
  305. package/internal/lspserver/lsp_envelope.go +84 -11
  306. package/internal/lspserver/lsp_executable_project_input_change_requests_launcher_restart_test.go +12 -9
  307. package/internal/lspserver/lsp_external_watched_change_retains_program_test.go +8 -2
  308. package/internal/lspserver/lsp_frame.go +42 -10
  309. package/internal/lspserver/lsp_hints_absence_is_not_an_error_test.go +16 -15
  310. package/internal/lspserver/lsp_hints_refresh_coalesces_concurrent_requests_test.go +21 -12
  311. package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +20 -12
  312. package/internal/lspserver/lsp_hints_refresh_keeps_each_producer_isolated_test.go +30 -9
  313. package/internal/lspserver/lsp_hints_refresh_replaces_the_session_snapshot_test.go +25 -18
  314. package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +12 -12
  315. package/internal/lspserver/lsp_hints_refresh_serves_completion_while_running_test.go +21 -8
  316. package/internal/lspserver/lsp_index_byte_from_bounds_its_search_start_test.go +9 -7
  317. package/internal/lspserver/lsp_initialize_constrains_position_encoding_to_utf16_test.go +57 -21
  318. package/internal/lspserver/lsp_late_completion_trigger_is_reported_once_test.go +16 -17
  319. package/internal/lspserver/lsp_native_completion_hints_decode_flat_lint_wire_test.go +8 -2
  320. package/internal/lspserver/lsp_native_completion_hints_grouped_compatibility_boundary_test.go +5 -0
  321. package/internal/lspserver/lsp_native_plugin_source.go +381 -202
  322. package/internal/lspserver/lsp_native_plugin_source_ends_the_session_on_a_selection_input_test.go +234 -0
  323. package/internal/lspserver/lsp_native_reply_policies_test.go +475 -0
  324. package/internal/lspserver/lsp_native_reply_policy.go +232 -0
  325. package/internal/lspserver/lsp_native_resident.go +171 -57
  326. package/internal/lspserver/lsp_plugin.go +372 -68
  327. package/internal/lspserver/lsp_plugin_completion_resolve_stays_local_test.go +13 -4
  328. package/internal/lspserver/lsp_plugin_selection_inputs.go +283 -0
  329. package/internal/lspserver/lsp_plugin_selection_inputs_follow_directory_case_semantics_windows_test.go +81 -0
  330. package/internal/lspserver/lsp_position_conversions_span_astral_and_combining_runes_test.go +33 -11
  331. package/internal/lspserver/lsp_project_context_transport_identity_test.go +14 -2
  332. package/internal/lspserver/lsp_project_diagnostics.go +25 -4
  333. package/internal/lspserver/lsp_project_diagnostics_capability_is_independent_test.go +13 -2
  334. package/internal/lspserver/lsp_project_diagnostics_program_input_overlap_refreshes_all_producers_test.go +14 -4
  335. package/internal/lspserver/lsp_project_diagnostics_refresh_accumulates_owner_freshness_test.go +8 -2
  336. package/internal/lspserver/lsp_project_diagnostics_refresh_keeps_each_producer_last_good_test.go +10 -5
  337. package/internal/lspserver/lsp_project_diagnostics_refreshes_only_input_owners_test.go +14 -2
  338. package/internal/lspserver/lsp_project_diagnostics_resume_preserves_generation_test.go +8 -2
  339. package/internal/lspserver/lsp_project_diagnostics_translates_relative_client_project_test.go +15 -11
  340. package/internal/lspserver/lsp_project_input_ownership_resolves_declared_spellings_test.go +17 -8
  341. package/internal/lspserver/lsp_project_input_path_key_windows.go +16 -16
  342. package/internal/lspserver/lsp_project_input_path_key_windows_test.go +34 -18
  343. package/internal/lspserver/lsp_project_input_registration.go +5 -1
  344. package/internal/lspserver/lsp_project_input_registration_rechecks_selection_baseline_test.go +10 -4
  345. package/internal/lspserver/lsp_project_input_registration_reconciles_rejected_pending_request_test.go +5 -0
  346. package/internal/lspserver/lsp_project_input_registration_shapes_patterns_test.go +9 -3
  347. package/internal/lspserver/lsp_project_input_watchers_anchor_missing_paths_test.go +8 -3
  348. package/internal/lspserver/lsp_project_inputs.go +203 -59
  349. package/internal/lspserver/lsp_project_inputs_match_missing_exact_and_glob_test.go +10 -6
  350. package/internal/lspserver/lsp_project_inputs_reject_invalid_and_foreign_snapshots_test.go +25 -2
  351. package/internal/lspserver/lsp_proxy.go +239 -80
  352. package/internal/lspserver/lsp_refresh.go +16 -1
  353. package/internal/lspserver/lsp_reload_directories_compare_immediate_topology_test.go +66 -19
  354. package/internal/lspserver/lsp_reload_directories_separate_glob_territory_test.go +26 -6
  355. package/internal/lspserver/lsp_reload_file_fingerprint_preserves_raw_symlink_target_test.go +12 -6
  356. package/internal/lspserver/lsp_reload_fingerprints_read_a_junction_as_a_link_test.go +76 -0
  357. package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +20 -13
  358. package/internal/lspserver/lsp_resident_invalidation_broadcasts_program_input_overlap_test.go +9 -4
  359. package/internal/lspserver/lsp_resident_invalidation_targets_project_input_owners_test.go +6 -1
  360. package/internal/lspserver/lsp_resident_maps_verb_args_test.go +5 -0
  361. package/internal/lspserver/lsp_same_transport_entries_are_deduplicated_test.go +10 -1
  362. package/internal/lspserver/lsp_server.go +124 -21
  363. package/internal/lspserver/lsp_symbols.go +92 -13
  364. package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +11 -10
  365. package/internal/sourceprocess/complete_group.go +70 -0
  366. package/internal/sourceprocess/complete_group_preserves_original_wait_and_requires_independent_absence_test.go +145 -0
  367. package/internal/sourceprocess/contain_unix.go +143 -0
  368. package/internal/sourceprocess/contain_windows.go +442 -0
  369. package/internal/sourceprocess/darwin_group_retirement_preserves_phase_evidence_test.go +287 -0
  370. package/internal/sourceprocess/observe_exit_darwin.go +57 -0
  371. package/internal/sourceprocess/observe_exit_linux.go +27 -0
  372. package/internal/sourceprocess/observe_exit_other.go +11 -0
  373. package/internal/sourceprocess/reap_linux.go +31 -0
  374. package/internal/sourceprocess/reap_other.go +10 -0
  375. package/internal/sourceprocess/request_preserves_native_command_inputs_test.go +86 -0
  376. package/internal/sourceprocess/run.go +216 -0
  377. package/internal/sourceprocess/target_windows.go +211 -0
  378. package/internal/sourceprocess/windows_job_accounting_rejects_invalid_boundary_test.go +97 -0
  379. package/internal/sourceprocess/windows_target_owns_suspended_admission_test.go +179 -0
  380. package/internal/watchhelper/run.go +32 -0
  381. package/internal/watchhelper/run_linux.go +323 -0
  382. package/internal/watchhelper/run_linux_test.go +418 -0
  383. package/internal/watchhelper/run_other.go +16 -0
  384. package/internal/watchhelper/watchhelper.go +100 -0
  385. package/lib/TtscCompiler.d.ts +118 -21
  386. package/lib/TtscCompiler.js +175 -179
  387. package/lib/TtscCompiler.js.map +1 -1
  388. package/lib/TtscService.d.ts +66 -18
  389. package/lib/TtscService.js +81 -24
  390. package/lib/TtscService.js.map +1 -1
  391. package/lib/TtscServiceRequestOptions.d.ts +21 -0
  392. package/lib/TtscServiceRequestOptions.js +3 -0
  393. package/lib/TtscServiceRequestOptions.js.map +1 -0
  394. package/lib/compiler/internal/CapturedProcessOutput.d.ts +61 -0
  395. package/lib/compiler/internal/CapturedProcessOutput.js +3 -0
  396. package/lib/compiler/internal/CapturedProcessOutput.js.map +1 -0
  397. package/lib/compiler/internal/CompilerArgumentsInspection.d.ts +53 -0
  398. package/lib/compiler/internal/CompilerArgumentsInspection.js +173 -0
  399. package/lib/compiler/internal/CompilerArgumentsInspection.js.map +1 -0
  400. package/lib/compiler/internal/EmitOwnershipIndex.d.ts +92 -0
  401. package/lib/compiler/internal/EmitOwnershipIndex.js +215 -0
  402. package/lib/compiler/internal/EmitOwnershipIndex.js.map +1 -0
  403. package/lib/compiler/internal/PrivateCompilerOutput.d.ts +67 -0
  404. package/lib/compiler/internal/PrivateCompilerOutput.js +245 -0
  405. package/lib/compiler/internal/PrivateCompilerOutput.js.map +1 -0
  406. package/lib/compiler/internal/ResidentCheckProcess.d.ts +127 -0
  407. package/lib/compiler/internal/ResidentCheckProcess.js +403 -0
  408. package/lib/compiler/internal/ResidentCheckProcess.js.map +1 -0
  409. package/lib/compiler/internal/ResidentCheckProcessOptions.d.ts +29 -0
  410. package/lib/compiler/internal/ResidentCheckProcessOptions.js +3 -0
  411. package/lib/compiler/internal/ResidentCheckProcessOptions.js.map +1 -0
  412. package/lib/compiler/internal/ResidentCheckRequest.d.ts +37 -0
  413. package/lib/compiler/internal/ResidentCheckRequest.js +3 -0
  414. package/lib/compiler/internal/ResidentCheckRequest.js.map +1 -0
  415. package/lib/compiler/internal/ResidentCheckResult.d.ts +23 -0
  416. package/lib/compiler/internal/ResidentCheckResult.js +3 -0
  417. package/lib/compiler/internal/ResidentCheckResult.js.map +1 -0
  418. package/lib/compiler/internal/ResidentCheckTelemetry.d.ts +33 -0
  419. package/lib/compiler/internal/ResidentCheckTelemetry.js +3 -0
  420. package/lib/compiler/internal/ResidentCheckTelemetry.js.map +1 -0
  421. package/lib/compiler/internal/ResidentReplyKind.d.ts +18 -0
  422. package/lib/compiler/internal/ResidentReplyKind.js +3 -0
  423. package/lib/compiler/internal/ResidentReplyKind.js.map +1 -0
  424. package/lib/compiler/internal/ResidentTransformProcess.d.ts +83 -0
  425. package/lib/compiler/internal/ResidentTransformProcess.js +261 -0
  426. package/lib/compiler/internal/ResidentTransformProcess.js.map +1 -0
  427. package/lib/compiler/internal/ResidentTransformProcessOptions.d.ts +27 -0
  428. package/lib/compiler/internal/ResidentTransformProcessOptions.js +3 -0
  429. package/lib/compiler/internal/ResidentTransformProcessOptions.js.map +1 -0
  430. package/lib/compiler/internal/ResidentTransformReply.d.ts +51 -0
  431. package/lib/compiler/internal/ResidentTransformReply.js +79 -0
  432. package/lib/compiler/internal/ResidentTransformReply.js.map +1 -0
  433. package/lib/compiler/internal/ResidentTransformRequestOptions.d.ts +16 -0
  434. package/lib/compiler/internal/ResidentTransformRequestOptions.js +3 -0
  435. package/lib/compiler/internal/ResidentTransformRequestOptions.js.map +1 -0
  436. package/lib/compiler/internal/ResidentTransformRequests.d.ts +102 -0
  437. package/lib/compiler/internal/ResidentTransformRequests.js +172 -0
  438. package/lib/compiler/internal/ResidentTransformRequests.js.map +1 -0
  439. package/lib/compiler/internal/StartedResidentTransform.d.ts +27 -0
  440. package/lib/compiler/internal/StartedResidentTransform.js +3 -0
  441. package/lib/compiler/internal/StartedResidentTransform.js.map +1 -0
  442. package/lib/compiler/internal/TransformProjectWorkerReply.d.ts +34 -0
  443. package/lib/compiler/internal/TransformProjectWorkerReply.js +3 -0
  444. package/lib/compiler/internal/TransformProjectWorkerReply.js.map +1 -0
  445. package/lib/compiler/internal/TransformProjectWorkerRequest.d.ts +39 -0
  446. package/lib/compiler/internal/TransformProjectWorkerRequest.js +3 -0
  447. package/lib/compiler/internal/TransformProjectWorkerRequest.js.map +1 -0
  448. package/lib/compiler/internal/build/BuildExecution.d.ts +359 -0
  449. package/lib/compiler/internal/build/BuildExecution.js +977 -0
  450. package/lib/compiler/internal/build/BuildExecution.js.map +1 -0
  451. package/lib/compiler/internal/build/BuildTiming.d.ts +99 -0
  452. package/lib/compiler/internal/build/BuildTiming.js +113 -0
  453. package/lib/compiler/internal/build/BuildTiming.js.map +1 -0
  454. package/lib/compiler/internal/build/CompilerDiagnostics.d.ts +82 -0
  455. package/lib/compiler/internal/build/CompilerDiagnostics.js +270 -0
  456. package/lib/compiler/internal/build/CompilerDiagnostics.js.map +1 -0
  457. package/lib/compiler/internal/build/NativePluginArguments.d.ts +114 -0
  458. package/lib/compiler/internal/build/NativePluginArguments.js +255 -0
  459. package/lib/compiler/internal/build/NativePluginArguments.js.map +1 -0
  460. package/lib/compiler/internal/build/PassthroughFlags.d.ts +137 -0
  461. package/lib/compiler/internal/build/PassthroughFlags.js +213 -0
  462. package/lib/compiler/internal/build/PassthroughFlags.js.map +1 -0
  463. package/lib/compiler/internal/build/PluginFailureDiagnostics.d.ts +48 -0
  464. package/lib/compiler/internal/build/PluginFailureDiagnostics.js +68 -0
  465. package/lib/compiler/internal/build/PluginFailureDiagnostics.js.map +1 -0
  466. package/lib/compiler/internal/build/ResidentCheckEntryPlan.d.ts +38 -0
  467. package/lib/compiler/internal/build/ResidentCheckEntryPlan.js +3 -0
  468. package/lib/compiler/internal/build/ResidentCheckEntryPlan.js.map +1 -0
  469. package/lib/compiler/internal/build/ResidentCheckWatchChange.d.ts +30 -0
  470. package/lib/compiler/internal/build/ResidentCheckWatchChange.js +3 -0
  471. package/lib/compiler/internal/build/ResidentCheckWatchChange.js.map +1 -0
  472. package/lib/compiler/internal/build/ResidentCheckWatchSession.d.ts +113 -0
  473. package/lib/compiler/internal/build/ResidentCheckWatchSession.js +378 -0
  474. package/lib/compiler/internal/build/ResidentCheckWatchSession.js.map +1 -0
  475. package/lib/compiler/internal/build/RunBuildOptions.d.ts +130 -0
  476. package/lib/compiler/internal/build/RunBuildOptions.js +3 -0
  477. package/lib/compiler/internal/build/RunBuildOptions.js.map +1 -0
  478. package/lib/compiler/internal/build/TsgoArguments.d.ts +168 -0
  479. package/lib/compiler/internal/build/TsgoArguments.js +324 -0
  480. package/lib/compiler/internal/build/TsgoArguments.js.map +1 -0
  481. package/lib/compiler/internal/build/appendBuildOutput.d.ts +41 -0
  482. package/lib/compiler/internal/build/appendBuildOutput.js +182 -0
  483. package/lib/compiler/internal/build/appendBuildOutput.js.map +1 -0
  484. package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.d.ts +20 -0
  485. package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.js +40 -0
  486. package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.js.map +1 -0
  487. package/lib/compiler/internal/build/createProcessDiagnostic.d.ts +19 -0
  488. package/lib/compiler/internal/build/createProcessDiagnostic.js +30 -0
  489. package/lib/compiler/internal/build/createProcessDiagnostic.js.map +1 -0
  490. package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.d.ts +22 -0
  491. package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.js +59 -0
  492. package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.js.map +1 -0
  493. package/lib/compiler/internal/build/mergeProjectInputSnapshots.d.ts +28 -0
  494. package/lib/compiler/internal/build/mergeProjectInputSnapshots.js +121 -0
  495. package/lib/compiler/internal/build/mergeProjectInputSnapshots.js.map +1 -0
  496. package/lib/compiler/internal/build/normalizeBuildOutput.d.ts +29 -0
  497. package/lib/compiler/internal/build/normalizeBuildOutput.js +72 -0
  498. package/lib/compiler/internal/build/normalizeBuildOutput.js.map +1 -0
  499. package/lib/compiler/internal/build/parseProjectInputSnapshot.d.ts +26 -0
  500. package/lib/compiler/internal/build/parseProjectInputSnapshot.js +68 -0
  501. package/lib/compiler/internal/build/parseProjectInputSnapshot.js.map +1 -0
  502. package/lib/compiler/internal/build/planResidentCheckEntries.d.ts +21 -0
  503. package/lib/compiler/internal/build/planResidentCheckEntries.js +45 -0
  504. package/lib/compiler/internal/build/planResidentCheckEntries.js.map +1 -0
  505. package/lib/compiler/internal/build/privateRuntimeRootDir.d.ts +20 -0
  506. package/lib/compiler/internal/build/privateRuntimeRootDir.js +35 -0
  507. package/lib/compiler/internal/build/privateRuntimeRootDir.js.map +1 -0
  508. package/lib/compiler/internal/build/residentCheckRequest.d.ts +22 -0
  509. package/lib/compiler/internal/build/residentCheckRequest.js +42 -0
  510. package/lib/compiler/internal/build/residentCheckRequest.js.map +1 -0
  511. package/lib/compiler/internal/build/runBuild.d.ts +22 -0
  512. package/lib/compiler/internal/build/runBuild.js +44 -0
  513. package/lib/compiler/internal/build/runBuild.js.map +1 -0
  514. package/lib/compiler/internal/build/runExternalEmitProvenance.d.ts +61 -0
  515. package/lib/compiler/internal/build/runExternalEmitProvenance.js +451 -0
  516. package/lib/compiler/internal/build/runExternalEmitProvenance.js.map +1 -0
  517. package/lib/compiler/internal/build/takeResidentCheckEntryRequest.d.ts +18 -0
  518. package/lib/compiler/internal/build/takeResidentCheckEntryRequest.js +28 -0
  519. package/lib/compiler/internal/build/takeResidentCheckEntryRequest.js.map +1 -0
  520. package/lib/compiler/internal/buildNativeCompiler.d.ts +16 -1
  521. package/lib/compiler/internal/buildNativeCompiler.js +14 -2
  522. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  523. package/lib/compiler/internal/captureProcessOutput.d.ts +23 -23
  524. package/lib/compiler/internal/captureProcessOutput.js +38 -26
  525. package/lib/compiler/internal/captureProcessOutput.js.map +1 -1
  526. package/lib/compiler/internal/compileProjectInMemory.d.ts +30 -7
  527. package/lib/compiler/internal/compileProjectInMemory.js +103 -83
  528. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  529. package/lib/compiler/internal/ensureExecutable.d.ts +15 -0
  530. package/lib/compiler/internal/ensureExecutable.js +40 -0
  531. package/lib/compiler/internal/ensureExecutable.js.map +1 -0
  532. package/lib/compiler/internal/findNearestGoMod.d.ts +23 -0
  533. package/lib/compiler/internal/findNearestGoMod.js +48 -0
  534. package/lib/compiler/internal/findNearestGoMod.js.map +1 -0
  535. package/lib/compiler/internal/isOutsideRelativePath.d.ts +18 -0
  536. package/lib/compiler/internal/isOutsideRelativePath.js +30 -0
  537. package/lib/compiler/internal/isOutsideRelativePath.js.map +1 -0
  538. package/lib/compiler/internal/outputText.d.ts +16 -0
  539. package/lib/compiler/internal/outputText.js +25 -0
  540. package/lib/compiler/internal/outputText.js.map +1 -0
  541. package/lib/compiler/internal/packageRootDir.d.ts +25 -0
  542. package/lib/compiler/internal/packageRootDir.js +47 -0
  543. package/lib/compiler/internal/packageRootDir.js.map +1 -0
  544. package/lib/compiler/internal/parseNativeTransformOutput.d.ts +88 -0
  545. package/lib/compiler/internal/parseNativeTransformOutput.js +552 -0
  546. package/lib/compiler/internal/parseNativeTransformOutput.js.map +1 -0
  547. package/lib/compiler/internal/project/CompilerProjectSelection.d.ts +80 -0
  548. package/lib/compiler/internal/project/CompilerProjectSelection.js +187 -0
  549. package/lib/compiler/internal/project/CompilerProjectSelection.js.map +1 -0
  550. package/lib/compiler/internal/project/ConfigJsonText.d.ts +50 -0
  551. package/lib/compiler/internal/project/ConfigJsonText.js +61 -0
  552. package/lib/compiler/internal/project/ConfigJsonText.js.map +1 -0
  553. package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.d.ts +48 -0
  554. package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.js +119 -0
  555. package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.js.map +1 -0
  556. package/lib/compiler/internal/project/createNativeProjectContextArgs.d.ts +11 -8
  557. package/lib/compiler/internal/project/createNativeProjectContextArgs.js +15 -17
  558. package/lib/compiler/internal/project/createNativeProjectContextArgs.js.map +1 -1
  559. package/lib/compiler/internal/project/createNativeProjectContextJson.d.ts +19 -0
  560. package/lib/compiler/internal/project/createNativeProjectContextJson.js +27 -0
  561. package/lib/compiler/internal/project/createNativeProjectContextJson.js.map +1 -0
  562. package/lib/compiler/internal/project/parseJsonc.d.ts +42 -0
  563. package/lib/compiler/internal/project/parseJsonc.js +317 -0
  564. package/lib/compiler/internal/project/parseJsonc.js.map +1 -0
  565. package/lib/compiler/internal/project/readJsonFile.d.ts +21 -0
  566. package/lib/compiler/internal/project/readJsonFile.js +38 -0
  567. package/lib/compiler/internal/project/readJsonFile.js.map +1 -0
  568. package/lib/compiler/internal/project/readJsoncFile.d.ts +20 -0
  569. package/lib/compiler/internal/project/readJsoncFile.js +47 -0
  570. package/lib/compiler/internal/project/readJsoncFile.js.map +1 -0
  571. package/lib/compiler/internal/project/readProjectConfig.d.ts +29 -2
  572. package/lib/compiler/internal/project/readProjectConfig.js +105 -168
  573. package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
  574. package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +65 -0
  575. package/lib/compiler/internal/project/resolveOwningProjectConfig.js +248 -0
  576. package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -0
  577. package/lib/compiler/internal/project/resolveProjectConfig.d.ts +17 -14
  578. package/lib/compiler/internal/project/resolveProjectConfig.js +19 -122
  579. package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -1
  580. package/lib/compiler/internal/project/resolveProjectIdentity.d.ts +32 -0
  581. package/lib/compiler/internal/project/resolveProjectIdentity.js +144 -0
  582. package/lib/compiler/internal/project/resolveProjectIdentity.js.map +1 -0
  583. package/lib/compiler/internal/project/resolveTsconfigExtends.d.ts +38 -0
  584. package/lib/compiler/internal/project/resolveTsconfigExtends.js +163 -0
  585. package/lib/compiler/internal/project/resolveTsconfigExtends.js.map +1 -0
  586. package/lib/compiler/internal/project/selectReferencedProject.d.ts +26 -0
  587. package/lib/compiler/internal/project/selectReferencedProject.js +48 -0
  588. package/lib/compiler/internal/project/selectReferencedProject.js.map +1 -0
  589. package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.d.ts +34 -0
  590. package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.js +55 -0
  591. package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.js.map +1 -0
  592. package/lib/compiler/internal/readEffectiveCompilerOptions.d.ts +54 -0
  593. package/lib/compiler/internal/readEffectiveCompilerOptions.js +116 -0
  594. package/lib/compiler/internal/readEffectiveCompilerOptions.js.map +1 -0
  595. package/lib/compiler/internal/resolveBinary.d.ts +17 -1
  596. package/lib/compiler/internal/resolveBinary.js +24 -9
  597. package/lib/compiler/internal/resolveBinary.js.map +1 -1
  598. package/lib/compiler/internal/resolveTsgo.d.ts +22 -7
  599. package/lib/compiler/internal/resolveTsgo.js +25 -9
  600. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  601. package/lib/compiler/internal/runNativeCheckWithObservations.d.ts +41 -0
  602. package/lib/compiler/internal/runNativeCheckWithObservations.js +185 -0
  603. package/lib/compiler/internal/runNativeCheckWithObservations.js.map +1 -0
  604. package/lib/compiler/internal/runSingleFileEmit.d.ts +26 -5
  605. package/lib/compiler/internal/runSingleFileEmit.js +82 -27
  606. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  607. package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.d.ts +2 -0
  608. package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.js +6 -0
  609. package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.js.map +1 -0
  610. package/lib/compiler/internal/sharedHost/SidecarEnvironment.d.ts +90 -0
  611. package/lib/compiler/internal/sharedHost/SidecarEnvironment.js +153 -0
  612. package/lib/compiler/internal/sharedHost/SidecarEnvironment.js.map +1 -0
  613. package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.d.ts +7 -0
  614. package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.js +11 -0
  615. package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.js.map +1 -0
  616. package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.d.ts +7 -0
  617. package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.js +11 -0
  618. package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.js.map +1 -0
  619. package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.d.ts +24 -0
  620. package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.js +46 -0
  621. package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.js.map +1 -0
  622. package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.d.ts +15 -0
  623. package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.js +23 -0
  624. package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.js.map +1 -0
  625. package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.d.ts +23 -0
  626. package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.js +33 -0
  627. package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.js.map +1 -0
  628. package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.d.ts +27 -0
  629. package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.js +41 -0
  630. package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.js.map +1 -0
  631. package/lib/compiler/internal/sharedHost/isLinkedTransform.d.ts +16 -0
  632. package/lib/compiler/internal/sharedHost/isLinkedTransform.js +21 -0
  633. package/lib/compiler/internal/sharedHost/isLinkedTransform.js.map +1 -0
  634. package/lib/compiler/internal/sharedHost/linkedTransformPlugins.d.ts +19 -0
  635. package/lib/compiler/internal/sharedHost/linkedTransformPlugins.js +25 -0
  636. package/lib/compiler/internal/sharedHost/linkedTransformPlugins.js.map +1 -0
  637. package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.d.ts +25 -0
  638. package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.js +35 -0
  639. package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.js.map +1 -0
  640. package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.d.ts +26 -0
  641. package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.js +36 -0
  642. package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.js.map +1 -0
  643. package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.d.ts +22 -0
  644. package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.js +32 -0
  645. package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.js.map +1 -0
  646. package/lib/compiler/internal/spawnNative.d.ts +15 -16
  647. package/lib/compiler/internal/spawnNative.js +17 -45
  648. package/lib/compiler/internal/spawnNative.js.map +1 -1
  649. package/lib/compiler/internal/startResidentTransform.d.ts +26 -17
  650. package/lib/compiler/internal/startResidentTransform.js +51 -36
  651. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  652. package/lib/compiler/internal/transformProjectInMemory.d.ts +42 -5
  653. package/lib/compiler/internal/transformProjectInMemory.js +189 -469
  654. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  655. package/lib/compiler/internal/transformProjectInWorker.d.ts +49 -0
  656. package/lib/compiler/internal/transformProjectInWorker.js +168 -0
  657. package/lib/compiler/internal/transformProjectInWorker.js.map +1 -0
  658. package/lib/compiler/internal/transformProjectWorker.js +37 -0
  659. package/lib/compiler/internal/transformProjectWorker.js.map +1 -0
  660. package/lib/flags/AnySubcommand.d.ts +18 -0
  661. package/lib/flags/AnySubcommand.js +3 -0
  662. package/lib/flags/AnySubcommand.js.map +1 -0
  663. package/lib/flags/COMPILER_ENUM_WHITESPACE.d.ts +2 -0
  664. package/lib/flags/COMPILER_ENUM_WHITESPACE.js +38 -0
  665. package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -0
  666. package/lib/flags/COMPILER_OPTIONS.d.ts +6 -0
  667. package/lib/flags/COMPILER_OPTIONS.js +509 -0
  668. package/lib/flags/COMPILER_OPTIONS.js.map +1 -0
  669. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.d.ts +2 -0
  670. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +13 -0
  671. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -0
  672. package/lib/flags/COMPILER_OPTION_KINDS.d.ts +2 -0
  673. package/lib/flags/COMPILER_OPTION_KINDS.js +14 -0
  674. package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -0
  675. package/lib/flags/CompilerOptionSpec.d.ts +27 -0
  676. package/lib/flags/CompilerOptionSpec.js +3 -0
  677. package/lib/flags/CompilerOptionSpec.js.map +1 -0
  678. package/lib/flags/FLAG_BY_TOKEN.d.ts +8 -0
  679. package/lib/flags/FLAG_BY_TOKEN.js +34 -0
  680. package/lib/flags/FLAG_BY_TOKEN.js.map +1 -0
  681. package/lib/flags/FLAG_SCHEMA.d.ts +35 -0
  682. package/lib/flags/{schema.js → FLAG_SCHEMA.js} +47 -153
  683. package/lib/flags/FLAG_SCHEMA.js.map +1 -0
  684. package/lib/flags/FlagKind.d.ts +22 -0
  685. package/lib/flags/FlagKind.js +3 -0
  686. package/lib/flags/FlagKind.js.map +1 -0
  687. package/lib/flags/FlagLayer.d.ts +19 -0
  688. package/lib/flags/FlagLayer.js +3 -0
  689. package/lib/flags/FlagLayer.js.map +1 -0
  690. package/lib/flags/FlagSpec.d.ts +104 -0
  691. package/lib/flags/FlagSpec.js +3 -0
  692. package/lib/flags/FlagSpec.js.map +1 -0
  693. package/lib/flags/ParseOptions.d.ts +92 -0
  694. package/lib/flags/ParseOptions.js +3 -0
  695. package/lib/flags/ParseOptions.js.map +1 -0
  696. package/lib/flags/ParseResult.d.ts +37 -0
  697. package/lib/flags/ParseResult.js +3 -0
  698. package/lib/flags/ParseResult.js.map +1 -0
  699. package/lib/flags/TtscSubcommand.d.ts +14 -0
  700. package/lib/flags/TtscSubcommand.js +3 -0
  701. package/lib/flags/TtscSubcommand.js.map +1 -0
  702. package/lib/flags/TtsxSubcommand.d.ts +13 -0
  703. package/lib/flags/TtsxSubcommand.js +3 -0
  704. package/lib/flags/TtsxSubcommand.js.map +1 -0
  705. package/lib/flags/ValueValidator.d.ts +14 -0
  706. package/lib/flags/ValueValidator.js +3 -0
  707. package/lib/flags/ValueValidator.js.map +1 -0
  708. package/lib/flags/buildGoAllowList.d.ts +18 -0
  709. package/lib/flags/buildGoAllowList.js +45 -0
  710. package/lib/flags/buildGoAllowList.js.map +1 -0
  711. package/lib/flags/flagsForSubcommand.d.ts +18 -0
  712. package/lib/flags/flagsForSubcommand.js +23 -0
  713. package/lib/flags/flagsForSubcommand.js.map +1 -0
  714. package/lib/flags/getBoolean.d.ts +19 -0
  715. package/lib/flags/getBoolean.js +27 -0
  716. package/lib/flags/getBoolean.js.map +1 -0
  717. package/lib/flags/getNumber.d.ts +16 -0
  718. package/lib/flags/getNumber.js +24 -0
  719. package/lib/flags/getNumber.js.map +1 -0
  720. package/lib/flags/getString.d.ts +16 -0
  721. package/lib/flags/getString.js +24 -0
  722. package/lib/flags/getString.js.map +1 -0
  723. package/lib/flags/getStringList.d.ts +19 -0
  724. package/lib/flags/getStringList.js +24 -0
  725. package/lib/flags/getStringList.js.map +1 -0
  726. package/lib/flags/normalizeCompilerEnumValue.d.ts +20 -0
  727. package/lib/flags/normalizeCompilerEnumValue.js +40 -0
  728. package/lib/flags/normalizeCompilerEnumValue.js.map +1 -0
  729. package/lib/flags/normalizeFlagToken.d.ts +28 -0
  730. package/lib/flags/normalizeFlagToken.js +38 -0
  731. package/lib/flags/normalizeFlagToken.js.map +1 -0
  732. package/lib/flags/parseFlags.d.ts +18 -0
  733. package/lib/flags/parseFlags.js +288 -0
  734. package/lib/flags/parseFlags.js.map +1 -0
  735. package/lib/flags/readCompilerOptionOccurrence.d.ts +34 -0
  736. package/lib/flags/readCompilerOptionOccurrence.js +81 -0
  737. package/lib/flags/readCompilerOptionOccurrence.js.map +1 -0
  738. package/lib/flags/readCompilerOptionValues.d.ts +33 -0
  739. package/lib/flags/readCompilerOptionValues.js +58 -0
  740. package/lib/flags/readCompilerOptionValues.js.map +1 -0
  741. package/lib/flags/resolveFlagSpec.d.ts +21 -0
  742. package/lib/flags/resolveFlagSpec.js +32 -0
  743. package/lib/flags/resolveFlagSpec.js.map +1 -0
  744. package/lib/index.d.ts +8 -3
  745. package/lib/index.js +10 -3
  746. package/lib/index.js.map +1 -1
  747. package/lib/internal/CanonicalTempDirectoryOperations.d.ts +73 -0
  748. package/lib/internal/CanonicalTempDirectoryOperations.js +3 -0
  749. package/lib/internal/CanonicalTempDirectoryOperations.js.map +1 -0
  750. package/lib/internal/CompilerContextSnapshot.d.ts +66 -0
  751. package/lib/internal/CompilerContextSnapshot.js +121 -0
  752. package/lib/internal/CompilerContextSnapshot.js.map +1 -0
  753. package/lib/internal/CompilerResultAdapter.d.ts +129 -0
  754. package/lib/internal/CompilerResultAdapter.js +247 -0
  755. package/lib/internal/CompilerResultAdapter.js.map +1 -0
  756. package/lib/internal/E2ETrace.d.ts +219 -0
  757. package/lib/internal/E2ETrace.js +541 -0
  758. package/lib/internal/E2ETrace.js.map +1 -0
  759. package/lib/internal/IJavaScriptRuntimeCapabilities.d.ts +48 -0
  760. package/lib/internal/IJavaScriptRuntimeCapabilities.js +3 -0
  761. package/lib/internal/IJavaScriptRuntimeCapabilities.js.map +1 -0
  762. package/lib/internal/OwnedNativeProcess.d.ts +66 -0
  763. package/lib/internal/OwnedNativeProcess.js +317 -0
  764. package/lib/internal/OwnedNativeProcess.js.map +1 -0
  765. package/lib/internal/OwnedSynchronousProcess.d.ts +158 -0
  766. package/lib/internal/OwnedSynchronousProcess.js +171 -0
  767. package/lib/internal/OwnedSynchronousProcess.js.map +1 -0
  768. package/lib/internal/RetireLockDirectoryOperations.d.ts +77 -0
  769. package/lib/internal/RetireLockDirectoryOperations.js +3 -0
  770. package/lib/internal/RetireLockDirectoryOperations.js.map +1 -0
  771. package/lib/internal/SafeCacheCleanupTarget.d.ts +39 -0
  772. package/lib/internal/SafeCacheCleanupTarget.js +3 -0
  773. package/lib/internal/SafeCacheCleanupTarget.js.map +1 -0
  774. package/lib/internal/SourceNativeRetirement.d.ts +384 -0
  775. package/lib/internal/SourceNativeRetirement.js +892 -0
  776. package/lib/internal/SourceNativeRetirement.js.map +1 -0
  777. package/lib/internal/SpawnSyncOutputFiles.d.ts +28 -0
  778. package/lib/internal/SpawnSyncOutputFiles.js +3 -0
  779. package/lib/internal/SpawnSyncOutputFiles.js.map +1 -0
  780. package/lib/internal/cacheEntryExists.d.ts +13 -0
  781. package/lib/internal/cacheEntryExists.js +32 -0
  782. package/lib/internal/cacheEntryExists.js.map +1 -0
  783. package/lib/internal/createCanonicalTempDirectory.d.ts +23 -13
  784. package/lib/internal/createCanonicalTempDirectory.js +31 -12
  785. package/lib/internal/createCanonicalTempDirectory.js.map +1 -1
  786. package/lib/internal/isContendedCandidateRename.d.ts +27 -0
  787. package/lib/internal/isContendedCandidateRename.js +37 -0
  788. package/lib/internal/isContendedCandidateRename.js.map +1 -0
  789. package/lib/internal/isSpawnSyncFdExhaustion.d.ts +16 -0
  790. package/lib/internal/isSpawnSyncFdExhaustion.js +23 -0
  791. package/lib/internal/isSpawnSyncFdExhaustion.js.map +1 -0
  792. package/lib/internal/javascriptRuntimeCapabilities.d.ts +20 -0
  793. package/lib/internal/javascriptRuntimeCapabilities.js +142 -0
  794. package/lib/internal/javascriptRuntimeCapabilities.js.map +1 -0
  795. package/lib/internal/nativeBinary.d.ts +11 -0
  796. package/lib/internal/nativeBinary.js +16 -0
  797. package/lib/internal/nativeBinary.js.map +1 -0
  798. package/lib/internal/parseWindowsDirectoryCaseSensitivity.d.ts +24 -0
  799. package/lib/internal/parseWindowsDirectoryCaseSensitivity.js +47 -0
  800. package/lib/internal/parseWindowsDirectoryCaseSensitivity.js.map +1 -0
  801. package/lib/internal/pathIdentity/FilesystemPathIdentity.d.ts +43 -0
  802. package/lib/internal/pathIdentity/FilesystemPathIdentity.js +3 -0
  803. package/lib/internal/pathIdentity/FilesystemPathIdentity.js.map +1 -0
  804. package/lib/internal/pathIdentity/FilesystemPathIdentityContext.d.ts +176 -0
  805. package/lib/internal/pathIdentity/FilesystemPathIdentityContext.js +3 -0
  806. package/lib/internal/pathIdentity/FilesystemPathIdentityContext.js.map +1 -0
  807. package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.d.ts +100 -0
  808. package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.js +3 -0
  809. package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.js.map +1 -0
  810. package/lib/internal/pathIdentity/ProjectInputPathIdentity.d.ts +20 -0
  811. package/lib/internal/pathIdentity/ProjectInputPathIdentity.js +3 -0
  812. package/lib/internal/pathIdentity/ProjectInputPathIdentity.js.map +1 -0
  813. package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.d.ts +20 -0
  814. package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.js +3 -0
  815. package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.js.map +1 -0
  816. package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.d.ts +20 -0
  817. package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.js +3 -0
  818. package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.js.map +1 -0
  819. package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.d.ts +25 -0
  820. package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js +336 -0
  821. package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js.map +1 -0
  822. package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.d.ts +28 -0
  823. package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.js +33 -0
  824. package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.js.map +1 -0
  825. package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.d.ts +20 -0
  826. package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.js +33 -0
  827. package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.js.map +1 -0
  828. package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.d.ts +15 -0
  829. package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.js +22 -0
  830. package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.js.map +1 -0
  831. package/lib/internal/pathIdentity/resolveFilesystemPath.d.ts +22 -0
  832. package/lib/internal/pathIdentity/resolveFilesystemPath.js +44 -0
  833. package/lib/internal/pathIdentity/resolveFilesystemPath.js.map +1 -0
  834. package/lib/internal/pathIdentity/resolvePhysicalPath.d.ts +21 -0
  835. package/lib/internal/pathIdentity/resolvePhysicalPath.js +35 -0
  836. package/lib/internal/pathIdentity/resolvePhysicalPath.js.map +1 -0
  837. package/lib/internal/pathIdentity/resolveProjectInputPath.d.ts +14 -0
  838. package/lib/internal/pathIdentity/resolveProjectInputPath.js +21 -0
  839. package/lib/internal/pathIdentity/resolveProjectInputPath.js.map +1 -0
  840. package/lib/internal/pluginSource.d.ts +26 -0
  841. package/lib/internal/pluginSource.js +43 -0
  842. package/lib/internal/pluginSource.js.map +1 -0
  843. package/lib/internal/projectInputPathIdentity.d.ts +27 -31
  844. package/lib/internal/projectInputPathIdentity.js +37 -275
  845. package/lib/internal/projectInputPathIdentity.js.map +1 -1
  846. package/lib/internal/resolveNodeBinary.d.ts +9 -7
  847. package/lib/internal/resolveNodeBinary.js +14 -144
  848. package/lib/internal/resolveNodeBinary.js.map +1 -1
  849. package/lib/internal/resolveSafeCacheCleanupTargets.d.ts +27 -8
  850. package/lib/internal/resolveSafeCacheCleanupTargets.js +44 -11
  851. package/lib/internal/resolveSafeCacheCleanupTargets.js.map +1 -1
  852. package/lib/internal/restoreCompilerError.d.ts +21 -0
  853. package/lib/internal/restoreCompilerError.js +164 -0
  854. package/lib/internal/restoreCompilerError.js.map +1 -0
  855. package/lib/internal/retireLockDirectory.d.ts +45 -0
  856. package/lib/internal/retireLockDirectory.js +152 -0
  857. package/lib/internal/retireLockDirectory.js.map +1 -0
  858. package/lib/internal/runHoldingLock.d.ts +30 -0
  859. package/lib/internal/runHoldingLock.js +53 -0
  860. package/lib/internal/runHoldingLock.js.map +1 -0
  861. package/lib/internal/runtimeExecutableIdentity.d.ts +20 -0
  862. package/lib/internal/runtimeExecutableIdentity.js +171 -0
  863. package/lib/internal/runtimeExecutableIdentity.js.map +1 -0
  864. package/lib/internal/serializeCompilerError.d.ts +28 -0
  865. package/lib/internal/serializeCompilerError.js +138 -0
  866. package/lib/internal/serializeCompilerError.js.map +1 -0
  867. package/lib/internal/spawnSyncResilient.d.ts +21 -10
  868. package/lib/internal/spawnSyncResilient.js +31 -147
  869. package/lib/internal/spawnSyncResilient.js.map +1 -1
  870. package/lib/internal/spawnSyncWithLowDescriptors.d.ts +30 -0
  871. package/lib/internal/spawnSyncWithLowDescriptors.js +194 -0
  872. package/lib/internal/spawnSyncWithLowDescriptors.js.map +1 -0
  873. package/lib/internal/tsconfig.d.ts +16 -0
  874. package/lib/internal/tsconfig.js +33 -0
  875. package/lib/internal/tsconfig.js.map +1 -0
  876. package/lib/launcher/internal/PendingResidentCheckWatchChanges.d.ts +56 -0
  877. package/lib/launcher/internal/PendingResidentCheckWatchChanges.js +97 -0
  878. package/lib/launcher/internal/PendingResidentCheckWatchChanges.js.map +1 -0
  879. package/lib/launcher/internal/TtscBuildMode.d.ts +14 -0
  880. package/lib/launcher/internal/TtscBuildMode.js +3 -0
  881. package/lib/launcher/internal/TtscBuildMode.js.map +1 -0
  882. package/lib/launcher/internal/TtsxEntryOptions.d.ts +50 -0
  883. package/lib/launcher/internal/TtsxEntryOptions.js +94 -0
  884. package/lib/launcher/internal/TtsxEntryOptions.js.map +1 -0
  885. package/lib/launcher/internal/assertNoSolutionBuild.d.ts +17 -10
  886. package/lib/launcher/internal/assertNoSolutionBuild.js +16 -9
  887. package/lib/launcher/internal/assertNoSolutionBuild.js.map +1 -1
  888. package/lib/launcher/internal/assertTtsxNoWatch.d.ts +25 -0
  889. package/lib/launcher/internal/assertTtsxNoWatch.js +46 -0
  890. package/lib/launcher/internal/assertTtsxNoWatch.js.map +1 -0
  891. package/lib/launcher/internal/buildSingleRootProject.d.ts +108 -0
  892. package/lib/launcher/internal/buildSingleRootProject.js +229 -0
  893. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -0
  894. package/lib/launcher/internal/getCompilerVersionText.d.ts +14 -1
  895. package/lib/launcher/internal/getCompilerVersionText.js +21 -6
  896. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  897. package/lib/launcher/internal/inlineServedSourceMap.d.ts +35 -0
  898. package/lib/launcher/internal/inlineServedSourceMap.js +255 -0
  899. package/lib/launcher/internal/inlineServedSourceMap.js.map +1 -0
  900. package/lib/launcher/internal/linkVirtualEntry.d.ts +31 -0
  901. package/lib/launcher/internal/linkVirtualEntry.js +87 -0
  902. package/lib/launcher/internal/linkVirtualEntry.js.map +1 -0
  903. package/lib/launcher/internal/parseCommonJsExports.d.ts +17 -0
  904. package/lib/launcher/internal/{commonJsExportMetadata.js → parseCommonJsExports.js} +13 -3
  905. package/lib/launcher/internal/parseCommonJsExports.js.map +1 -0
  906. package/lib/launcher/internal/parseTtscBuildArgs.d.ts +34 -0
  907. package/lib/launcher/internal/parseTtscBuildArgs.js +97 -0
  908. package/lib/launcher/internal/parseTtscBuildArgs.js.map +1 -0
  909. package/lib/launcher/internal/parseTtsxCLI.d.ts +35 -0
  910. package/lib/launcher/internal/parseTtsxCLI.js +187 -0
  911. package/lib/launcher/internal/parseTtsxCLI.js.map +1 -0
  912. package/lib/launcher/internal/prepareExecution.d.ts +49 -5
  913. package/lib/launcher/internal/prepareExecution.js +360 -324
  914. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  915. package/lib/launcher/internal/prepareTtscBuildMode.d.ts +23 -0
  916. package/lib/launcher/internal/prepareTtscBuildMode.js +58 -0
  917. package/lib/launcher/internal/prepareTtscBuildMode.js.map +1 -0
  918. package/lib/launcher/internal/resolveCacheDir.d.ts +12 -3
  919. package/lib/launcher/internal/resolveCacheDir.js +12 -3
  920. package/lib/launcher/internal/resolveCacheDir.js.map +1 -1
  921. package/lib/launcher/internal/resolveSingleFileOutput.d.ts +35 -0
  922. package/lib/launcher/internal/resolveSingleFileOutput.js +115 -0
  923. package/lib/launcher/internal/resolveSingleFileOutput.js.map +1 -0
  924. package/lib/launcher/internal/resolveTtscserverBinary.d.ts +15 -3
  925. package/lib/launcher/internal/resolveTtscserverBinary.js +19 -5
  926. package/lib/launcher/internal/resolveTtscserverBinary.js.map +1 -1
  927. package/lib/launcher/internal/runTtsc.d.ts +23 -23
  928. package/lib/launcher/internal/runTtsc.js +336 -286
  929. package/lib/launcher/internal/runTtsc.js.map +1 -1
  930. package/lib/launcher/internal/runTtsx.d.ts +32 -4
  931. package/lib/launcher/internal/runTtsx.js +286 -138
  932. package/lib/launcher/internal/runTtsx.js.map +1 -1
  933. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.d.ts +92 -0
  934. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js +354 -0
  935. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js.map +1 -0
  936. package/lib/launcher/internal/runtime/DependencyBuildAdmission.d.ts +72 -0
  937. package/lib/launcher/internal/runtime/DependencyBuildAdmission.js +120 -0
  938. package/lib/launcher/internal/runtime/DependencyBuildAdmission.js.map +1 -0
  939. package/lib/launcher/internal/runtime/DependencyBuildGeneration.d.ts +185 -0
  940. package/lib/launcher/internal/runtime/DependencyBuildGeneration.js +153 -0
  941. package/lib/launcher/internal/runtime/DependencyBuildGeneration.js.map +1 -0
  942. package/lib/launcher/internal/runtime/DependencyBuildLockFence.d.ts +22 -0
  943. package/lib/launcher/internal/runtime/DependencyBuildLockFence.js +3 -0
  944. package/lib/launcher/internal/runtime/DependencyBuildLockFence.js.map +1 -0
  945. package/lib/launcher/internal/runtime/DependencyBuildLockLease.d.ts +22 -0
  946. package/lib/launcher/internal/runtime/DependencyBuildLockLease.js +3 -0
  947. package/lib/launcher/internal/runtime/DependencyBuildLockLease.js.map +1 -0
  948. package/lib/launcher/internal/runtime/DependencyBuildLockObservation.d.ts +41 -0
  949. package/lib/launcher/internal/runtime/DependencyBuildLockObservation.js +3 -0
  950. package/lib/launcher/internal/runtime/DependencyBuildLockObservation.js.map +1 -0
  951. package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.d.ts +83 -0
  952. package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.js +126 -0
  953. package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.js.map +1 -0
  954. package/lib/launcher/internal/runtime/OwnedProjectSource.d.ts +112 -0
  955. package/lib/launcher/internal/runtime/OwnedProjectSource.js +59 -0
  956. package/lib/launcher/internal/runtime/OwnedProjectSource.js.map +1 -0
  957. package/lib/launcher/internal/runtime/OwningModuleOptions.d.ts +21 -0
  958. package/lib/launcher/internal/runtime/OwningModuleOptions.js +3 -0
  959. package/lib/launcher/internal/runtime/OwningModuleOptions.js.map +1 -0
  960. package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.d.ts +89 -0
  961. package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.js +115 -0
  962. package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.js.map +1 -0
  963. package/lib/launcher/internal/runtime/ProcessOwnedDirectory.d.ts +168 -0
  964. package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js +251 -0
  965. package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js.map +1 -0
  966. package/lib/launcher/internal/runtime/ResolveResult.d.ts +24 -0
  967. package/lib/launcher/internal/runtime/ResolveResult.js +3 -0
  968. package/lib/launcher/internal/runtime/ResolveResult.js.map +1 -0
  969. package/lib/launcher/internal/runtime/RuntimeEmitProvenance.d.ts +38 -0
  970. package/lib/launcher/internal/runtime/RuntimeEmitProvenance.js +60 -0
  971. package/lib/launcher/internal/runtime/RuntimeEmitProvenance.js.map +1 -0
  972. package/lib/launcher/internal/runtime/RuntimeEntryPreparer.d.ts +22 -0
  973. package/lib/launcher/internal/runtime/RuntimeEntryPreparer.js +3 -0
  974. package/lib/launcher/internal/runtime/RuntimeEntryPreparer.js.map +1 -0
  975. package/lib/launcher/internal/runtime/RuntimeFilesystem.d.ts +52 -0
  976. package/lib/launcher/internal/runtime/RuntimeFilesystem.js +73 -0
  977. package/lib/launcher/internal/runtime/RuntimeFilesystem.js.map +1 -0
  978. package/lib/launcher/internal/runtime/RuntimeHookOptions.d.ts +22 -0
  979. package/lib/launcher/internal/runtime/RuntimeHookOptions.js +3 -0
  980. package/lib/launcher/internal/runtime/RuntimeHookOptions.js.map +1 -0
  981. package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.d.ts +53 -0
  982. package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.js +88 -0
  983. package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.js.map +1 -0
  984. package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.d.ts +78 -0
  985. package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.js +256 -0
  986. package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.js.map +1 -0
  987. package/lib/launcher/internal/runtime/RuntimeManifest.d.ts +65 -0
  988. package/lib/launcher/internal/runtime/RuntimeManifest.js +3 -0
  989. package/lib/launcher/internal/runtime/RuntimeManifest.js.map +1 -0
  990. package/lib/launcher/internal/runtime/RuntimeManifestRegistry.d.ts +95 -0
  991. package/lib/launcher/internal/runtime/RuntimeManifestRegistry.js +268 -0
  992. package/lib/launcher/internal/runtime/RuntimeManifestRegistry.js.map +1 -0
  993. package/lib/launcher/internal/runtime/RuntimeModuleFormat.d.ts +60 -0
  994. package/lib/launcher/internal/runtime/RuntimeModuleFormat.js +249 -0
  995. package/lib/launcher/internal/runtime/RuntimeModuleFormat.js.map +1 -0
  996. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.d.ts +50 -0
  997. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js +134 -0
  998. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js.map +1 -0
  999. package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.d.ts +11 -0
  1000. package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.js +15 -0
  1001. package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.js.map +1 -0
  1002. package/lib/launcher/internal/runtime/acquireDependencyBuildLock.d.ts +22 -0
  1003. package/lib/launcher/internal/runtime/acquireDependencyBuildLock.js +74 -0
  1004. package/lib/launcher/internal/runtime/acquireDependencyBuildLock.js.map +1 -0
  1005. package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.d.ts +30 -0
  1006. package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.js +83 -0
  1007. package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.js.map +1 -0
  1008. package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.d.ts +30 -0
  1009. package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.js +52 -0
  1010. package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.js.map +1 -0
  1011. package/lib/launcher/internal/runtime/commonJsExportNames.d.ts +21 -0
  1012. package/lib/launcher/internal/runtime/commonJsExportNames.js +68 -0
  1013. package/lib/launcher/internal/runtime/commonJsExportNames.js.map +1 -0
  1014. package/lib/launcher/internal/runtime/commonJsImportFacade.d.ts +32 -0
  1015. package/lib/launcher/internal/runtime/commonJsImportFacade.js +56 -0
  1016. package/lib/launcher/internal/runtime/commonJsImportFacade.js.map +1 -0
  1017. package/lib/launcher/internal/runtime/dependencyCacheKey.d.ts +36 -0
  1018. package/lib/launcher/internal/runtime/dependencyCacheKey.js +57 -0
  1019. package/lib/launcher/internal/runtime/dependencyCacheKey.js.map +1 -0
  1020. package/lib/launcher/internal/runtime/dependencyCacheRoot.d.ts +32 -0
  1021. package/lib/launcher/internal/runtime/dependencyCacheRoot.js +98 -0
  1022. package/lib/launcher/internal/runtime/dependencyCacheRoot.js.map +1 -0
  1023. package/lib/launcher/internal/runtime/inspectDependencyBuildLock.d.ts +23 -0
  1024. package/lib/launcher/internal/runtime/inspectDependencyBuildLock.js +126 -0
  1025. package/lib/launcher/internal/runtime/inspectDependencyBuildLock.js.map +1 -0
  1026. package/lib/launcher/internal/runtime/installRuntimeHooks.d.ts +58 -0
  1027. package/lib/launcher/internal/runtime/installRuntimeHooks.js +1988 -0
  1028. package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -0
  1029. package/lib/launcher/internal/runtime/interopProbe.d.ts +8 -0
  1030. package/lib/launcher/internal/runtime/interopProbe.js +3 -0
  1031. package/lib/launcher/internal/runtime/interopProbe.js.map +1 -0
  1032. package/lib/launcher/internal/runtime/isLocalProcessGone.d.ts +33 -0
  1033. package/lib/launcher/internal/runtime/isLocalProcessGone.js +60 -0
  1034. package/lib/launcher/internal/runtime/isLocalProcessGone.js.map +1 -0
  1035. package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.d.ts +28 -0
  1036. package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.js +50 -0
  1037. package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.js.map +1 -0
  1038. package/lib/launcher/internal/runtime/projectModuleOptions.d.ts +16 -0
  1039. package/lib/launcher/internal/runtime/projectModuleOptions.js +28 -0
  1040. package/lib/launcher/internal/runtime/projectModuleOptions.js.map +1 -0
  1041. package/lib/launcher/internal/runtime/readDependencyCache.d.ts +28 -0
  1042. package/lib/launcher/internal/runtime/readDependencyCache.js +83 -0
  1043. package/lib/launcher/internal/runtime/readDependencyCache.js.map +1 -0
  1044. package/lib/launcher/internal/runtime/realPath.d.ts +22 -0
  1045. package/lib/launcher/internal/runtime/realPath.js +37 -0
  1046. package/lib/launcher/internal/runtime/realPath.js.map +1 -0
  1047. package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.d.ts +17 -0
  1048. package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.js +23 -0
  1049. package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.js.map +1 -0
  1050. package/lib/launcher/internal/runtime/releaseDependencyBuildLock.d.ts +17 -0
  1051. package/lib/launcher/internal/runtime/releaseDependencyBuildLock.js +23 -0
  1052. package/lib/launcher/internal/runtime/releaseDependencyBuildLock.js.map +1 -0
  1053. package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.d.ts +34 -0
  1054. package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js +88 -0
  1055. package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js.map +1 -0
  1056. package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.d.ts +20 -0
  1057. package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.js +30 -0
  1058. package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.js.map +1 -0
  1059. package/lib/launcher/internal/runtime/runtimeRunKey.d.ts +24 -0
  1060. package/lib/launcher/internal/runtime/runtimeRunKey.js +36 -0
  1061. package/lib/launcher/internal/runtime/runtimeRunKey.js.map +1 -0
  1062. package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.d.ts +21 -0
  1063. package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.js +29 -0
  1064. package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.js.map +1 -0
  1065. package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.d.ts +35 -0
  1066. package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.js +76 -0
  1067. package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.js.map +1 -0
  1068. package/lib/launcher/internal/runtimeCompilerArgs.d.ts +35 -6
  1069. package/lib/launcher/internal/runtimeCompilerArgs.js +87 -58
  1070. package/lib/launcher/internal/runtimeCompilerArgs.js.map +1 -1
  1071. package/lib/launcher/internal/runtimeEmitProfile.d.ts +39 -0
  1072. package/lib/launcher/internal/runtimeEmitProfile.js +56 -0
  1073. package/lib/launcher/internal/runtimeEmitProfile.js.map +1 -0
  1074. package/lib/launcher/internal/runtimeHookPreload.js +4 -4
  1075. package/lib/launcher/internal/runtimeHookPreload.js.map +1 -1
  1076. package/lib/launcher/internal/runtimeOwnerPreload.d.ts +1 -0
  1077. package/lib/launcher/internal/runtimeOwnerPreload.js +43 -0
  1078. package/lib/launcher/internal/runtimeOwnerPreload.js.map +1 -0
  1079. package/lib/launcher/internal/singleRootProjectConfig.d.ts +34 -0
  1080. package/lib/launcher/internal/singleRootProjectConfig.js +39 -0
  1081. package/lib/launcher/internal/singleRootProjectConfig.js.map +1 -0
  1082. package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.d.ts +61 -0
  1083. package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.js +3 -0
  1084. package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.js.map +1 -0
  1085. package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.d.ts +95 -0
  1086. package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.js +270 -0
  1087. package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.js.map +1 -0
  1088. package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.d.ts +46 -0
  1089. package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js +91 -0
  1090. package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js.map +1 -0
  1091. package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.d.ts +21 -0
  1092. package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.js +39 -0
  1093. package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.js.map +1 -0
  1094. package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.d.ts +18 -0
  1095. package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.js +27 -0
  1096. package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.js.map +1 -0
  1097. package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.d.ts +26 -0
  1098. package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.js +62 -0
  1099. package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.js.map +1 -0
  1100. package/lib/launcher/internal/ttscserver/needsStdio.d.ts +17 -0
  1101. package/lib/launcher/internal/ttscserver/needsStdio.js +36 -0
  1102. package/lib/launcher/internal/ttscserver/needsStdio.js.map +1 -0
  1103. package/lib/launcher/internal/ttscserver/runTtscserver.d.ts +25 -0
  1104. package/lib/launcher/internal/ttscserver/runTtscserver.js +439 -0
  1105. package/lib/launcher/internal/ttscserver/runTtscserver.js.map +1 -0
  1106. package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.d.ts +29 -0
  1107. package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.js +3 -0
  1108. package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.js.map +1 -0
  1109. package/lib/launcher/internal/watch/DirectoryWatcher.d.ts +44 -0
  1110. package/lib/launcher/internal/watch/DirectoryWatcher.js +3 -0
  1111. package/lib/launcher/internal/watch/DirectoryWatcher.js.map +1 -0
  1112. package/lib/launcher/internal/watch/FseventsStreams.d.ts +87 -0
  1113. package/lib/launcher/internal/watch/FseventsStreams.js +266 -0
  1114. package/lib/launcher/internal/watch/FseventsStreams.js.map +1 -0
  1115. package/lib/launcher/internal/watch/ProjectInputWatchRules.d.ts +92 -0
  1116. package/lib/launcher/internal/watch/ProjectInputWatchRules.js +163 -0
  1117. package/lib/launcher/internal/watch/ProjectInputWatchRules.js.map +1 -0
  1118. package/lib/launcher/internal/watch/WatchInputChange.d.ts +29 -0
  1119. package/lib/launcher/internal/watch/WatchInputChange.js +3 -0
  1120. package/lib/launcher/internal/watch/WatchInputChange.js.map +1 -0
  1121. package/lib/launcher/internal/watch/WatchPaths.d.ts +101 -0
  1122. package/lib/launcher/internal/watch/WatchPaths.js +150 -0
  1123. package/lib/launcher/internal/watch/WatchPaths.js.map +1 -0
  1124. package/lib/launcher/internal/watch/WatchTopology.d.ts +384 -0
  1125. package/lib/launcher/internal/{watchTopology.js → watch/WatchTopology.js} +726 -799
  1126. package/lib/launcher/internal/watch/WatchTopology.js.map +1 -0
  1127. package/lib/launcher/internal/watch/literalGlobRoot.d.ts +22 -0
  1128. package/lib/launcher/internal/watch/literalGlobRoot.js +45 -0
  1129. package/lib/launcher/internal/watch/literalGlobRoot.js.map +1 -0
  1130. package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.d.ts +40 -0
  1131. package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.js +69 -0
  1132. package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.js.map +1 -0
  1133. package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.d.ts +19 -0
  1134. package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.js +52 -0
  1135. package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.js.map +1 -0
  1136. package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.d.ts +21 -0
  1137. package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.js +55 -0
  1138. package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.js.map +1 -0
  1139. package/lib/launcher/internal/watch/projectInputEventShouldNotify.d.ts +21 -0
  1140. package/lib/launcher/internal/watch/projectInputEventShouldNotify.js +23 -0
  1141. package/lib/launcher/internal/watch/projectInputEventShouldNotify.js.map +1 -0
  1142. package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.d.ts +27 -0
  1143. package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.js +54 -0
  1144. package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.js.map +1 -0
  1145. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.d.ts +26 -0
  1146. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js +100 -0
  1147. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js.map +1 -0
  1148. package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.d.ts +37 -0
  1149. package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.js +54 -0
  1150. package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.js.map +1 -0
  1151. package/lib/launcher/internal/watch/projectInputTopologyMayAffect.d.ts +23 -0
  1152. package/lib/launcher/internal/watch/projectInputTopologyMayAffect.js +67 -0
  1153. package/lib/launcher/internal/watch/projectInputTopologyMayAffect.js.map +1 -0
  1154. package/lib/launcher/internal/watch/projectInputWatchDirectories.d.ts +22 -0
  1155. package/lib/launcher/internal/watch/projectInputWatchDirectories.js +30 -0
  1156. package/lib/launcher/internal/watch/projectInputWatchDirectories.js.map +1 -0
  1157. package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.d.ts +22 -0
  1158. package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.js +45 -0
  1159. package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.js.map +1 -0
  1160. package/lib/launcher/internal/watch/syncWatchers.d.ts +25 -0
  1161. package/lib/launcher/internal/watch/syncWatchers.js +61 -0
  1162. package/lib/launcher/internal/watch/syncWatchers.js.map +1 -0
  1163. package/lib/launcher/internal/watch/watchDirectory.d.ts +28 -0
  1164. package/lib/launcher/internal/watch/watchDirectory.js +46 -0
  1165. package/lib/launcher/internal/watch/watchDirectory.js.map +1 -0
  1166. package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.d.ts +28 -0
  1167. package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.js +38 -0
  1168. package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.js.map +1 -0
  1169. package/lib/launcher/ttscserver.js +1 -1
  1170. package/lib/launcher/ttscserver.js.map +1 -1
  1171. package/lib/launcher/ttsx.js +2 -3
  1172. package/lib/launcher/ttsx.js.map +1 -1
  1173. package/lib/plugin/CapabilityPluginResolver.d.ts +140 -0
  1174. package/lib/plugin/CapabilityPluginResolver.js +400 -0
  1175. package/lib/plugin/CapabilityPluginResolver.js.map +1 -0
  1176. package/lib/plugin/ITtscCapabilityPlugin.d.ts +87 -0
  1177. package/lib/plugin/ITtscCapabilityPlugin.js +3 -0
  1178. package/lib/plugin/ITtscCapabilityPlugin.js.map +1 -0
  1179. package/lib/plugin/internal/CapabilityPluginResult.d.ts +66 -0
  1180. package/lib/plugin/internal/CapabilityPluginResult.js +86 -0
  1181. package/lib/plugin/internal/CapabilityPluginResult.js.map +1 -0
  1182. package/lib/plugin/internal/CapabilityResolutionFormat.d.ts +114 -0
  1183. package/lib/plugin/internal/CapabilityResolutionFormat.js +229 -0
  1184. package/lib/plugin/internal/CapabilityResolutionFormat.js.map +1 -0
  1185. package/lib/plugin/internal/ITtscCapabilityPluginSource.d.ts +35 -0
  1186. package/lib/plugin/internal/ITtscCapabilityPluginSource.js +3 -0
  1187. package/lib/plugin/internal/ITtscCapabilityPluginSource.js.map +1 -0
  1188. package/lib/plugin/internal/ITtscCapabilityResolutionEntry.d.ts +49 -0
  1189. package/lib/plugin/internal/ITtscCapabilityResolutionEntry.js +3 -0
  1190. package/lib/plugin/internal/ITtscCapabilityResolutionEntry.js.map +1 -0
  1191. package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.d.ts +21 -0
  1192. package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.js +3 -0
  1193. package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.js.map +1 -0
  1194. package/lib/plugin/internal/capabilityPluginWorker.d.ts +1 -0
  1195. package/lib/plugin/internal/capabilityPluginWorker.js +178 -0
  1196. package/lib/plugin/internal/capabilityPluginWorker.js.map +1 -0
  1197. package/lib/plugin/internal/decodeCapabilityCommandReply.d.ts +23 -0
  1198. package/lib/plugin/internal/decodeCapabilityCommandReply.js +25 -0
  1199. package/lib/plugin/internal/decodeCapabilityCommandReply.js.map +1 -0
  1200. package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.d.ts +15 -0
  1201. package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.js +182 -0
  1202. package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.js.map +1 -0
  1203. package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.d.ts +11 -0
  1204. package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.js +62 -0
  1205. package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.js.map +1 -0
  1206. package/lib/plugin/internal/load/PluginDescriptorAdmission.d.ts +46 -0
  1207. package/lib/plugin/internal/load/PluginDescriptorAdmission.js +72 -0
  1208. package/lib/plugin/internal/load/PluginDescriptorAdmission.js.map +1 -0
  1209. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +154 -0
  1210. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +317 -0
  1211. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -0
  1212. package/lib/plugin/internal/load/PluginPackageResolution.d.ts +208 -0
  1213. package/lib/plugin/internal/load/PluginPackageResolution.js +593 -0
  1214. package/lib/plugin/internal/load/PluginPackageResolution.js.map +1 -0
  1215. package/lib/plugin/internal/load/ProjectPluginEntries.d.ts +60 -0
  1216. package/lib/plugin/internal/load/ProjectPluginEntries.js +164 -0
  1217. package/lib/plugin/internal/load/ProjectPluginEntries.js.map +1 -0
  1218. package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.d.ts +13 -0
  1219. package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.js +21 -0
  1220. package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.js.map +1 -0
  1221. package/lib/plugin/internal/load/collectProjectHostInputs.d.ts +16 -0
  1222. package/lib/plugin/internal/load/collectProjectHostInputs.js +66 -0
  1223. package/lib/plugin/internal/load/collectProjectHostInputs.js.map +1 -0
  1224. package/lib/plugin/internal/load/composePluginSources.d.ts +20 -0
  1225. package/lib/plugin/internal/load/composePluginSources.js +95 -0
  1226. package/lib/plugin/internal/load/composePluginSources.js.map +1 -0
  1227. package/lib/plugin/internal/load/declaresHostInputReads.d.ts +24 -0
  1228. package/lib/plugin/internal/load/declaresHostInputReads.js +48 -0
  1229. package/lib/plugin/internal/load/declaresHostInputReads.js.map +1 -0
  1230. package/lib/plugin/internal/load/hasProjectPluginEntries.d.ts +21 -0
  1231. package/lib/plugin/internal/load/hasProjectPluginEntries.js +29 -0
  1232. package/lib/plugin/internal/load/hasProjectPluginEntries.js.map +1 -0
  1233. package/lib/plugin/internal/load/hashHostInputPaths.d.ts +17 -0
  1234. package/lib/plugin/internal/load/hashHostInputPaths.js +46 -0
  1235. package/lib/plugin/internal/load/hashHostInputPaths.js.map +1 -0
  1236. package/lib/plugin/internal/load/isRelativePluginSpecifier.d.ts +22 -0
  1237. package/lib/plugin/internal/load/isRelativePluginSpecifier.js +33 -0
  1238. package/lib/plugin/internal/load/isRelativePluginSpecifier.js.map +1 -0
  1239. package/lib/plugin/internal/load/loadProjectPlugins.d.ts +113 -0
  1240. package/lib/plugin/internal/load/loadProjectPlugins.js +1615 -0
  1241. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -0
  1242. package/lib/plugin/internal/load/moduleResolutionBaseSelects.d.ts +42 -0
  1243. package/lib/plugin/internal/load/moduleResolutionBaseSelects.js +51 -0
  1244. package/lib/plugin/internal/load/moduleResolutionBaseSelects.js.map +1 -0
  1245. package/lib/plugin/internal/load/observeImportSearchRoots.d.ts +29 -0
  1246. package/lib/plugin/internal/load/observeImportSearchRoots.js +38 -0
  1247. package/lib/plugin/internal/load/observeImportSearchRoots.js.map +1 -0
  1248. package/lib/plugin/internal/load/pluginLabel.d.ts +15 -0
  1249. package/lib/plugin/internal/load/pluginLabel.js +25 -0
  1250. package/lib/plugin/internal/load/pluginLabel.js.map +1 -0
  1251. package/lib/plugin/internal/load/realpathHostInput.d.ts +14 -0
  1252. package/lib/plugin/internal/load/realpathHostInput.js +29 -0
  1253. package/lib/plugin/internal/load/realpathHostInput.js.map +1 -0
  1254. package/lib/plugin/internal/load/realpathHostInputPaths.d.ts +17 -0
  1255. package/lib/plugin/internal/load/realpathHostInputPaths.js +28 -0
  1256. package/lib/plugin/internal/load/realpathHostInputPaths.js.map +1 -0
  1257. package/lib/plugin/internal/load/rejectJsTransformFunctions.d.ts +13 -0
  1258. package/lib/plugin/internal/load/rejectJsTransformFunctions.js +22 -0
  1259. package/lib/plugin/internal/load/rejectJsTransformFunctions.js.map +1 -0
  1260. package/lib/plugin/internal/load/requirePluginSource.d.ts +14 -0
  1261. package/lib/plugin/internal/load/requirePluginSource.js +38 -0
  1262. package/lib/plugin/internal/load/requirePluginSource.js.map +1 -0
  1263. package/lib/plugin/internal/load/resolveNativeSource.d.ts +29 -0
  1264. package/lib/plugin/internal/load/resolveNativeSource.js +37 -0
  1265. package/lib/plugin/internal/load/resolveNativeSource.js.map +1 -0
  1266. package/lib/plugin/internal/load/validatePluginContributors.d.ts +22 -0
  1267. package/lib/plugin/internal/load/validatePluginContributors.js +86 -0
  1268. package/lib/plugin/internal/load/validatePluginContributors.js.map +1 -0
  1269. package/lib/plugin/internal/load/validatePluginSource.d.ts +14 -0
  1270. package/lib/plugin/internal/load/validatePluginSource.js +21 -0
  1271. package/lib/plugin/internal/load/validatePluginSource.js.map +1 -0
  1272. package/lib/plugin/internal/load/visitImportMappedCandidates.d.ts +36 -0
  1273. package/lib/plugin/internal/load/visitImportMappedCandidates.js +45 -0
  1274. package/lib/plugin/internal/load/visitImportMappedCandidates.js.map +1 -0
  1275. package/lib/plugin/internal/pluginDescriptorFailureReason.d.ts +23 -0
  1276. package/lib/plugin/internal/pluginDescriptorFailureReason.js +43 -0
  1277. package/lib/plugin/internal/pluginDescriptorFailureReason.js.map +1 -0
  1278. package/lib/plugin/internal/pluginDescriptorProcessFailure.d.ts +28 -0
  1279. package/lib/plugin/internal/pluginDescriptorProcessFailure.js +37 -0
  1280. package/lib/plugin/internal/pluginDescriptorProcessFailure.js.map +1 -0
  1281. package/lib/plugin/internal/readCapabilityResolution.d.ts +42 -0
  1282. package/lib/plugin/internal/readCapabilityResolution.js +158 -0
  1283. package/lib/plugin/internal/readCapabilityResolution.js.map +1 -0
  1284. package/lib/plugin/internal/receiveCapabilityFailure.d.ts +21 -0
  1285. package/lib/plugin/internal/receiveCapabilityFailure.js +28 -0
  1286. package/lib/plugin/internal/receiveCapabilityFailure.js.map +1 -0
  1287. package/lib/plugin/internal/source/CachePrunePolicy.d.ts +42 -0
  1288. package/lib/plugin/internal/source/CachePrunePolicy.js +47 -0
  1289. package/lib/plugin/internal/source/CachePrunePolicy.js.map +1 -0
  1290. package/lib/plugin/internal/source/GoBuildCacheCoordination.d.ts +159 -0
  1291. package/lib/plugin/internal/source/GoBuildCacheCoordination.js +475 -0
  1292. package/lib/plugin/internal/source/GoBuildCacheCoordination.js.map +1 -0
  1293. package/lib/plugin/internal/source/GoSourceInputs.d.ts +124 -0
  1294. package/lib/plugin/internal/source/GoSourceInputs.js +180 -0
  1295. package/lib/plugin/internal/source/GoSourceInputs.js.map +1 -0
  1296. package/lib/plugin/internal/source/GoToolResolution.d.ts +125 -0
  1297. package/lib/plugin/internal/source/GoToolResolution.js +278 -0
  1298. package/lib/plugin/internal/source/GoToolResolution.js.map +1 -0
  1299. package/lib/plugin/internal/source/IGoBuildCachePruneOptions.d.ts +30 -0
  1300. package/lib/plugin/internal/source/IGoBuildCachePruneOptions.js +3 -0
  1301. package/lib/plugin/internal/source/IGoBuildCachePruneOptions.js.map +1 -0
  1302. package/lib/plugin/internal/source/IPluginCachePruneOptions.d.ts +33 -0
  1303. package/lib/plugin/internal/source/IPluginCachePruneOptions.js +3 -0
  1304. package/lib/plugin/internal/source/IPluginCachePruneOptions.js.map +1 -0
  1305. package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.d.ts +27 -0
  1306. package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.js +3 -0
  1307. package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.js.map +1 -0
  1308. package/lib/plugin/internal/source/ITtscBuildContributor.d.ts +18 -0
  1309. package/lib/plugin/internal/source/ITtscBuildContributor.js +3 -0
  1310. package/lib/plugin/internal/source/ITtscBuildContributor.js.map +1 -0
  1311. package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.d.ts +25 -0
  1312. package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.js +3 -0
  1313. package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.js.map +1 -0
  1314. package/lib/plugin/internal/source/NativeSourcePackages.d.ts +155 -0
  1315. package/lib/plugin/internal/source/NativeSourcePackages.js +317 -0
  1316. package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -0
  1317. package/lib/plugin/internal/source/PluginBinaryUse.d.ts +66 -0
  1318. package/lib/plugin/internal/source/PluginBinaryUse.js +163 -0
  1319. package/lib/plugin/internal/source/PluginBinaryUse.js.map +1 -0
  1320. package/lib/plugin/internal/source/PluginBinaryWaitResult.d.ts +34 -0
  1321. package/lib/plugin/internal/source/PluginBinaryWaitResult.js +3 -0
  1322. package/lib/plugin/internal/source/PluginBinaryWaitResult.js.map +1 -0
  1323. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +90 -0
  1324. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +207 -0
  1325. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -0
  1326. package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.d.ts +128 -0
  1327. package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.js +209 -0
  1328. package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.js.map +1 -0
  1329. package/lib/plugin/internal/source/PluginBuildLockFence.d.ts +25 -0
  1330. package/lib/plugin/internal/source/PluginBuildLockFence.js +3 -0
  1331. package/lib/plugin/internal/source/PluginBuildLockFence.js.map +1 -0
  1332. package/lib/plugin/internal/source/PluginBuildLockLease.d.ts +29 -0
  1333. package/lib/plugin/internal/source/PluginBuildLockLease.js +3 -0
  1334. package/lib/plugin/internal/source/PluginBuildLockLease.js.map +1 -0
  1335. package/lib/plugin/internal/source/PluginBuildLockObservation.d.ts +42 -0
  1336. package/lib/plugin/internal/source/PluginBuildLockObservation.js +3 -0
  1337. package/lib/plugin/internal/source/PluginBuildLockObservation.js.map +1 -0
  1338. package/lib/plugin/internal/source/PluginBuildLockOwner.d.ts +126 -0
  1339. package/lib/plugin/internal/source/PluginBuildLockOwner.js +165 -0
  1340. package/lib/plugin/internal/source/PluginBuildLockOwner.js.map +1 -0
  1341. package/lib/plugin/internal/source/PluginBuildLockProtocol.d.ts +234 -0
  1342. package/lib/plugin/internal/source/PluginBuildLockProtocol.js +287 -0
  1343. package/lib/plugin/internal/source/PluginBuildLockProtocol.js.map +1 -0
  1344. package/lib/plugin/internal/source/SourceBuildCacheLayout.d.ts +183 -0
  1345. package/lib/plugin/internal/source/SourceBuildCacheLayout.js +291 -0
  1346. package/lib/plugin/internal/source/SourceBuildCacheLayout.js.map +1 -0
  1347. package/lib/plugin/internal/source/SourceBuildFilesystemOperations.d.ts +32 -0
  1348. package/lib/plugin/internal/source/SourceBuildFilesystemOperations.js +3 -0
  1349. package/lib/plugin/internal/source/SourceBuildFilesystemOperations.js.map +1 -0
  1350. package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +80 -0
  1351. package/lib/plugin/internal/source/SourcePluginAdmission.js +114 -0
  1352. package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -0
  1353. package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +122 -0
  1354. package/lib/plugin/internal/source/SourcePluginWorkspace.js +307 -0
  1355. package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -0
  1356. package/lib/plugin/internal/source/acquirePluginBuildLock.d.ts +35 -0
  1357. package/lib/plugin/internal/source/acquirePluginBuildLock.js +176 -0
  1358. package/lib/plugin/internal/source/acquirePluginBuildLock.js.map +1 -0
  1359. package/lib/plugin/internal/source/autoQuoteGoModToken.d.ts +24 -0
  1360. package/lib/plugin/internal/source/autoQuoteGoModToken.js +110 -0
  1361. package/lib/plugin/internal/source/autoQuoteGoModToken.js.map +1 -0
  1362. package/lib/plugin/internal/source/buildSourcePlugin.d.ts +86 -0
  1363. package/lib/plugin/internal/source/buildSourcePlugin.js +857 -0
  1364. package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -0
  1365. package/lib/plugin/internal/source/collectPluginSourceDirectories.d.ts +30 -0
  1366. package/lib/plugin/internal/source/collectPluginSourceDirectories.js +77 -0
  1367. package/lib/plugin/internal/source/collectPluginSourceDirectories.js.map +1 -0
  1368. package/lib/plugin/internal/source/collectPluginSourceFiles.d.ts +40 -0
  1369. package/lib/plugin/internal/source/collectPluginSourceFiles.js +95 -0
  1370. package/lib/plugin/internal/source/collectPluginSourceFiles.js.map +1 -0
  1371. package/lib/plugin/internal/source/computeCacheKey.d.ts +73 -0
  1372. package/lib/plugin/internal/source/computeCacheKey.js +113 -0
  1373. package/lib/plugin/internal/source/computeCacheKey.js.map +1 -0
  1374. package/lib/plugin/internal/source/copiesPluginSourceEntry.d.ts +33 -0
  1375. package/lib/plugin/internal/source/copiesPluginSourceEntry.js +57 -0
  1376. package/lib/plugin/internal/source/copiesPluginSourceEntry.js.map +1 -0
  1377. package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.d.ts +22 -0
  1378. package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.js +60 -0
  1379. package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.js.map +1 -0
  1380. package/lib/plugin/internal/source/ensureExecutableGoToolchain.d.ts +25 -0
  1381. package/lib/plugin/internal/source/ensureExecutableGoToolchain.js +96 -0
  1382. package/lib/plugin/internal/source/ensureExecutableGoToolchain.js.map +1 -0
  1383. package/lib/plugin/internal/source/formatDuration.d.ts +18 -0
  1384. package/lib/plugin/internal/source/formatDuration.js +36 -0
  1385. package/lib/plugin/internal/source/formatDuration.js.map +1 -0
  1386. package/lib/plugin/internal/source/formatGoWorkPath.d.ts +35 -0
  1387. package/lib/plugin/internal/source/formatGoWorkPath.js +42 -0
  1388. package/lib/plugin/internal/source/formatGoWorkPath.js.map +1 -0
  1389. package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +47 -0
  1390. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +663 -0
  1391. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -0
  1392. package/lib/plugin/internal/source/inspectPluginBuildLock.d.ts +29 -0
  1393. package/lib/plugin/internal/source/inspectPluginBuildLock.js +285 -0
  1394. package/lib/plugin/internal/source/inspectPluginBuildLock.js.map +1 -0
  1395. package/lib/plugin/internal/source/isPathWithin.d.ts +16 -0
  1396. package/lib/plugin/internal/source/isPathWithin.js +28 -0
  1397. package/lib/plugin/internal/source/isPathWithin.js.map +1 -0
  1398. package/lib/plugin/internal/source/legacyGlobalCacheTargets.d.ts +24 -0
  1399. package/lib/plugin/internal/source/legacyGlobalCacheTargets.js +60 -0
  1400. package/lib/plugin/internal/source/legacyGlobalCacheTargets.js.map +1 -0
  1401. package/lib/plugin/internal/source/pluginBuildEnvironment.d.ts +31 -0
  1402. package/lib/plugin/internal/source/pluginBuildEnvironment.js +47 -0
  1403. package/lib/plugin/internal/source/pluginBuildEnvironment.js.map +1 -0
  1404. package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.d.ts +1 -0
  1405. package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js +24 -0
  1406. package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js.map +1 -0
  1407. package/lib/plugin/internal/source/pluginBuildVersions.d.ts +31 -0
  1408. package/lib/plugin/internal/source/pluginBuildVersions.js +65 -0
  1409. package/lib/plugin/internal/source/pluginBuildVersions.js.map +1 -0
  1410. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.d.ts +40 -0
  1411. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js +81 -0
  1412. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js.map +1 -0
  1413. package/lib/plugin/internal/source/pluginSourceCovers.d.ts +32 -0
  1414. package/lib/plugin/internal/source/pluginSourceCovers.js +54 -0
  1415. package/lib/plugin/internal/source/pluginSourceCovers.js.map +1 -0
  1416. package/lib/plugin/internal/source/pluginSourceDigest.d.ts +40 -0
  1417. package/lib/plugin/internal/source/pluginSourceDigest.js +60 -0
  1418. package/lib/plugin/internal/source/pluginSourceDigest.js.map +1 -0
  1419. package/lib/plugin/internal/source/pluginSourceFilesSignature.d.ts +38 -0
  1420. package/lib/plugin/internal/source/pluginSourceFilesSignature.js +53 -0
  1421. package/lib/plugin/internal/source/pluginSourceFilesSignature.js.map +1 -0
  1422. package/lib/plugin/internal/source/pluginSourceState.d.ts +47 -0
  1423. package/lib/plugin/internal/source/pluginSourceState.js +63 -0
  1424. package/lib/plugin/internal/source/pluginSourceState.js.map +1 -0
  1425. package/lib/plugin/internal/source/pluginSourceStateHolds.d.ts +34 -0
  1426. package/lib/plugin/internal/source/pluginSourceStateHolds.js +45 -0
  1427. package/lib/plugin/internal/source/pluginSourceStateHolds.js.map +1 -0
  1428. package/lib/plugin/internal/source/processPluginBuildEnvironment.d.ts +33 -0
  1429. package/lib/plugin/internal/source/processPluginBuildEnvironment.js +40 -0
  1430. package/lib/plugin/internal/source/processPluginBuildEnvironment.js.map +1 -0
  1431. package/lib/plugin/internal/source/pruneCacheFileRoot.d.ts +34 -0
  1432. package/lib/plugin/internal/source/pruneCacheFileRoot.js +120 -0
  1433. package/lib/plugin/internal/source/pruneCacheFileRoot.js.map +1 -0
  1434. package/lib/plugin/internal/source/pruneGoBuildCacheRoot.d.ts +28 -0
  1435. package/lib/plugin/internal/source/pruneGoBuildCacheRoot.js +185 -0
  1436. package/lib/plugin/internal/source/pruneGoBuildCacheRoot.js.map +1 -0
  1437. package/lib/plugin/internal/source/prunePluginCacheRoot.d.ts +46 -0
  1438. package/lib/plugin/internal/source/prunePluginCacheRoot.js +446 -0
  1439. package/lib/plugin/internal/source/prunePluginCacheRoot.js.map +1 -0
  1440. package/lib/plugin/internal/source/prunesPluginSourceDirectory.d.ts +21 -0
  1441. package/lib/plugin/internal/source/prunesPluginSourceDirectory.js +28 -0
  1442. package/lib/plugin/internal/source/prunesPluginSourceDirectory.js.map +1 -0
  1443. package/lib/plugin/internal/source/reclaimPluginBuildLock.d.ts +23 -0
  1444. package/lib/plugin/internal/source/reclaimPluginBuildLock.js +48 -0
  1445. package/lib/plugin/internal/source/reclaimPluginBuildLock.js.map +1 -0
  1446. package/lib/plugin/internal/source/recordCacheFileUse.d.ts +22 -0
  1447. package/lib/plugin/internal/source/recordCacheFileUse.js +43 -0
  1448. package/lib/plugin/internal/source/recordCacheFileUse.js.map +1 -0
  1449. package/lib/plugin/internal/source/releasePluginBuildLock.d.ts +33 -0
  1450. package/lib/plugin/internal/source/releasePluginBuildLock.js +100 -0
  1451. package/lib/plugin/internal/source/releasePluginBuildLock.js.map +1 -0
  1452. package/lib/plugin/internal/source/resolveCleanTargets.d.ts +26 -0
  1453. package/lib/plugin/internal/source/resolveCleanTargets.js +73 -0
  1454. package/lib/plugin/internal/source/resolveCleanTargets.js.map +1 -0
  1455. package/lib/plugin/internal/source/resolveGoCompiler.d.ts +29 -0
  1456. package/lib/plugin/internal/source/resolveGoCompiler.js +62 -0
  1457. package/lib/plugin/internal/source/resolveGoCompiler.js.map +1 -0
  1458. package/lib/plugin/internal/source/resolvePluginCacheRoot.d.ts +21 -0
  1459. package/lib/plugin/internal/source/resolvePluginCacheRoot.js +31 -0
  1460. package/lib/plugin/internal/source/resolvePluginCacheRoot.js.map +1 -0
  1461. package/lib/plugin/internal/source/resolvePluginGoModule.d.ts +34 -0
  1462. package/lib/plugin/internal/source/resolvePluginGoModule.js +65 -0
  1463. package/lib/plugin/internal/source/resolvePluginGoModule.js.map +1 -0
  1464. package/lib/plugin/internal/source/resolveSourceBuildCachePaths.d.ts +21 -0
  1465. package/lib/plugin/internal/source/resolveSourceBuildCachePaths.js +236 -0
  1466. package/lib/plugin/internal/source/resolveSourceBuildCachePaths.js.map +1 -0
  1467. package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.d.ts +29 -0
  1468. package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.js +68 -0
  1469. package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.js.map +1 -0
  1470. package/lib/plugin/internal/source/spawnGoTool.d.ts +22 -0
  1471. package/lib/plugin/internal/source/spawnGoTool.js +164 -0
  1472. package/lib/plugin/internal/source/spawnGoTool.js.map +1 -0
  1473. package/lib/plugin/internal/source/touchPluginCacheEntryInUse.d.ts +27 -0
  1474. package/lib/plugin/internal/source/touchPluginCacheEntryInUse.js +48 -0
  1475. package/lib/plugin/internal/source/touchPluginCacheEntryInUse.js.map +1 -0
  1476. package/lib/plugin/internal/source/waitForPluginBinary.d.ts +36 -0
  1477. package/lib/plugin/internal/source/waitForPluginBinary.js +94 -0
  1478. package/lib/plugin/internal/source/waitForPluginBinary.js.map +1 -0
  1479. package/lib/plugin/internal/source/windowsGoCommandArgs.d.ts +17 -0
  1480. package/lib/plugin/internal/source/windowsGoCommandArgs.js +23 -0
  1481. package/lib/plugin/internal/source/windowsGoCommandArgs.js.map +1 -0
  1482. package/lib/plugin/internal/source/withGoBuildCacheLease.d.ts +37 -0
  1483. package/lib/plugin/internal/source/withGoBuildCacheLease.js +87 -0
  1484. package/lib/plugin/internal/source/withGoBuildCacheLease.js.map +1 -0
  1485. package/lib/plugin/internal/writeCapabilityResolution.d.ts +80 -0
  1486. package/lib/plugin/internal/writeCapabilityResolution.js +196 -0
  1487. package/lib/plugin/internal/writeCapabilityResolution.js.map +1 -0
  1488. package/lib/plugin/resolveCapabilityPlugins.d.ts +53 -32
  1489. package/lib/plugin/resolveCapabilityPlugins.js +209 -38
  1490. package/lib/plugin/resolveCapabilityPlugins.js.map +1 -1
  1491. package/lib/register.js +20 -5
  1492. package/lib/register.js.map +1 -1
  1493. package/lib/structures/ITtscCompilerContext.d.ts +29 -11
  1494. package/lib/structures/ITtscCompilerDiagnostic.d.ts +24 -7
  1495. package/lib/structures/ITtscCompilerResult.d.ts +75 -25
  1496. package/lib/structures/ITtscCompilerTransformation.d.ts +287 -64
  1497. package/lib/structures/ITtscPlugin.d.ts +24 -8
  1498. package/lib/structures/ITtscPluginCapabilities.d.ts +55 -5
  1499. package/lib/structures/ITtscPluginContributor.d.ts +19 -8
  1500. package/lib/structures/ITtscPluginFactoryContext.d.ts +12 -3
  1501. package/lib/structures/ITtscProjectPluginConfig.d.ts +35 -10
  1502. package/lib/structures/TtscPluginStage.d.ts +9 -0
  1503. package/lib/structures/internal/ITtscLoadedNativePlugin.d.ts +19 -5
  1504. package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +29 -3
  1505. package/lib/structures/internal/ITtscProjectIdentity.d.ts +21 -6
  1506. package/lib/structures/internal/ITtscProjectInputSnapshot.d.ts +23 -8
  1507. package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +18 -4
  1508. package/lib/structures/internal/TtscBuildOptions.d.ts +33 -14
  1509. package/lib/structures/internal/TtscBuildResult.d.ts +63 -4
  1510. package/lib/structures/internal/TtscCommonOptions.d.ts +47 -14
  1511. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +46 -5
  1512. package/package.json +26 -12
  1513. package/shim/ast/enums_gen.go +4 -2
  1514. package/shim/ast/go.mod +5 -5
  1515. package/shim/ast/go.sum +10 -10
  1516. package/shim/ast/lint.go +1088 -20
  1517. package/shim/ast/parent.go +38 -22
  1518. package/shim/ast/safe_text.go +48 -26
  1519. package/shim/ast/shim.go +1307 -20
  1520. package/shim/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
  1521. package/shim/ast/test/node_text_joins_multi_hop_qualified_name_test.go +24 -9
  1522. package/shim/ast/test/node_text_joins_one_hop_qualified_name_test.go +9 -5
  1523. package/shim/ast/test/node_text_returns_empty_for_nil_test.go +13 -5
  1524. package/shim/ast/test/node_text_returns_identifier_text_test.go +12 -5
  1525. package/shim/ast/test/node_text_skips_empty_qualified_left_test.go +35 -5
  1526. package/shim/astnav/go.mod +5 -5
  1527. package/shim/astnav/go.sum +12 -10
  1528. package/shim/astnav/shim.go +9 -0
  1529. package/shim/bundled/go.mod +7 -1
  1530. package/shim/bundled/go.sum +12 -0
  1531. package/shim/checker/enums_gen.go +4 -2
  1532. package/shim/checker/extra-shim.json +6 -0
  1533. package/shim/checker/go.mod +5 -5
  1534. package/shim/checker/go.sum +10 -10
  1535. package/shim/checker/node_builder_fields_gen.go +19 -0
  1536. package/shim/checker/shim.go +827 -114
  1537. package/shim/compiler/emit_sourcemap.go +68 -29
  1538. package/shim/compiler/emitassemble.go +36 -2
  1539. package/shim/compiler/emithook.go +13 -3
  1540. package/shim/compiler/go.mod +5 -5
  1541. package/shim/compiler/go.sum +10 -10
  1542. package/shim/compiler/incremental.go +56 -20
  1543. package/shim/compiler/resolution.go +92 -9
  1544. package/shim/core/enums_gen.go +2 -2
  1545. package/shim/core/go.mod +6 -1
  1546. package/shim/core/go.sum +10 -0
  1547. package/shim/core/modulekind.go +9 -0
  1548. package/shim/core/shim.go +157 -6
  1549. package/shim/diagnosticwriter/go.mod +10 -1
  1550. package/shim/diagnosticwriter/go.sum +20 -0
  1551. package/shim/diagnosticwriter/lint.go +188 -10
  1552. package/shim/diagnosticwriter/shim.go +14 -0
  1553. package/shim/lsp/go.mod +5 -5
  1554. package/shim/lsp/go.sum +10 -10
  1555. package/shim/lsp/shim.go +78 -2
  1556. package/shim/parser/go.mod +10 -1
  1557. package/shim/parser/go.sum +22 -0
  1558. package/shim/printer/emithost.go +46 -1
  1559. package/shim/printer/go.mod +5 -5
  1560. package/shim/printer/go.sum +10 -10
  1561. package/shim/printer/shim.go +114 -7
  1562. package/shim/printer/sourcemap.go +55 -0
  1563. package/shim/scanner/go.mod +10 -1
  1564. package/shim/scanner/go.sum +20 -0
  1565. package/shim/scanner/regexp.go +19 -4
  1566. package/shim/scanner/shim.go +3 -0
  1567. package/shim/stringutil/extra-shim.json +1 -0
  1568. package/shim/stringutil/go.mod +5 -0
  1569. package/shim/stringutil/go.sum +2 -0
  1570. package/shim/stringutil/shim.go +119 -0
  1571. package/shim/transformers/go.mod +5 -5
  1572. package/shim/transformers/go.sum +12 -10
  1573. package/shim/transformers/shim.go +12 -3
  1574. package/shim/tsoptions/command_line_raw.go +44 -0
  1575. package/shim/tsoptions/go.mod +10 -1
  1576. package/shim/tsoptions/go.sum +22 -0
  1577. package/shim/tsoptions/shim.go +1 -1
  1578. package/shim/tspath/go.mod +1 -1
  1579. package/shim/tspath/go.sum +6 -0
  1580. package/shim/vfs/cachedvfs/go.mod +3 -1
  1581. package/shim/vfs/cachedvfs/go.sum +12 -0
  1582. package/shim/vfs/decode.go +26 -0
  1583. package/shim/vfs/decode_test.go +42 -0
  1584. package/shim/vfs/go.mod +7 -1
  1585. package/shim/vfs/go.sum +12 -0
  1586. package/shim/vfs/osvfs/go.mod +7 -1
  1587. package/shim/vfs/osvfs/go.sum +12 -0
  1588. package/src/TtscCompiler.ts +223 -234
  1589. package/src/TtscService.ts +87 -31
  1590. package/src/TtscServiceRequestOptions.ts +21 -0
  1591. package/src/compiler/internal/CapturedProcessOutput.ts +69 -0
  1592. package/src/compiler/internal/CompilerArgumentsInspection.ts +184 -0
  1593. package/src/compiler/internal/EmitOwnershipIndex.ts +254 -0
  1594. package/src/compiler/internal/PrivateCompilerOutput.ts +330 -0
  1595. package/src/compiler/internal/ResidentCheckProcess.ts +445 -0
  1596. package/src/compiler/internal/ResidentCheckProcessOptions.ts +32 -0
  1597. package/src/compiler/internal/ResidentCheckRequest.ts +39 -0
  1598. package/src/compiler/internal/ResidentCheckResult.ts +24 -0
  1599. package/src/compiler/internal/ResidentCheckTelemetry.ts +36 -0
  1600. package/src/compiler/internal/ResidentReplyKind.ts +18 -0
  1601. package/src/compiler/internal/ResidentTransformProcess.ts +299 -0
  1602. package/src/compiler/internal/ResidentTransformProcessOptions.ts +30 -0
  1603. package/src/compiler/internal/ResidentTransformReply.ts +79 -0
  1604. package/src/compiler/internal/ResidentTransformRequestOptions.ts +16 -0
  1605. package/src/compiler/internal/ResidentTransformRequests.ts +198 -0
  1606. package/src/compiler/internal/StartedResidentTransform.ts +29 -0
  1607. package/src/compiler/internal/TransformProjectWorkerReply.ts +37 -0
  1608. package/src/compiler/internal/TransformProjectWorkerRequest.ts +42 -0
  1609. package/src/compiler/internal/build/BuildExecution.ts +1261 -0
  1610. package/src/compiler/internal/build/BuildTiming.ts +145 -0
  1611. package/src/compiler/internal/build/CompilerDiagnostics.ts +307 -0
  1612. package/src/compiler/internal/build/NativePluginArguments.ts +302 -0
  1613. package/src/compiler/internal/build/PassthroughFlags.ts +229 -0
  1614. package/src/compiler/internal/build/PluginFailureDiagnostics.ts +70 -0
  1615. package/src/compiler/internal/build/ResidentCheckEntryPlan.ts +42 -0
  1616. package/src/compiler/internal/build/ResidentCheckWatchChange.ts +33 -0
  1617. package/src/compiler/internal/build/ResidentCheckWatchSession.ts +501 -0
  1618. package/src/compiler/internal/build/RunBuildOptions.ts +145 -0
  1619. package/src/compiler/internal/build/TsgoArguments.ts +349 -0
  1620. package/src/compiler/internal/build/appendBuildOutput.ts +218 -0
  1621. package/src/compiler/internal/build/bufferResidentCheckEntryRequests.ts +52 -0
  1622. package/src/compiler/internal/build/createProcessDiagnostic.ts +32 -0
  1623. package/src/compiler/internal/build/isAbsoluteLocalProjectInputPath.ts +55 -0
  1624. package/src/compiler/internal/build/mergeProjectInputSnapshots.ts +147 -0
  1625. package/src/compiler/internal/build/normalizeBuildOutput.ts +89 -0
  1626. package/src/compiler/internal/build/parseProjectInputSnapshot.ts +91 -0
  1627. package/src/compiler/internal/build/planResidentCheckEntries.ts +55 -0
  1628. package/src/compiler/internal/build/privateRuntimeRootDir.ts +33 -0
  1629. package/src/compiler/internal/build/residentCheckRequest.ts +41 -0
  1630. package/src/compiler/internal/build/runBuild.ts +61 -0
  1631. package/src/compiler/internal/build/runExternalEmitProvenance.ts +566 -0
  1632. package/src/compiler/internal/build/takeResidentCheckEntryRequest.ts +31 -0
  1633. package/src/compiler/internal/buildNativeCompiler.ts +19 -2
  1634. package/src/compiler/internal/captureProcessOutput.ts +37 -39
  1635. package/src/compiler/internal/compileProjectInMemory.ts +139 -92
  1636. package/src/compiler/internal/ensureExecutable.ts +32 -0
  1637. package/src/compiler/internal/findNearestGoMod.ts +43 -0
  1638. package/src/compiler/internal/isOutsideRelativePath.ts +26 -0
  1639. package/src/compiler/internal/outputText.ts +21 -0
  1640. package/src/compiler/internal/packageRootDir.ts +43 -0
  1641. package/src/compiler/internal/parseNativeTransformOutput.ts +722 -0
  1642. package/src/compiler/internal/project/CompilerProjectSelection.ts +204 -0
  1643. package/src/compiler/internal/project/ConfigJsonText.ts +55 -0
  1644. package/src/compiler/internal/project/compilerUsesCaseSensitiveFileNames.ts +124 -0
  1645. package/src/compiler/internal/project/createNativeProjectContextArgs.ts +14 -19
  1646. package/src/compiler/internal/project/createNativeProjectContextJson.ts +28 -0
  1647. package/src/compiler/internal/project/parseJsonc.ts +318 -0
  1648. package/src/compiler/internal/project/readJsonFile.ts +34 -0
  1649. package/src/compiler/internal/project/readJsoncFile.ts +46 -0
  1650. package/src/compiler/internal/project/readProjectConfig.ts +137 -200
  1651. package/src/compiler/internal/project/resolveOwningProjectConfig.ts +278 -0
  1652. package/src/compiler/internal/project/resolveProjectConfig.ts +18 -127
  1653. package/src/compiler/internal/project/resolveProjectIdentity.ts +153 -0
  1654. package/src/compiler/internal/project/resolveTsconfigExtends.ts +175 -0
  1655. package/src/compiler/internal/project/selectReferencedProject.ts +54 -0
  1656. package/src/compiler/internal/project/tsconfigExtendsFileCandidates.ts +54 -0
  1657. package/src/compiler/internal/readEffectiveCompilerOptions.ts +126 -0
  1658. package/src/compiler/internal/resolveBinary.ts +25 -9
  1659. package/src/compiler/internal/resolveTsgo.ts +31 -11
  1660. package/src/compiler/internal/runNativeCheckWithObservations.ts +211 -0
  1661. package/src/compiler/internal/runSingleFileEmit.ts +92 -27
  1662. package/src/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.ts +2 -0
  1663. package/src/compiler/internal/sharedHost/SidecarEnvironment.ts +151 -0
  1664. package/src/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.ts +7 -0
  1665. package/src/compiler/internal/sharedHost/TSGO_ARGS_ENV.ts +7 -0
  1666. package/src/compiler/internal/sharedHost/assertSharedHostCompatibility.ts +48 -0
  1667. package/src/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.ts +27 -0
  1668. package/src/compiler/internal/sharedHost/clearInheritedTsgoArgs.ts +41 -0
  1669. package/src/compiler/internal/sharedHost/inheritedSidecarEnv.ts +45 -0
  1670. package/src/compiler/internal/sharedHost/isLinkedTransform.ts +19 -0
  1671. package/src/compiler/internal/sharedHost/linkedTransformPlugins.ts +25 -0
  1672. package/src/compiler/internal/sharedHost/publishLinkedTransformPlugins.ts +42 -0
  1673. package/src/compiler/internal/sharedHost/resolvePluginConfigDir.ts +33 -0
  1674. package/src/compiler/internal/sharedHost/selectSharedHostPlugin.ts +35 -0
  1675. package/src/compiler/internal/spawnNative.ts +16 -39
  1676. package/src/compiler/internal/startResidentTransform.ts +66 -53
  1677. package/src/compiler/internal/transformProjectInMemory.ts +347 -635
  1678. package/src/compiler/internal/transformProjectInWorker.ts +170 -0
  1679. package/src/compiler/internal/transformProjectWorker.ts +43 -0
  1680. package/src/flags/AnySubcommand.ts +19 -0
  1681. package/src/flags/COMPILER_ENUM_WHITESPACE.ts +35 -0
  1682. package/src/flags/COMPILER_OPTIONS.ts +512 -0
  1683. package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +13 -0
  1684. package/src/flags/COMPILER_OPTION_KINDS.ts +14 -0
  1685. package/src/flags/CompilerOptionSpec.ts +30 -0
  1686. package/src/flags/FLAG_BY_TOKEN.ts +40 -0
  1687. package/src/flags/{schema.ts → FLAG_SCHEMA.ts} +43 -318
  1688. package/src/flags/FlagKind.ts +22 -0
  1689. package/src/flags/FlagLayer.ts +24 -0
  1690. package/src/flags/FlagSpec.ts +118 -0
  1691. package/src/flags/ParseOptions.ts +103 -0
  1692. package/src/flags/ParseResult.ts +44 -0
  1693. package/src/flags/TtscSubcommand.ts +22 -0
  1694. package/src/flags/TtsxSubcommand.ts +13 -0
  1695. package/src/flags/ValueValidator.ts +14 -0
  1696. package/src/flags/buildGoAllowList.ts +43 -0
  1697. package/src/flags/flagsForSubcommand.ts +22 -0
  1698. package/src/flags/getBoolean.ts +27 -0
  1699. package/src/flags/getNumber.ts +24 -0
  1700. package/src/flags/getString.ts +24 -0
  1701. package/src/flags/getStringList.ts +24 -0
  1702. package/src/flags/normalizeCompilerEnumValue.ts +41 -0
  1703. package/src/flags/normalizeFlagToken.ts +38 -0
  1704. package/src/flags/parseFlags.ts +371 -0
  1705. package/src/flags/readCompilerOptionOccurrence.ts +107 -0
  1706. package/src/flags/readCompilerOptionValues.ts +68 -0
  1707. package/src/flags/resolveFlagSpec.ts +29 -0
  1708. package/src/index.ts +9 -3
  1709. package/src/internal/CanonicalTempDirectoryOperations.ts +73 -0
  1710. package/src/internal/CompilerContextSnapshot.ts +139 -0
  1711. package/src/internal/CompilerResultAdapter.ts +320 -0
  1712. package/src/internal/E2ETrace.ts +674 -0
  1713. package/src/internal/IJavaScriptRuntimeCapabilities.ts +50 -0
  1714. package/src/internal/OwnedNativeProcess.ts +417 -0
  1715. package/src/internal/OwnedSynchronousProcess.ts +220 -0
  1716. package/src/internal/RetireLockDirectoryOperations.ts +81 -0
  1717. package/src/internal/SafeCacheCleanupTarget.ts +41 -0
  1718. package/src/internal/SourceNativeRetirement.ts +1109 -0
  1719. package/src/internal/SpawnSyncOutputFiles.ts +29 -0
  1720. package/src/internal/cacheEntryExists.ts +24 -0
  1721. package/src/internal/createCanonicalTempDirectory.ts +35 -18
  1722. package/src/internal/isContendedCandidateRename.ts +35 -0
  1723. package/src/internal/isSpawnSyncFdExhaustion.ts +19 -0
  1724. package/src/internal/javascriptRuntimeCapabilities.ts +166 -0
  1725. package/src/internal/nativeBinary.ts +11 -0
  1726. package/src/internal/parseWindowsDirectoryCaseSensitivity.ts +50 -0
  1727. package/src/internal/pathIdentity/FilesystemPathIdentity.ts +44 -0
  1728. package/src/internal/pathIdentity/FilesystemPathIdentityContext.ts +182 -0
  1729. package/src/internal/pathIdentity/FilesystemPathIdentityOperations.ts +106 -0
  1730. package/src/internal/pathIdentity/ProjectInputPathIdentity.ts +21 -0
  1731. package/src/internal/pathIdentity/ProjectInputPathIdentityContext.ts +21 -0
  1732. package/src/internal/pathIdentity/ProjectInputPathIdentityOperations.ts +22 -0
  1733. package/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts +437 -0
  1734. package/src/internal/pathIdentity/createProjectInputPathIdentityContext.ts +34 -0
  1735. package/src/internal/pathIdentity/isFilesystemPathIdentityWithin.ts +32 -0
  1736. package/src/internal/pathIdentity/isProjectInputPathIdentityWithin.ts +22 -0
  1737. package/src/internal/pathIdentity/resolveFilesystemPath.ts +43 -0
  1738. package/src/internal/pathIdentity/resolvePhysicalPath.ts +31 -0
  1739. package/src/internal/pathIdentity/resolveProjectInputPath.ts +18 -0
  1740. package/src/internal/pluginSource.ts +26 -0
  1741. package/src/internal/projectInputPathIdentity.ts +26 -387
  1742. package/src/internal/resolveNodeBinary.ts +13 -165
  1743. package/src/internal/resolveSafeCacheCleanupTargets.ts +51 -19
  1744. package/src/internal/restoreCompilerError.ts +175 -0
  1745. package/src/internal/retireLockDirectory.ts +166 -0
  1746. package/src/internal/runHoldingLock.ts +55 -0
  1747. package/src/internal/runtimeExecutableIdentity.ts +212 -0
  1748. package/src/internal/serializeCompilerError.ts +145 -0
  1749. package/src/internal/spawnSyncResilient.ts +36 -182
  1750. package/src/internal/spawnSyncWithLowDescriptors.ts +227 -0
  1751. package/src/internal/tsconfig.ts +16 -0
  1752. package/src/launcher/internal/PendingResidentCheckWatchChanges.ts +94 -0
  1753. package/src/launcher/internal/TtscBuildMode.ts +14 -0
  1754. package/src/launcher/internal/TtsxEntryOptions.ts +92 -0
  1755. package/src/launcher/internal/assertNoSolutionBuild.ts +17 -10
  1756. package/src/launcher/internal/assertTtsxNoWatch.ts +49 -0
  1757. package/src/launcher/internal/buildSingleRootProject.ts +303 -0
  1758. package/src/launcher/internal/getCompilerVersionText.ts +20 -5
  1759. package/src/launcher/internal/inlineServedSourceMap.ts +294 -0
  1760. package/src/launcher/internal/linkVirtualEntry.ts +88 -0
  1761. package/src/launcher/internal/{commonJsExportMetadata.ts → parseCommonJsExports.ts} +12 -2
  1762. package/src/launcher/internal/parseTtscBuildArgs.ts +103 -0
  1763. package/src/launcher/internal/parseTtsxCLI.ts +183 -0
  1764. package/src/launcher/internal/prepareExecution.ts +474 -362
  1765. package/src/launcher/internal/prepareTtscBuildMode.ts +64 -0
  1766. package/src/launcher/internal/resolveCacheDir.ts +12 -3
  1767. package/src/launcher/internal/resolveSingleFileOutput.ts +145 -0
  1768. package/src/launcher/internal/resolveTtscserverBinary.ts +20 -5
  1769. package/src/launcher/internal/runTtsc.ts +394 -326
  1770. package/src/launcher/internal/runTtsx.ts +349 -151
  1771. package/src/launcher/internal/runtime/CommonJsRuntimeSource.ts +365 -0
  1772. package/src/launcher/internal/runtime/DependencyBuildAdmission.ts +159 -0
  1773. package/src/launcher/internal/runtime/DependencyBuildGeneration.ts +236 -0
  1774. package/src/launcher/internal/runtime/DependencyBuildLockFence.ts +22 -0
  1775. package/src/launcher/internal/runtime/DependencyBuildLockLease.ts +22 -0
  1776. package/src/launcher/internal/runtime/DependencyBuildLockObservation.ts +49 -0
  1777. package/src/launcher/internal/runtime/DependencyBuildLockProtocol.ts +137 -0
  1778. package/src/launcher/internal/runtime/OwnedProjectSource.ts +140 -0
  1779. package/src/launcher/internal/runtime/OwningModuleOptions.ts +22 -0
  1780. package/src/launcher/internal/runtime/PluginDescriptorInputObservation.ts +112 -0
  1781. package/src/launcher/internal/runtime/ProcessOwnedDirectory.ts +325 -0
  1782. package/src/launcher/internal/runtime/ResolveResult.ts +26 -0
  1783. package/src/launcher/internal/runtime/RuntimeEmitProvenance.ts +58 -0
  1784. package/src/launcher/internal/runtime/RuntimeEntryPreparer.ts +23 -0
  1785. package/src/launcher/internal/runtime/RuntimeFilesystem.ts +64 -0
  1786. package/src/launcher/internal/runtime/RuntimeHookOptions.ts +23 -0
  1787. package/src/launcher/internal/runtime/RuntimeIsolatedEmit.ts +88 -0
  1788. package/src/launcher/internal/runtime/RuntimeLoaderCapabilities.ts +256 -0
  1789. package/src/launcher/internal/runtime/RuntimeManifest.ts +77 -0
  1790. package/src/launcher/internal/runtime/RuntimeManifestRegistry.ts +309 -0
  1791. package/src/launcher/internal/runtime/RuntimeModuleFormat.ts +275 -0
  1792. package/src/launcher/internal/runtime/RuntimeProjectOwnership.ts +139 -0
  1793. package/src/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.ts +11 -0
  1794. package/src/launcher/internal/runtime/acquireDependencyBuildLock.ts +97 -0
  1795. package/src/launcher/internal/runtime/checkNodeRuntimeSupport.ts +94 -0
  1796. package/src/launcher/internal/runtime/claimRuntimeProjectDirectory.ts +54 -0
  1797. package/src/launcher/internal/runtime/commonJsExportNames.ts +57 -0
  1798. package/src/launcher/internal/runtime/commonJsImportFacade.ts +62 -0
  1799. package/src/launcher/internal/runtime/dependencyCacheKey.ts +82 -0
  1800. package/src/launcher/internal/runtime/dependencyCacheRoot.ts +112 -0
  1801. package/src/launcher/internal/runtime/inspectDependencyBuildLock.ts +162 -0
  1802. package/src/launcher/internal/runtime/installRuntimeHooks.ts +2442 -0
  1803. package/src/launcher/internal/runtime/interopProbe.ts +8 -0
  1804. package/src/launcher/internal/runtime/isLocalProcessGone.ts +67 -0
  1805. package/src/launcher/internal/runtime/observeMappedDescriptorResolution.ts +74 -0
  1806. package/src/launcher/internal/runtime/projectModuleOptions.ts +28 -0
  1807. package/src/launcher/internal/runtime/readDependencyCache.ts +89 -0
  1808. package/src/launcher/internal/runtime/realPath.ts +30 -0
  1809. package/src/launcher/internal/runtime/reclaimDependencyBuildLock.ts +27 -0
  1810. package/src/launcher/internal/runtime/releaseDependencyBuildLock.ts +27 -0
  1811. package/src/launcher/internal/runtime/resolveRuntimeCleanTargets.ts +93 -0
  1812. package/src/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.ts +32 -0
  1813. package/src/launcher/internal/runtime/runtimeRunKey.ts +31 -0
  1814. package/src/launcher/internal/runtime/selectRuntimePluginPolicy.ts +28 -0
  1815. package/src/launcher/internal/runtime/withRuntimeDirectoryLock.ts +92 -0
  1816. package/src/launcher/internal/runtimeCompilerArgs.ts +91 -62
  1817. package/src/launcher/internal/runtimeEmitProfile.ts +70 -0
  1818. package/src/launcher/internal/runtimeHookPreload.ts +3 -3
  1819. package/src/launcher/internal/runtimeOwnerPreload.ts +43 -0
  1820. package/src/launcher/internal/singleRootProjectConfig.ts +38 -0
  1821. package/src/launcher/internal/ttscserver/ILSPPluginSelectionInputs.ts +65 -0
  1822. package/src/launcher/internal/ttscserver/LSPProjectInputDigest.ts +331 -0
  1823. package/src/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.ts +107 -0
  1824. package/src/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.ts +41 -0
  1825. package/src/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.ts +36 -0
  1826. package/src/launcher/internal/ttscserver/materializeLSPPluginManifest.ts +60 -0
  1827. package/src/launcher/internal/ttscserver/needsStdio.ts +32 -0
  1828. package/src/launcher/internal/ttscserver/runTtscserver.ts +592 -0
  1829. package/src/launcher/internal/watch/CompilerDirectoryWatchEventPlan.ts +31 -0
  1830. package/src/launcher/internal/watch/DirectoryWatcher.ts +45 -0
  1831. package/src/launcher/internal/watch/FseventsStreams.ts +303 -0
  1832. package/src/launcher/internal/watch/ProjectInputWatchRules.ts +179 -0
  1833. package/src/launcher/internal/watch/WatchInputChange.ts +31 -0
  1834. package/src/launcher/internal/watch/WatchPaths.ts +156 -0
  1835. package/src/launcher/internal/{watchTopology.ts → watch/WatchTopology.ts} +867 -962
  1836. package/src/launcher/internal/watch/literalGlobRoot.ts +40 -0
  1837. package/src/launcher/internal/watch/planCompilerDirectoryWatchEvent.ts +83 -0
  1838. package/src/launcher/internal/watch/projectInputActiveWatchDirectories.ts +47 -0
  1839. package/src/launcher/internal/watch/projectInputAvailableWatchDirectory.ts +56 -0
  1840. package/src/launcher/internal/watch/projectInputEventShouldNotify.ts +23 -0
  1841. package/src/launcher/internal/watch/projectInputMembershipInvalidatesProgram.ts +63 -0
  1842. package/src/launcher/internal/watch/projectInputReloadEventShouldNotify.ts +127 -0
  1843. package/src/launcher/internal/watch/projectInputReplacementStrandsWatchers.ts +57 -0
  1844. package/src/launcher/internal/watch/projectInputTopologyMayAffect.ts +73 -0
  1845. package/src/launcher/internal/watch/projectInputWatchDirectories.ts +33 -0
  1846. package/src/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.ts +49 -0
  1847. package/src/launcher/internal/watch/syncWatchers.ts +64 -0
  1848. package/src/launcher/internal/watch/watchDirectory.ts +53 -0
  1849. package/src/launcher/internal/watch/watchDirectoryThroughFsWatch.ts +47 -0
  1850. package/src/launcher/ttscserver.ts +1 -1
  1851. package/src/launcher/ttsx.ts +2 -3
  1852. package/src/plugin/CapabilityPluginResolver.ts +549 -0
  1853. package/src/plugin/ITtscCapabilityPlugin.ts +93 -0
  1854. package/src/plugin/internal/CapabilityPluginResult.ts +99 -0
  1855. package/src/plugin/internal/CapabilityResolutionFormat.ts +248 -0
  1856. package/src/plugin/internal/ITtscCapabilityPluginSource.ts +37 -0
  1857. package/src/plugin/internal/ITtscCapabilityResolutionEntry.ts +57 -0
  1858. package/src/plugin/internal/ITtscCapabilityResolutionPlugin.ts +22 -0
  1859. package/src/plugin/internal/capabilityPluginWorker.ts +216 -0
  1860. package/src/plugin/internal/decodeCapabilityCommandReply.ts +27 -0
  1861. package/src/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.ts +182 -0
  1862. package/src/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.ts +59 -0
  1863. package/src/plugin/internal/load/PluginDescriptorAdmission.ts +75 -0
  1864. package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +432 -0
  1865. package/src/plugin/internal/load/PluginPackageResolution.ts +711 -0
  1866. package/src/plugin/internal/load/ProjectPluginEntries.ts +232 -0
  1867. package/src/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.ts +34 -0
  1868. package/src/plugin/internal/load/collectProjectHostInputs.ts +88 -0
  1869. package/src/plugin/internal/load/composePluginSources.ts +121 -0
  1870. package/src/plugin/internal/load/declaresHostInputReads.ts +52 -0
  1871. package/src/plugin/internal/load/hasProjectPluginEntries.ts +33 -0
  1872. package/src/plugin/internal/load/hashHostInputPaths.ts +44 -0
  1873. package/src/plugin/internal/load/isRelativePluginSpecifier.ts +31 -0
  1874. package/src/plugin/internal/load/loadProjectPlugins.ts +2242 -0
  1875. package/src/plugin/internal/load/moduleResolutionBaseSelects.ts +59 -0
  1876. package/src/plugin/internal/load/observeImportSearchRoots.ts +42 -0
  1877. package/src/plugin/internal/load/pluginLabel.ts +28 -0
  1878. package/src/plugin/internal/load/realpathHostInput.ts +22 -0
  1879. package/src/plugin/internal/load/realpathHostInputPaths.ts +27 -0
  1880. package/src/plugin/internal/load/rejectJsTransformFunctions.ts +23 -0
  1881. package/src/plugin/internal/load/requirePluginSource.ts +34 -0
  1882. package/src/plugin/internal/load/resolveNativeSource.ts +42 -0
  1883. package/src/plugin/internal/load/validatePluginContributors.ts +102 -0
  1884. package/src/plugin/internal/load/validatePluginSource.ts +19 -0
  1885. package/src/plugin/internal/load/visitImportMappedCandidates.ts +63 -0
  1886. package/src/plugin/internal/pluginDescriptorFailureReason.ts +35 -0
  1887. package/src/plugin/internal/pluginDescriptorProcessFailure.ts +48 -0
  1888. package/src/plugin/internal/readCapabilityResolution.ts +193 -0
  1889. package/src/plugin/internal/receiveCapabilityFailure.ts +27 -0
  1890. package/src/plugin/internal/source/CachePrunePolicy.ts +47 -0
  1891. package/src/plugin/internal/source/GoBuildCacheCoordination.ts +588 -0
  1892. package/src/plugin/internal/source/GoSourceInputs.ts +182 -0
  1893. package/src/plugin/internal/source/GoToolResolution.ts +312 -0
  1894. package/src/plugin/internal/source/IGoBuildCachePruneOptions.ts +34 -0
  1895. package/src/plugin/internal/source/IPluginCachePruneOptions.ts +38 -0
  1896. package/src/plugin/internal/source/IPluginModuleReplaceDirectory.ts +30 -0
  1897. package/src/plugin/internal/source/ITtscBuildContributor.ts +19 -0
  1898. package/src/plugin/internal/source/ITtscSourceBuildCachePaths.ts +28 -0
  1899. package/src/plugin/internal/source/NativeSourcePackages.ts +368 -0
  1900. package/src/plugin/internal/source/PluginBinaryUse.ts +159 -0
  1901. package/src/plugin/internal/source/PluginBinaryWaitResult.ts +34 -0
  1902. package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +231 -0
  1903. package/src/plugin/internal/source/PluginBuildEnvironmentWitness.ts +233 -0
  1904. package/src/plugin/internal/source/PluginBuildLockFence.ts +26 -0
  1905. package/src/plugin/internal/source/PluginBuildLockLease.ts +31 -0
  1906. package/src/plugin/internal/source/PluginBuildLockObservation.ts +48 -0
  1907. package/src/plugin/internal/source/PluginBuildLockOwner.ts +225 -0
  1908. package/src/plugin/internal/source/PluginBuildLockProtocol.ts +342 -0
  1909. package/src/plugin/internal/source/SourceBuildCacheLayout.ts +303 -0
  1910. package/src/plugin/internal/source/SourceBuildFilesystemOperations.ts +32 -0
  1911. package/src/plugin/internal/source/SourcePluginAdmission.ts +127 -0
  1912. package/src/plugin/internal/source/SourcePluginWorkspace.ts +446 -0
  1913. package/src/plugin/internal/source/acquirePluginBuildLock.ts +222 -0
  1914. package/src/plugin/internal/source/autoQuoteGoModToken.ts +113 -0
  1915. package/src/plugin/internal/source/buildSourcePlugin.ts +1197 -0
  1916. package/src/plugin/internal/source/collectPluginSourceDirectories.ts +70 -0
  1917. package/src/plugin/internal/source/collectPluginSourceFiles.ts +90 -0
  1918. package/src/plugin/internal/source/computeCacheKey.ts +190 -0
  1919. package/src/plugin/internal/source/copiesPluginSourceEntry.ts +52 -0
  1920. package/src/plugin/internal/source/createExternalSourceSnapshotLayout.ts +66 -0
  1921. package/src/plugin/internal/source/ensureExecutableGoToolchain.ts +87 -0
  1922. package/src/plugin/internal/source/formatDuration.ts +32 -0
  1923. package/src/plugin/internal/source/formatGoWorkPath.ts +42 -0
  1924. package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +803 -0
  1925. package/src/plugin/internal/source/inspectPluginBuildLock.ts +330 -0
  1926. package/src/plugin/internal/source/isPathWithin.ts +24 -0
  1927. package/src/plugin/internal/source/legacyGlobalCacheTargets.ts +71 -0
  1928. package/src/plugin/internal/source/pluginBuildEnvironment.ts +59 -0
  1929. package/src/plugin/internal/source/pluginBuildEnvironmentWorker.ts +30 -0
  1930. package/src/plugin/internal/source/pluginBuildVersions.ts +75 -0
  1931. package/src/plugin/internal/source/pluginModuleReplaceDirectories.ts +96 -0
  1932. package/src/plugin/internal/source/pluginSourceCovers.ts +54 -0
  1933. package/src/plugin/internal/source/pluginSourceDigest.ts +55 -0
  1934. package/src/plugin/internal/source/pluginSourceFilesSignature.ts +54 -0
  1935. package/src/plugin/internal/source/pluginSourceState.ts +69 -0
  1936. package/src/plugin/internal/source/pluginSourceStateHolds.ts +45 -0
  1937. package/src/plugin/internal/source/processPluginBuildEnvironment.ts +40 -0
  1938. package/src/plugin/internal/source/pruneCacheFileRoot.ts +134 -0
  1939. package/src/plugin/internal/source/pruneGoBuildCacheRoot.ts +228 -0
  1940. package/src/plugin/internal/source/prunePluginCacheRoot.ts +507 -0
  1941. package/src/plugin/internal/source/prunesPluginSourceDirectory.ts +25 -0
  1942. package/src/plugin/internal/source/reclaimPluginBuildLock.ts +63 -0
  1943. package/src/plugin/internal/source/recordCacheFileUse.ts +35 -0
  1944. package/src/plugin/internal/source/releasePluginBuildLock.ts +125 -0
  1945. package/src/plugin/internal/source/resolveCleanTargets.ts +84 -0
  1946. package/src/plugin/internal/source/resolveGoCompiler.ts +92 -0
  1947. package/src/plugin/internal/source/resolvePluginCacheRoot.ts +32 -0
  1948. package/src/plugin/internal/source/resolvePluginGoModule.ts +69 -0
  1949. package/src/plugin/internal/source/resolveSourceBuildCachePaths.ts +276 -0
  1950. package/src/plugin/internal/source/selectPluginModuleReplaceDirectories.ts +80 -0
  1951. package/src/plugin/internal/source/spawnGoTool.ts +204 -0
  1952. package/src/plugin/internal/source/touchPluginCacheEntryInUse.ts +44 -0
  1953. package/src/plugin/internal/source/waitForPluginBinary.ts +123 -0
  1954. package/src/plugin/internal/source/windowsGoCommandArgs.ts +19 -0
  1955. package/src/plugin/internal/source/withGoBuildCacheLease.ts +101 -0
  1956. package/src/plugin/internal/writeCapabilityResolution.ts +266 -0
  1957. package/src/plugin/resolveCapabilityPlugins.ts +242 -77
  1958. package/src/register.ts +20 -7
  1959. package/src/structures/ITtscCompilerContext.ts +29 -11
  1960. package/src/structures/ITtscCompilerDiagnostic.ts +24 -7
  1961. package/src/structures/ITtscCompilerResult.ts +75 -25
  1962. package/src/structures/ITtscCompilerTransformation.ts +304 -64
  1963. package/src/structures/ITtscPlugin.ts +24 -8
  1964. package/src/structures/ITtscPluginCapabilities.ts +58 -5
  1965. package/src/structures/ITtscPluginContributor.ts +19 -8
  1966. package/src/structures/ITtscPluginFactoryContext.ts +12 -3
  1967. package/src/structures/ITtscProjectPluginConfig.ts +35 -10
  1968. package/src/structures/TtscPluginStage.ts +9 -0
  1969. package/src/structures/internal/ITtscLoadedNativePlugin.ts +27 -5
  1970. package/src/structures/internal/ITtscParsedProjectConfig.ts +37 -3
  1971. package/src/structures/internal/ITtscProjectIdentity.ts +27 -6
  1972. package/src/structures/internal/ITtscProjectInputSnapshot.ts +31 -8
  1973. package/src/structures/internal/ITtscProjectLocatorOptions.ts +21 -4
  1974. package/src/structures/internal/TtscBuildOptions.ts +38 -14
  1975. package/src/structures/internal/TtscBuildResult.ts +74 -4
  1976. package/src/structures/internal/TtscCommonOptions.ts +59 -14
  1977. package/src/structures/internal/TtscSingleFileEmitOptions.ts +55 -5
  1978. package/tools/gen_shims/main.go +124 -11
  1979. package/tools/gen_shims/package_load_admission_rejects_incomplete_results_test.go +61 -0
  1980. package/tools/gen_shims/private_field_support_preserves_upstream_layout_test.go +104 -0
  1981. package/tools/shim_audit/enum_generation_preserves_existing_family_members_test.go +182 -0
  1982. package/tools/shim_audit/enum_generation_refuses_removed_public_members_test.go +93 -0
  1983. package/tools/shim_audit/main.go +166 -31
  1984. package/tools/shim_audit/main_test.go +35 -0
  1985. package/tools/shim_audit/producer_exemptions_require_rationale_test.go +5 -0
  1986. package/tools/shim_audit/producer_surface_includes_exposed_methods_test.go +5 -0
  1987. package/tools/shim_audit/producer_surface_rejects_unproducible_reference_test.go +5 -0
  1988. package/tools/shim_audit/shim_dir_coverage_rejects_unregistered_shims_test.go +71 -0
  1989. package/utility/command.go +48 -0
  1990. package/utility/flags_gen.go +2 -2
  1991. package/utility/host.go +282 -66
  1992. package/utility/preamble_output.go +245 -0
  1993. package/utility/preamble_output_test.go +90 -0
  1994. package/utility/serve.go +61 -18
  1995. package/cmd/ttscgraph/serve_graph_snapshot_version_matches_typescript_client_test.go +0 -32
  1996. package/cmd/ttscgraph/serve_protocol_version_matches_the_typescript_client_test.go +0 -48
  1997. package/cmd/ttscgraph/serve_session_retries_failed_dump_test.go +0 -103
  1998. package/internal/graph/dump_schema_version_matches_the_typescript_client_test.go +0 -48
  1999. package/internal/graph/edge_kinds_names_every_declared_kind_test.go +0 -49
  2000. package/internal/graph/graph_kind_contracts_match_their_producers_test.go +0 -121
  2001. package/internal/lspserver/lsp_launcher_reload_directory_fingerprint_parity_windows_test.go +0 -94
  2002. package/internal/lspserver/lsp_project_diagnostics_resident_unsupported_falls_back_test.go +0 -123
  2003. package/lib/compiler/internal/paths.d.ts +0 -27
  2004. package/lib/compiler/internal/paths.js +0 -70
  2005. package/lib/compiler/internal/paths.js.map +0 -1
  2006. package/lib/compiler/internal/project/readConfigJson.d.ts +0 -30
  2007. package/lib/compiler/internal/project/readConfigJson.js +0 -208
  2008. package/lib/compiler/internal/project/readConfigJson.js.map +0 -1
  2009. package/lib/compiler/internal/residentCheckProcess.d.ts +0 -44
  2010. package/lib/compiler/internal/residentCheckProcess.js +0 -213
  2011. package/lib/compiler/internal/residentCheckProcess.js.map +0 -1
  2012. package/lib/compiler/internal/residentTransformProcess.d.ts +0 -65
  2013. package/lib/compiler/internal/residentTransformProcess.js +0 -330
  2014. package/lib/compiler/internal/residentTransformProcess.js.map +0 -1
  2015. package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +0 -25
  2016. package/lib/compiler/internal/resolveEmittedJavaScript.js +0 -165
  2017. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +0 -1
  2018. package/lib/compiler/internal/runBuild.d.ts +0 -152
  2019. package/lib/compiler/internal/runBuild.js +0 -1694
  2020. package/lib/compiler/internal/runBuild.js.map +0 -1
  2021. package/lib/compiler/internal/sharedHostHelpers.d.ts +0 -79
  2022. package/lib/compiler/internal/sharedHostHelpers.js +0 -134
  2023. package/lib/compiler/internal/sharedHostHelpers.js.map +0 -1
  2024. package/lib/flags/parser.d.ts +0 -97
  2025. package/lib/flags/parser.js +0 -293
  2026. package/lib/flags/parser.js.map +0 -1
  2027. package/lib/flags/schema.d.ts +0 -191
  2028. package/lib/flags/schema.js.map +0 -1
  2029. package/lib/internal/windowsDirectoryCaseSensitivity.d.ts +0 -10
  2030. package/lib/internal/windowsDirectoryCaseSensitivity.js +0 -34
  2031. package/lib/internal/windowsDirectoryCaseSensitivity.js.map +0 -1
  2032. package/lib/launcher/internal/commonJsExportMetadata.d.ts +0 -7
  2033. package/lib/launcher/internal/commonJsExportMetadata.js.map +0 -1
  2034. package/lib/launcher/internal/registerRuntimeHooks.js +0 -59
  2035. package/lib/launcher/internal/registerRuntimeHooks.js.map +0 -1
  2036. package/lib/launcher/internal/runTtscserver.d.ts +0 -35
  2037. package/lib/launcher/internal/runTtscserver.js +0 -661
  2038. package/lib/launcher/internal/runTtscserver.js.map +0 -1
  2039. package/lib/launcher/internal/runtimeHooks.d.ts +0 -198
  2040. package/lib/launcher/internal/runtimeHooks.js +0 -2579
  2041. package/lib/launcher/internal/runtimeHooks.js.map +0 -1
  2042. package/lib/launcher/internal/servedSourceMap.d.ts +0 -25
  2043. package/lib/launcher/internal/servedSourceMap.js +0 -164
  2044. package/lib/launcher/internal/servedSourceMap.js.map +0 -1
  2045. package/lib/launcher/internal/singleFileOutput.d.ts +0 -16
  2046. package/lib/launcher/internal/singleFileOutput.js +0 -103
  2047. package/lib/launcher/internal/singleFileOutput.js.map +0 -1
  2048. package/lib/launcher/internal/watchTopology.d.ts +0 -329
  2049. package/lib/launcher/internal/watchTopology.js.map +0 -1
  2050. package/lib/plugin/internal/buildSourcePlugin.d.ts +0 -298
  2051. package/lib/plugin/internal/buildSourcePlugin.js +0 -3087
  2052. package/lib/plugin/internal/buildSourcePlugin.js.map +0 -1
  2053. package/lib/plugin/internal/capabilityResolutionCache.d.ts +0 -76
  2054. package/lib/plugin/internal/capabilityResolutionCache.js +0 -224
  2055. package/lib/plugin/internal/capabilityResolutionCache.js.map +0 -1
  2056. package/lib/plugin/internal/descriptorProcessFailure.d.ts +0 -36
  2057. package/lib/plugin/internal/descriptorProcessFailure.js +0 -62
  2058. package/lib/plugin/internal/descriptorProcessFailure.js.map +0 -1
  2059. package/lib/plugin/internal/loadProjectPlugins.d.ts +0 -75
  2060. package/lib/plugin/internal/loadProjectPlugins.js +0 -2405
  2061. package/lib/plugin/internal/loadProjectPlugins.js.map +0 -1
  2062. package/src/compiler/internal/paths.ts +0 -68
  2063. package/src/compiler/internal/project/readConfigJson.ts +0 -209
  2064. package/src/compiler/internal/residentCheckProcess.ts +0 -259
  2065. package/src/compiler/internal/residentTransformProcess.ts +0 -406
  2066. package/src/compiler/internal/resolveEmittedJavaScript.ts +0 -197
  2067. package/src/compiler/internal/runBuild.ts +0 -2345
  2068. package/src/compiler/internal/sharedHostHelpers.ts +0 -154
  2069. package/src/flags/parser.ts +0 -459
  2070. package/src/internal/windowsDirectoryCaseSensitivity.ts +0 -33
  2071. package/src/launcher/internal/registerRuntimeHooks.ts +0 -68
  2072. package/src/launcher/internal/runTtscserver.ts +0 -842
  2073. package/src/launcher/internal/runtimeHooks.ts +0 -3197
  2074. package/src/launcher/internal/servedSourceMap.ts +0 -183
  2075. package/src/launcher/internal/singleFileOutput.ts +0 -133
  2076. package/src/plugin/internal/buildSourcePlugin.ts +0 -3993
  2077. package/src/plugin/internal/capabilityResolutionCache.ts +0 -305
  2078. package/src/plugin/internal/descriptorProcessFailure.ts +0 -69
  2079. package/src/plugin/internal/loadProjectPlugins.ts +0 -3073
  2080. package/tools/shim_audit/shim_dir_coverage_test.go +0 -25
  2081. /package/lib/{launcher/internal/registerRuntimeHooks.d.ts → compiler/internal/transformProjectWorker.d.ts} +0 -0
@@ -2,84 +2,70 @@ import crypto from "node:crypto";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
 
5
- import { readJsoncFile } from "../../compiler/internal/project/readConfigJson";
6
- import { readProjectConfig } from "../../compiler/internal/project/readProjectConfig";
7
- import { resolveTsgo } from "../../compiler/internal/resolveTsgo";
8
- import { outputText, spawnNative } from "../../compiler/internal/spawnNative";
9
- import { resolveFlagSpec } from "../../flags/schema";
10
- import {
11
- type ProjectInputPathIdentity,
12
- type ProjectInputPathIdentityContext,
13
- createProjectInputPathIdentityContext,
14
- isProjectInputPathIdentityWithin,
15
- resolveProjectInputPath,
16
- } from "../../internal/projectInputPathIdentity";
17
- import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscParsedProjectConfig";
18
- import type { ITtscProjectInputSnapshot } from "../../structures/internal/ITtscProjectInputSnapshot";
19
- import type { TtscBuildOptions } from "../../structures/internal/TtscBuildOptions";
20
- import { resolveSingleFileOutput } from "./singleFileOutput";
21
-
22
- type WatchTopologyOptions = Pick<
23
- TtscBuildOptions,
24
- | "binary"
25
- | "emit"
26
- | "env"
27
- | "outDir"
28
- | "passthrough"
29
- | "projectRoot"
30
- | "tsconfig"
31
- > & {
32
- cwd: string;
33
- files: readonly string[];
34
- };
35
-
36
- type WatchTopologyCallbacks = {
37
- onError(location: string, error: unknown): void;
38
- onInputChange(change: WatchInputChange): void;
39
- onProjectInputWatchUnavailable?(roots: readonly string[]): void;
40
- onProjectInputWatchRoots?(roots: readonly string[]): void;
41
- onTopologyChange(): void;
42
- };
43
-
44
- export type WatchInputChange = {
45
- /** Keep the resident process but cold-load its compiler Program. */
46
- invalidate?: boolean;
47
- kind: "compiler" | "config" | "plugin" | "project";
48
- path?: string;
49
- };
50
-
51
- type ResolvedWatchTopology = {
52
- analysisOnly: boolean;
53
- directories: Map<string, string>;
54
- files: Map<string, string>;
55
- outputFiles: Map<string, string>;
56
- outputs: Map<string, string>;
57
- reloadFiles: Map<string, string>;
58
- };
59
-
60
- type CompilerFileSnapshot = {
61
- content: string;
62
- owner: string;
63
- };
64
-
65
- type CompilerFileMovement = {
66
- content: boolean;
67
- owner: boolean;
68
- };
69
-
70
- export type CompilerDirectoryWatchEventPlan = {
71
- changes: string[];
72
- rearm: string[];
73
- refresh: boolean;
74
- };
5
+ import { outputText } from "../../../compiler/internal/outputText";
6
+ import { CompilerProjectSelection } from "../../../compiler/internal/project/CompilerProjectSelection";
7
+ import { readJsoncFile } from "../../../compiler/internal/project/readJsoncFile";
8
+ import { readProjectConfig } from "../../../compiler/internal/project/readProjectConfig";
9
+ import { resolveTsgo } from "../../../compiler/internal/resolveTsgo";
10
+ import { spawnNative } from "../../../compiler/internal/spawnNative";
11
+ import { normalizeCompilerEnumValue } from "../../../flags/normalizeCompilerEnumValue";
12
+ import { readCompilerOptionValues } from "../../../flags/readCompilerOptionValues";
13
+ import { type ProjectInputPathIdentityContext } from "../../../internal/pathIdentity/ProjectInputPathIdentityContext";
14
+ import { createProjectInputPathIdentityContext } from "../../../internal/pathIdentity/createProjectInputPathIdentityContext";
15
+ import { isProjectInputPathIdentityWithin } from "../../../internal/pathIdentity/isProjectInputPathIdentityWithin";
16
+ import { resolveProjectInputPath } from "../../../internal/pathIdentity/resolveProjectInputPath";
17
+ import { collectPluginSourceDirectories } from "../../../plugin/internal/source/collectPluginSourceDirectories";
18
+ import { pluginSourceCovers } from "../../../plugin/internal/source/pluginSourceCovers";
19
+ import { pluginSourceDigest } from "../../../plugin/internal/source/pluginSourceDigest";
20
+ import { prunesPluginSourceDirectory } from "../../../plugin/internal/source/prunesPluginSourceDirectory";
21
+ import type { ITtscParsedProjectConfig } from "../../../structures/internal/ITtscParsedProjectConfig";
22
+ import type { ITtscProjectInputSnapshot } from "../../../structures/internal/ITtscProjectInputSnapshot";
23
+ import type { TtscBuildOptions } from "../../../structures/internal/TtscBuildOptions";
24
+ import { resolveSingleFileOutput } from "../resolveSingleFileOutput";
25
+ import type { DirectoryWatcher } from "./DirectoryWatcher";
26
+ import { ProjectInputWatchRules } from "./ProjectInputWatchRules";
27
+ import type { WatchInputChange } from "./WatchInputChange";
28
+ import { WatchPaths } from "./WatchPaths";
29
+ import { literalGlobRoot } from "./literalGlobRoot";
30
+ import { planCompilerDirectoryWatchEvent } from "./planCompilerDirectoryWatchEvent";
31
+ import { projectInputActiveWatchDirectories } from "./projectInputActiveWatchDirectories";
32
+ import { projectInputAvailableWatchDirectory } from "./projectInputAvailableWatchDirectory";
33
+ import { projectInputEventShouldNotify } from "./projectInputEventShouldNotify";
34
+ import { projectInputMembershipInvalidatesProgram } from "./projectInputMembershipInvalidatesProgram";
35
+ import { projectInputReloadEventShouldNotify } from "./projectInputReloadEventShouldNotify";
36
+ import { projectInputReplacementStrandsWatchers } from "./projectInputReplacementStrandsWatchers";
37
+ import { projectInputTopologyMayAffect } from "./projectInputTopologyMayAffect";
38
+ import { reloadInputsForFailedTopologyRefresh } from "./reloadInputsForFailedTopologyRefresh";
39
+ import { syncWatchers } from "./syncWatchers";
40
+ import { watchDirectory } from "./watchDirectory";
75
41
 
76
42
  /**
77
43
  * Keeps the launcher watch set aligned with the compiler's current program.
78
44
  *
79
- * TypeScript-Go's `--listFilesOnly` output is the authority for source and
80
- * declaration inputs. Configuration files, project-reference roots, and the
81
- * source trees of selected native plugins supplement that list, while compiler
82
- * outputs are filtered before any watcher is installed.
45
+ * The default compiler-input reader uses TypeScript-Go's `--listFilesOnly`
46
+ * output for source and declaration membership. An explicit reader supplies the
47
+ * same absolute-path membership and failure contract for each resolved project.
48
+ * Configuration files, project-reference roots, output inference and native
49
+ * filesystem identity remain this topology's responsibility.
50
+ * Response frames are observed once per project refresh at its compiler cwd;
51
+ * that option view serves all project-output queries while the original argv
52
+ * reaches compiler membership. A second observation rejects response changes
53
+ * across membership resolution. Response files join the config reload set;
54
+ * these observations do not pin files or detect a change restored in between.
55
+ *
56
+ * `TTSC_WATCH_DEBUG_INPUTS` reports the named event, observed population deltas
57
+ * and reload decision. These diagnostics reuse the decision's existing inputs;
58
+ * they perform no extra filesystem observations.
59
+ *
60
+ * @evidence contracts/common.md#principled-implementation The compiler-input operation's membership, published rule inputs and actual content fingerprints qualify notifications; its native default obtains the real compiler list. Post-registration reconciliation compares baselines to recover observed handoff changes, not an atomic guarantee against every transient mutation. Explicit operations preserve native defaults without replacing global filesystem or compiler methods. Project-input attribution: Observed member deltas establish attribution; stale selected names cannot override them, while directory names retain supported population causality and unrelated multiple members remain unnamed.
61
+ * @evidence contracts/common.md#clear-and-simple-design Compiler, plugin and project-input watch populations keep their own baselines and callbacks under one topology owner; small classifiers separate membership, selection and handle replacement. Four distinct operations own directory subscriptions, file subscriptions, immediate reload-directory reads and compiler membership; existing callers need no new argument. Project-input attribution: One private reconciliation separates member deltas from immediate resolution-directory digests before choosing a supported event name or an observed single member.
62
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported native backends and explicit gap/replacement ownership replace foreign watcher patching; failed observation is reported rather than represented as complete coverage. The constructor manufactures no observations and bypasses no input or content proof; supplied operations retain the existing callback and result contracts. Project-input attribution: Native event names do not manufacture a delta; the current and previous physical membership identify already observed names without filename or fixture exceptions.
63
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain membership authority, plugin fingerprinting, publication races, physical registration and public lifecycle operations following the documentation skill. Parameters identify each supplied operation and native default beside the constructor. Project-input attribution: Native paragraphs explain stale attention, directory causality, accompanying resolution digests and unselected immediate entries.
64
+ * @evidence contracts/portability.md#os-neutral-implementation Native paths use Node APIs and registration uses realpath; compiler/plugin maps preserve lexical aliases and fold only measured insensitive ASCII components. Project inputs use physical identities, while unknown/native Unicode relations remain conservative event candidates rather than identity proof. Registration paths and read options are passed unchanged; compiler-input readers supply absolute membership paths without replacing the topology's native identity policy. Project-input attribution: The supplied filesystem identity transaction establishes selected names and ancestry without an OS-wide case assumption or lexical alias guess.
65
+ *
66
+ * @evidence contracts/performance.md#efficient-algorithms Identity-keyed maps separate membership, baselines and handle registries; reconciliation delegates project/config discovery, native compiler listing, filesystem traversal/hashing and backend callbacks, with costs described by its members. Construction retains operation references and empty indexes without a filesystem observation or build. Attribution indexed visits additionally pay path/key text, ancestor and native identity work; shared ancestor keys avoid repeating the same walk within a transaction.
67
+ * @evidence contracts/performance.md#reuse-equivalent-work Current membership, content baselines and live registrations belong to one topology; reconciliation owners decide their reuse against fresh premises. Supplied operation identities are retained without adding an observation-result cache or assuming changed inputs remain equivalent. Project-input attribution: This classifier borrows one scan's deltas and identity transaction without retaining cross-event answers.
68
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Current and pending maps and live subscriptions remain topology-owned without a population cap; reconciliation attempts obsolete handle retirement. Constructor acquires no handle; directory arrays and attribution deltas are call-local. close invokes supplied close methods but does not await backend closure, and a thrown close can interrupt later map cleanup; retained snapshots remain until the facade is released.
83
69
  */
84
70
  export class WatchTopology {
85
71
  private analysisOnly = false;
@@ -88,11 +74,31 @@ export class WatchTopology {
88
74
  private compilerPostRegistrationReconciliationScheduled = false;
89
75
  private compilerPostRegistrationSkipUnobservedProjectInputWatchRoots = true;
90
76
  private directories = new Map<string, string>();
91
- private directoryWatchers = new Map<string, fs.FSWatcher>();
77
+ private directoryWatchers = new Map<string, DirectoryWatcher>();
92
78
  private extraInputs: readonly string[] = [];
93
- private extraWatchers = new Map<string, fs.FSWatcher>();
79
+
80
+ /**
81
+ * What each plugin input held when last observed, by path key: the digest a
82
+ * plugin build keys it on (`pluginInputState`). A notification about an input
83
+ * whose state did not move is not a plugin change.
84
+ */
85
+ private pluginInputStates = new Map<string, string>();
86
+
87
+ /**
88
+ * The plugin inputs notifications named since the last decision, by path key,
89
+ * each with the locations noted for it (`notePluginNotification`).
90
+ */
91
+ private pendingPluginNotifications = new Map<string, Set<string>>();
92
+ private pluginNotificationsScheduled = false;
93
+ private extraWatchers = new Map<string, DirectoryWatcher>();
94
+
95
+ /** The plugin inputs whose directories the last sync already watched. */
96
+ private watchedExtraInputs = new Set<string>();
94
97
  private compilerFileSnapshots = new Map<string, CompilerFileSnapshot>();
95
98
  private files = new Map<string, string>();
99
+ private lexicalIdentities = createProjectInputPathIdentityContext({
100
+ throwOnRealpathError: false,
101
+ });
96
102
  private fileWatchers = new Map<string, fs.FSWatcher>();
97
103
  private observedDirectories = new Map<string, string>();
98
104
  private outputFiles = new Map<string, string>();
@@ -119,21 +125,53 @@ export class WatchTopology {
119
125
  private projectInputRequiredWatchRoots = new Map<string, string>();
120
126
  private projectInputUnobservedWatchRoots = new Map<string, string>();
121
127
  private projectInputWatchRoots = new Map<string, string>();
122
- private projectInputWatchers = new Map<string, fs.FSWatcher>();
123
- private projectInputLinkWatchers = new Map<string, fs.FSWatcher>();
128
+ private projectInputWatchers = new Map<string, DirectoryWatcher>();
129
+ private projectInputLinkWatchers = new Map<string, DirectoryWatcher>();
124
130
  private projectInputCompilerOutputOverlaps = new WeakMap<
125
131
  ProjectInputPathIdentityContext,
126
132
  Map<string, boolean>
127
133
  >();
128
- private projectInputCompilerAcknowledgements = new Map<string, string>();
129
134
  private reloadFiles = new Map<string, string>();
130
135
 
136
+ /**
137
+ * @param options What to watch.
138
+ * @param callbacks What to tell about it.
139
+ * @param openDirectoryWatch The backend every directory watch goes through:
140
+ * `watchDirectory`, which chooses the platform's, unless the caller
141
+ * observes the watch set through another.
142
+ * @param openFileWatch File subscriptions use this owned observer; native
143
+ * fs.watch by default.
144
+ * @param readDirectory Immediate reload-directory fingerprints use this
145
+ * reader; native readdirSync by default.
146
+ * @param getCompilerInputs Read each resolved project's absolute compiler
147
+ * membership; the default invokes the native compiler. Readers throw
148
+ * listing failures and retain ownership of their returned array, which this
149
+ * topology does not mutate.
150
+ */
131
151
  public constructor(
132
152
  private readonly options: WatchTopologyOptions,
133
153
  private readonly callbacks: WatchTopologyCallbacks,
154
+ private readonly openDirectoryWatch: typeof watchDirectory = watchDirectory,
155
+ private readonly openFileWatch: typeof fs.watch = fs.watch,
156
+ private readonly readDirectory: typeof fs.readdirSync = fs.readdirSync,
157
+ private readonly getCompilerInputs: typeof listCompilerInputs = listCompilerInputs,
134
158
  ) {}
135
159
 
136
- /** Re-resolve compiler inputs and notify only when their membership changed. */
160
+ /**
161
+ * Re-resolve compiler inputs and notify when the resolved topology changes,
162
+ * including membership, output/configuration or analysis-mode changes. Errors
163
+ * propagate to the caller; native watcher registration failures are reported
164
+ * through onError while previous coverage remains live.
165
+ *
166
+ * @evidence contracts/common.md#principled-implementation The compiler-input operation defines membership and its native default reads the actual compiler list; new coverage is registered before stale coverage retires, and registration reconciliation compares against pre-registration baselines.
167
+ * @evidence contracts/common.md#clear-and-simple-design One refresh delegates compiler population resolution, watcher synchronization and notification classification to separate private owners.
168
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Predicted outputs never subtract from compiler-reported inputs; failed registration cannot claim complete replacement coverage.
169
+ * @evidence contracts/common.md#meaningful-documentation Native prose states notification gating, thrown errors and registration error ownership following the documentation skill.
170
+ * @evidence contracts/portability.md#os-neutral-implementation Compiler processes use explicit argv/env; native APIs own path grammar and backend differences. Lexical membership uses measured component case policy, keeping unknown names and symlink aliases distinct instead of folding all Windows paths.
171
+ * @evidence contracts/performance.md#efficient-algorithms Project/reference configuration discovery, output inference and supplied/native compiler listing precede file/key snapshot passes. Native path/case/ancestor work and newly admitted file hashing add text/byte costs; broad reconciliation stats tracked files and strongly reads metadata/owner movement, while named/gap events request strong reads. Windows directory pruning is pairwise, and extra/project watcher reconciliation adds its own scans and backend callback costs without a file-count or deadline cap.
172
+ * @evidence contracts/performance.md#reuse-equivalent-work Existing live watchers and unchanged fingerprints are reused by key; one fresh synchronous transaction shares parent case probes across membership, output and directory keys. One current root selection shares response inspection across referenced-project output queries; response observations are checked again after membership and never cached across refreshes. Registration microtasks coalesce gap work while actual compiler membership is refreshed rather than inferred from quiet notifications.
173
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Current snapshots prune removed members and synchronization attempts obsolete handle closure, keeping old coverage after incomplete registration. Current/recovery populations and observations have no size cap; supplied close/error callbacks can throw and close does not await backend completion. State remains owner-held until released.
174
+ */
137
175
  public refresh(notify: boolean): void {
138
176
  this.refreshCompilerInputs(notify, false);
139
177
  }
@@ -142,12 +180,18 @@ export class WatchTopology {
142
180
  notify: boolean,
143
181
  skipUnobservedProjectInputWatchRoots: boolean,
144
182
  ): void {
145
- const next = resolveWatchTopology(this.options, this.extraInputs);
183
+ this.beginLexicalTransaction();
184
+ const next = resolveWatchTopology(
185
+ this.options,
186
+ this.extraInputs,
187
+ this.lexicalIdentities,
188
+ this.getCompilerInputs,
189
+ );
146
190
  const compilerProgramMembershipChange =
147
191
  next.analysisOnly &&
148
- mapsEqual(this.reloadFiles, next.reloadFiles) &&
149
- mapsEqual(this.outputFiles, next.outputFiles) &&
150
- mapsEqual(this.outputs, next.outputs)
192
+ WatchPaths.mapsEqual(this.reloadFiles, next.reloadFiles) &&
193
+ WatchPaths.mapsEqual(this.outputFiles, next.outputFiles) &&
194
+ WatchPaths.mapsEqual(this.outputs, next.outputs)
151
195
  ? compilerMembershipChange(this.files, next.files)
152
196
  : [];
153
197
  const projectInputProgramOverlap = projectInputCompilerMembershipChange(
@@ -162,11 +206,11 @@ export class WatchTopology {
162
206
  : undefined;
163
207
  const changed =
164
208
  this.analysisOnly !== next.analysisOnly ||
165
- mapsEqual(this.files, next.files) === false ||
166
- mapsEqual(this.directories, next.directories) === false ||
167
- mapsEqual(this.outputFiles, next.outputFiles) === false ||
168
- mapsEqual(this.outputs, next.outputs) === false ||
169
- mapsEqual(this.reloadFiles, next.reloadFiles) === false;
209
+ WatchPaths.mapsEqual(this.files, next.files) === false ||
210
+ WatchPaths.mapsEqual(this.directories, next.directories) === false ||
211
+ WatchPaths.mapsEqual(this.outputFiles, next.outputFiles) === false ||
212
+ WatchPaths.mapsEqual(this.outputs, next.outputs) === false ||
213
+ WatchPaths.mapsEqual(this.reloadFiles, next.reloadFiles) === false;
170
214
  this.analysisOnly = next.analysisOnly;
171
215
  this.files = next.files;
172
216
  // Stamp the tracked set as it is resolved, so the first event that cannot
@@ -180,18 +224,16 @@ export class WatchTopology {
180
224
  // has a baseline would advance it past a change nobody reported, and the
181
225
  // next unnamed event would then read that change as no change at all.
182
226
  if (!this.compilerFileSnapshots.has(key)) {
183
- this.compilerFileSnapshots.set(key, compilerFileSnapshot(file));
227
+ this.compilerFileSnapshots.set(
228
+ key,
229
+ compilerFileSnapshot(file, fingerprintProjectInputFile(file)),
230
+ );
184
231
  }
185
232
  }
186
233
  this.directories = next.directories;
187
234
  this.outputFiles = next.outputFiles;
188
235
  this.outputs = next.outputs;
189
236
  this.reloadFiles = next.reloadFiles;
190
- for (const key of this.projectInputCompilerAcknowledgements.keys()) {
191
- if (!next.files.has(key)) {
192
- this.projectInputCompilerAcknowledgements.delete(key);
193
- }
194
- }
195
237
  const projectInputProgramReload =
196
238
  projectInputProgramOverlap.length === 0
197
239
  ? false
@@ -237,17 +279,17 @@ export class WatchTopology {
237
279
  * project watcher names the same creation. The rebuild scheduled here already
238
280
  * consumes the current project bytes, so publishing their strong fingerprints
239
281
  * keeps the later parent event from rediscovering the same population delta.
240
- * A newly tracked compiler file also remembers that fingerprint until its
241
- * first named content delivery; identical bytes are the delayed creation,
242
- * while different bytes are a real later edit and remain observable even
243
- * inside filesystem timestamp resolution.
282
+ * Compiler files keep their own content fingerprints at admission, so a
283
+ * delayed named event for the same bytes is quiet on every backend.
244
284
  */
245
285
  private acknowledgeProjectInputCompilerMembership(
246
286
  changed: readonly string[],
247
287
  ): boolean {
248
288
  const matches = this.collectProjectInputMatches();
249
- const fingerprints = fingerprintProjectInputMatches(matches);
250
- const identities = createProjectInputPathIdentityContext();
289
+ const fingerprints = fingerprintProjectInputMatches(
290
+ matches,
291
+ this.readDirectory,
292
+ );
251
293
  const changedInputs = projectInputChangedPaths({
252
294
  next: matches,
253
295
  nextFingerprints: fingerprints,
@@ -259,13 +301,19 @@ export class WatchTopology {
259
301
  changed,
260
302
  population.globs,
261
303
  );
262
- const reload = projectInputReloadEventShouldNotify({
304
+ const reloadInput = {
263
305
  causedBy,
264
306
  changed: causedBy.length === 1 ? causedBy[0] : undefined,
265
307
  changedInputs,
266
308
  globs: population.globs,
267
309
  reloadDirectories: population.reloadDirectories,
268
310
  reloadFiles: population.reloadFiles ?? [],
311
+ };
312
+ const reload = projectInputReloadEventShouldNotify(reloadInput);
313
+ reportProjectInputDecision({
314
+ source: "compiler-membership",
315
+ ...reloadInput,
316
+ reload,
269
317
  });
270
318
  // The callback below consumes the complete population observed by this
271
319
  // scan. Crucially, reload classification runs against the old baseline
@@ -273,28 +321,58 @@ export class WatchTopology {
273
321
  // instead of disappearing behind the warm compiler-membership handoff.
274
322
  this.projectInputMatches = matches;
275
323
  this.projectInputFingerprints = fingerprints;
276
- for (const location of changed) {
277
- const compilerKey = pathKey(location);
278
- if (!this.files.has(compilerKey)) continue;
279
- const fingerprint = fingerprints.get(identities.resolve(location).key);
280
- if (fingerprint !== undefined && fingerprint !== "") {
281
- this.projectInputCompilerAcknowledgements.set(compilerKey, fingerprint);
282
- }
283
- }
284
324
  return reload;
285
325
  }
286
326
 
287
- /** Add Go plugin source trees discovered by the real build lane. */
327
+ /**
328
+ * Add Go plugin source trees discovered by the real build lane. Existing
329
+ * input fingerprints retain their baseline; new inputs are captured before
330
+ * the caller builds them, so later notifications can compare that
331
+ * observation. This does not freeze the source tree or prove every transient
332
+ * edit was seen.
333
+ *
334
+ * @evidence contracts/common.md#principled-implementation Published plugin inputs define the source corpus, and retaining existing pre-build baselines keeps unreported edits visible.
335
+ * @evidence contracts/common.md#clear-and-simple-design Deduplication, baseline retention and compiler/watch reconciliation remain ordered phases.
336
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The actual plugin source digest applies its owning source-selection and pruning policy; named plugins or fixture output do not replace observed input state.
337
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains baseline timing and why existing inputs are not restamped following the documentation skill.
338
+ * @evidence contracts/portability.md#os-neutral-implementation Native path resolution and canonical backend registration govern source trees; lexical keys preserve declarations and unknown names, folding ASCII only under measured insensitive parents rather than an OS-derived rule.
339
+ * @evidence contracts/performance.md#efficient-algorithms Input/path keys deduplicate with text and native case/ancestor work; only newly admitted inputs compute initial source digests. Those reads scan the selected pruned corpus, then refresh(false) also pays project/compiler listing, directory traversal and watcher reconciliation; fixed publication count does not bound delegated bytes or backend work.
340
+ * @evidence contracts/performance.md#reuse-equivalent-work Unchanged ordered input sets return immediately; existing inputs reuse their recorded digest until actual notification processing establishes changed consumed state.
341
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Publications replace input/digest populations and case-observation caches without a population cap; synchronization attempts obsolete watcher closure. Native/supplied closure has its own lifetime and can throw; owner close does not prove every backend has stopped or every retained snapshot byte was released.
342
+ */
288
343
  public setExtraInputs(inputs: readonly string[]): void {
289
- const next = uniqueExistingPaths(inputs);
344
+ this.beginLexicalTransaction();
345
+ const next = uniqueExistingPaths(inputs, this.lexicalIdentities);
290
346
  if (arraysEqual(this.extraInputs, next)) return;
291
347
  this.extraInputs = next;
348
+ // The load reports its inputs before any build reads them, so the state
349
+ // recorded here precedes every read, and an edit after it moves the state.
350
+ // An input already tracked keeps its baseline: restamping it would absorb
351
+ // a change nobody reported.
352
+ const states = new Map<string, string>();
353
+ for (const input of next) {
354
+ const key = this.pathKey(input);
355
+ states.set(
356
+ key,
357
+ this.pluginInputStates.get(key) ?? pluginInputState(input),
358
+ );
359
+ }
360
+ this.pluginInputStates = states;
292
361
  this.refresh(false);
293
362
  }
294
363
 
295
364
  /**
296
365
  * Reconcile project-rule dependencies, retaining absent files and empty glob
297
366
  * populations as live topology.
367
+ *
368
+ * @evidence contracts/common.md#principled-implementation Both lexical declarations and current physical identities remain observable, including missing members and empty globs; republication can update aliased watcher ownership without requiring population movement.
369
+ * @evidence contracts/common.md#clear-and-simple-design Publication normalization, baseline population capture and root synchronization are separate stages, with one retained declaration-owner map.
370
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing inputs are not dropped from observation, and an unavailable safe root is reported rather than widened over a system ancestor.
371
+ * @evidence contracts/common.md#meaningful-documentation Native prose and helper paragraphs explain absent populations, aliases, handoff reconciliation and root ceilings following the documentation skill.
372
+ * @evidence contracts/portability.md#os-neutral-implementation Transaction-owned native case observations and physical identities distinguish resolved aliases; unknown case routes both glob interpretations without merging keys, while canonical registration and separate link-entry observation preserve retargets.
373
+ * @evidence contracts/performance.md#efficient-algorithms Publication normalizes native identities and sorts distinct path lists, then compares snapshots and reconciles alias/watch roots. Changed publications enumerate deduplicated physical glob roots, test applicable patterns with pattern/path/native identity costs and fingerprint selected file bytes or sorted immediate directory entries. Parent/case probes, repeated declaration/root admission and backend work add costs beyond file-pattern visits; payloads and traversal depth are uncapped.
374
+ * @evidence contracts/performance.md#reuse-equivalent-work Equal normalized publications reuse content baselines but still reconcile lexical aliases; registration microtasks coalesce equivalent handoff work, and transaction indexes reuse identity and output-overlap decisions within one scan.
375
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Publication prunes retired declaration-owner choices and replaces uncapped match/fingerprint populations. Watcher retirement invokes close without awaiting backend completion, and supplied errors can interrupt cleanup. Weak output-overlap keys do not retain old identity transactions; the current declaration snapshot can borrow caller arrays until replaced or the facade is released.
298
376
  */
299
377
  public setProjectInputs(inputs: ITtscProjectInputSnapshot): void {
300
378
  const next = normalizeProjectInputSnapshot(inputs);
@@ -320,11 +398,29 @@ export class WatchTopology {
320
398
  this.projectInputMatches = this.collectProjectInputMatches();
321
399
  this.projectInputFingerprints = fingerprintProjectInputMatches(
322
400
  this.projectInputMatches,
401
+ this.readDirectory,
323
402
  );
324
403
  this.syncProjectInputWatchers();
325
404
  }
326
405
 
327
- /** Close every watcher so SIGINT/SIGTERM can drain the event loop. */
406
+ /**
407
+ * Invoke close on owned watchers so their backends can retire. Scheduled
408
+ * reconciliation callbacks observe the closed state and retire without
409
+ * creating replacement subscriptions. A thrown close propagates and
410
+ * interrupts remaining cleanup; this void method does not await
411
+ * native/backend shutdown or guarantee event-loop drain.
412
+ *
413
+ * @evidence contracts/common.md#principled-implementation Marking the owner closed before retiring subscriptions prevents queued reconciliations from reopening native handles.
414
+ * @evidence contracts/common.md#clear-and-simple-design One shutdown operation closes and clears each distinct watcher population through a shared helper.
415
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Shutdown invokes actual owned subscription close methods rather than only suppressing output; errors propagate and no backend completion is fabricated.
416
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain event-loop release and queued-work behavior following the documentation skill.
417
+ * @evidence contracts/portability.md#os-neutral-implementation Shared close methods retire both Node handles and macOS registry subscriptions without exposing native handle types.
418
+ * @evidence contracts/performance.md#efficient-algorithms Each successfully reached live map traverses its watcher references and invokes backend-owned close work before clearing. Completed maps make later traversals empty; delegated cleanup costs and a thrown callback are not bounded by reference count alone.
419
+ *
420
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Shutdown decides no equivalence of compilation or fingerprint work.
421
+ *
422
+ * @evidence contracts/performance.md#bound-retention-and-release-resources On successful completion all five watcher maps clear and the lexical transaction is replaced; queued tasks observe the closed guard. A thrown close can leave later maps retained, and backend closure is not joined. Snapshot/declaration/pending byte state remains until replaced or the facade is released.
423
+ */
328
424
  public close(): void {
329
425
  this.closed = true;
330
426
  closeWatchers(this.fileWatchers);
@@ -332,6 +428,19 @@ export class WatchTopology {
332
428
  closeWatchers(this.extraWatchers);
333
429
  closeWatchers(this.projectInputWatchers);
334
430
  closeWatchers(this.projectInputLinkWatchers);
431
+ this.beginLexicalTransaction();
432
+ }
433
+
434
+ /** Start fresh native case observations for one synchronous watch decision. */
435
+ private beginLexicalTransaction(): void {
436
+ this.lexicalIdentities = createProjectInputPathIdentityContext({
437
+ throwOnRealpathError: false,
438
+ });
439
+ }
440
+
441
+ /** Keep lexical alias ownership while sharing this decision's case probes. */
442
+ private pathKey(location: string): string {
443
+ return WatchPaths.pathKey(location, this.lexicalIdentities);
335
444
  }
336
445
 
337
446
  private syncFileWatchers(skipMissing = false): boolean {
@@ -348,21 +457,19 @@ export class WatchTopology {
348
457
  this.fileWatchers,
349
458
  files,
350
459
  (location) =>
351
- fs.watch(
460
+ this.openFileWatch(
352
461
  watcherRegistrationPath(location),
353
462
  { persistent: true },
354
463
  () => {
464
+ this.beginLexicalTransaction();
355
465
  // A per-file watcher fires on any filesystem attention its target
356
466
  // receives, and it carries no filename to distinguish an edit from
357
467
  // a touch. It answers the same question the unnamed directory event
358
468
  // answers, so it answers it the same way: from the bytes.
359
- const movement = this.compilerFileMovement(location);
469
+ const movement = this.compilerFileMovement(location, true);
360
470
  if (movement.owner) this.rearmFileWatchers([location], true);
361
- if (!movement.content) return;
362
- this.callbacks.onInputChange({
363
- kind: this.classifyCompilerInput(location),
364
- path: location,
365
- });
471
+ if (!this.compilerMovementReports(location, movement)) return;
472
+ this.reportCompilerFileChange(location);
366
473
  },
367
474
  ),
368
475
  (location, error) => this.callbacks.onError(location, error),
@@ -373,24 +480,55 @@ export class WatchTopology {
373
480
  );
374
481
  }
375
482
 
376
- /** Compare a tracked file's content and physical owner with its snapshot. */
377
- private compilerFileMovement(location: string): CompilerFileMovement {
378
- const key = pathKey(location);
483
+ /**
484
+ * Compare a tracked file with its last observed bytes and physical owner.
485
+ *
486
+ * A named event or observation gap reads the bytes even when time and size
487
+ * stayed still. A broad registration scan reads only a file whose metadata or
488
+ * owner moved, so an unrelated event does not read the whole Program.
489
+ */
490
+ private compilerFileMovement(
491
+ location: string,
492
+ strong = false,
493
+ ): CompilerFileMovement {
494
+ const key = this.pathKey(location);
379
495
  const previous = this.compilerFileSnapshots.get(key);
380
- const next = compilerFileSnapshot(location);
381
- this.compilerFileSnapshots.set(key, next);
496
+ const metadata = compilerFileSnapshot(location, "");
497
+ const read =
498
+ strong ||
499
+ previous === undefined ||
500
+ previous.content !== metadata.content ||
501
+ previous.owner !== metadata.owner;
502
+ const fingerprint = read
503
+ ? fingerprintProjectInputFile(location)
504
+ : (previous?.fingerprint ?? "");
505
+ this.compilerFileSnapshots.set(key, { ...metadata, fingerprint });
382
506
  return {
383
- content: previous?.content !== next.content,
384
- owner: previous?.owner !== next.owner,
507
+ content:
508
+ previous === undefined
509
+ ? fingerprint !== ""
510
+ : previous.fingerprint !== fingerprint,
511
+ owner: previous?.owner !== metadata.owner,
385
512
  };
386
513
  }
387
514
 
515
+ /** A config's physical replacement can change resolution with equal bytes. */
516
+ private compilerMovementReports(
517
+ location: string,
518
+ movement: CompilerFileMovement,
519
+ ): boolean {
520
+ return (
521
+ movement.content ||
522
+ (movement.owner && this.classifyCompilerInput(location) === "config")
523
+ );
524
+ }
525
+
388
526
  private syncDirectoryWatchers(): boolean {
389
527
  const previous = new Map(this.directoryWatchers);
390
528
  const desired = new Map(this.directories);
391
529
  for (const [key, location] of this.observedDirectories) {
392
530
  if (
393
- isDirectory(location) === false ||
531
+ WatchPaths.isDirectory(location) === false ||
394
532
  this.isCompilerOutputDirectory(location) ||
395
533
  this.isProjectInputDirectory(location)
396
534
  ) {
@@ -404,7 +542,12 @@ export class WatchTopology {
404
542
  if (
405
543
  [...desired].some(
406
544
  ([candidateKey, candidate]) =>
407
- candidateKey !== key && isPathWithin(candidate, location),
545
+ candidateKey !== key &&
546
+ WatchPaths.isPathWithin(
547
+ candidate,
548
+ location,
549
+ this.lexicalIdentities,
550
+ ),
408
551
  )
409
552
  ) {
410
553
  desired.delete(key);
@@ -415,23 +558,16 @@ export class WatchTopology {
415
558
  this.directoryWatchers,
416
559
  desired,
417
560
  (location) =>
418
- fs.watch(
561
+ this.openDirectoryWatch(
419
562
  watcherRegistrationPath(location),
420
- {
421
- persistent: true,
422
- recursive: process.platform === "win32",
423
- },
424
- (event, filename) => {
563
+ process.platform === "win32",
564
+ (event, filename, gap) => {
565
+ this.beginLexicalTransaction();
425
566
  const changed =
426
- filename === null
427
- ? undefined
428
- : path.resolve(location, filename.toString());
567
+ filename === null ? undefined : path.resolve(location, filename);
429
568
  const pluginInput = changed ?? location;
430
569
  if (this.isPluginInput(pluginInput)) {
431
- this.callbacks.onInputChange({
432
- kind: "plugin",
433
- path: pluginInput,
434
- });
570
+ this.notePluginNotification(pluginInput);
435
571
  return;
436
572
  }
437
573
  const plan = planCompilerDirectoryWatchEvent({
@@ -439,6 +575,7 @@ export class WatchTopology {
439
575
  event,
440
576
  exists: fs.existsSync,
441
577
  location,
578
+ identities: this.lexicalIdentities,
442
579
  platform: process.platform,
443
580
  trackedFiles: this.files,
444
581
  });
@@ -446,12 +583,9 @@ export class WatchTopology {
446
583
  for (const file of this.compilerChangesToReport(
447
584
  plan.changes,
448
585
  changed,
449
- event,
586
+ gap === true,
450
587
  )) {
451
- this.callbacks.onInputChange({
452
- kind: this.classifyCompilerInput(file),
453
- path: file,
454
- });
588
+ this.reportCompilerFileChange(file);
455
589
  }
456
590
  if (plan.refresh) this.refreshFromDirectory(location, changed);
457
591
  },
@@ -489,6 +623,7 @@ export class WatchTopology {
489
623
  queueMicrotask(() => {
490
624
  this.compilerPostRegistrationReconciliationScheduled = false;
491
625
  if (this.closed) return;
626
+ this.beginLexicalTransaction();
492
627
  const refreshCompilerMembership =
493
628
  this.compilerPostRegistrationMembershipRefresh;
494
629
  const skipUnobservedProjectInputWatchRoots =
@@ -500,19 +635,16 @@ export class WatchTopology {
500
635
  const rearm: string[] = [];
501
636
  for (const file of this.files.values()) {
502
637
  const movement = this.compilerFileMovement(file);
503
- if (movement.content) changed.push(file);
638
+ if (this.compilerMovementReports(file, movement)) changed.push(file);
504
639
  if (movement.owner) rearm.push(file);
505
640
  }
506
641
  // A replacement can move the path to a new inode without changing its
507
- // cheap content stamp or topology key. Rebind its physical owner without
508
- // inventing a content notification. Missing entries remain covered by
509
- // their parent directory and are retried when recreation is observed.
642
+ // bytes. Rebind an ordinary source without inventing a content change;
643
+ // report a config owner transition because it can change resolution.
644
+ // Missing entries remain covered by their parent directory.
510
645
  this.rearmFileWatchers(rearm, true);
511
646
  for (const file of changed) {
512
- this.callbacks.onInputChange({
513
- kind: this.classifyCompilerInput(file),
514
- path: file,
515
- });
647
+ this.reportCompilerFileChange(file);
516
648
  }
517
649
  if (!refreshCompilerMembership) return;
518
650
  try {
@@ -521,13 +653,14 @@ export class WatchTopology {
521
653
  // startup event cannot strand a newly included source.
522
654
  this.refreshCompilerInputs(true, skipUnobservedProjectInputWatchRoots);
523
655
  } catch (error) {
524
- const reported = new Set(changed.map(pathKey));
656
+ const reported = new Set(changed.map((file) => this.pathKey(file)));
525
657
  const reconciledChange = changed.length === 1 ? changed[0]! : undefined;
526
658
  for (const reload of reloadInputsForFailedTopologyRefresh(
527
659
  this.reloadFiles.values(),
528
660
  reconciledChange,
661
+ this.lexicalIdentities,
529
662
  )) {
530
- if (reported.has(pathKey(reload))) continue;
663
+ if (reported.has(this.pathKey(reload))) continue;
531
664
  this.callbacks.onInputChange({ kind: "config", path: reload });
532
665
  }
533
666
  this.callbacks.onError(
@@ -541,47 +674,55 @@ export class WatchTopology {
541
674
  }
542
675
 
543
676
  /**
544
- * Narrow a plan's changes to the tracked files that actually moved.
677
+ * Narrow a plan's changes to tracked files whose bytes actually moved.
545
678
  *
546
- * A backend that cannot name what changed forces the plan to nominate every
547
- * tracked file under the watched directory, which is the only safe answer it
548
- * can give from an event carrying no filename. macOS delivers such events for
549
- * ordinary activity elsewhere in the project, so the compiler lane would wake
550
- * for sources nobody touched. Only a content notification passes through: it
551
- * is the one event that claims the bytes moved. A rename claims the directory
552
- * entry was rewritten and an unnamed event claims nothing, so both are
553
- * decided from the bytes, which is the question neither of them answered.
679
+ * A named event checks its file even when time and size stayed still. A gap
680
+ * can hide such a rewrite anywhere under the watched root, so every candidate
681
+ * gets a strong check. Ordinary broad scans still use metadata first.
554
682
  */
555
683
  private compilerChangesToReport(
556
684
  changes: readonly string[],
557
685
  changed: string | undefined,
558
- event: string,
686
+ gap: boolean,
559
687
  ): string[] {
560
- // A content notification is taken at its word: the backend is telling us
561
- // these bytes changed, and second-guessing it would lose an edit that
562
- // landed inside the clock's resolution. A rename says the directory entry
563
- // was rewritten, which is a different claim — a file can be moved back, or
564
- // replaced by an identical copy, without its content moving at all — and an
565
- // event that cannot name anything makes no claim about content either.
566
- // Those two are decided from the bytes, and the rearm they drive is
567
- // unaffected, because rebinding is about the inode and not the content.
568
- if (changed !== undefined && event !== "rename") {
569
- return changes.filter((file) => {
570
- const key = pathKey(file);
571
- const acknowledged = this.projectInputCompilerAcknowledgements.get(key);
572
- this.projectInputCompilerAcknowledgements.delete(key);
573
- this.recordCompilerFileSnapshot(file);
574
- return (
575
- acknowledged === undefined ||
576
- acknowledged !== fingerprintProjectInputFile(file)
577
- );
578
- });
579
- }
580
- return changes.filter((file) => this.compilerFileMovement(file).content);
688
+ return changes.filter((file) => {
689
+ const movement = this.compilerFileMovement(
690
+ file,
691
+ changed !== undefined || gap,
692
+ );
693
+ return this.compilerMovementReports(file, movement);
694
+ });
581
695
  }
582
696
 
583
- private recordCompilerFileSnapshot(file: string): void {
584
- this.compilerFileSnapshots.set(pathKey(file), compilerFileSnapshot(file));
697
+ /**
698
+ * Let a selected project input consume its compiler content notification.
699
+ * Both lanes watch a resolveJsonModule file, but its project fingerprint
700
+ * decides the resident update once whichever backend hears the edit first. A
701
+ * missing compiler member instead reconciles Program membership before a
702
+ * stale file-watch notification can schedule a second build.
703
+ */
704
+ private reportCompilerFileChange(location: string): void {
705
+ if (this.classifyCompilerInput(location) === "compiler") {
706
+ if (fs.existsSync(location)) {
707
+ if (this.projectInputMatches.size !== 0) {
708
+ const key = createProjectInputPathIdentityContext({
709
+ throwOnRealpathError: false,
710
+ }).resolve(location).key;
711
+ if (
712
+ this.projectInputMatches.has(key) &&
713
+ this.refreshProjectInputs(path.dirname(location), location)
714
+ )
715
+ return;
716
+ }
717
+ } else {
718
+ this.refreshFromDirectory(path.dirname(location), location);
719
+ if (!this.files.has(this.pathKey(location))) return;
720
+ }
721
+ }
722
+ this.callbacks.onInputChange({
723
+ kind: this.classifyCompilerInput(location),
724
+ path: location,
725
+ });
585
726
  }
586
727
 
587
728
  private rearmFileWatchers(
@@ -589,8 +730,10 @@ export class WatchTopology {
589
730
  skipMissing = false,
590
731
  ): void {
591
732
  for (const file of files) {
592
- const key = pathKey(file);
593
- this.fileWatchers.get(key)?.close();
733
+ const key = this.pathKey(file);
734
+ const watcher = this.fileWatchers.get(key);
735
+ if (watcher === undefined) continue;
736
+ watcher.close();
594
737
  this.fileWatchers.delete(key);
595
738
  }
596
739
  if (this.syncFileWatchers(skipMissing)) {
@@ -598,34 +741,73 @@ export class WatchTopology {
598
741
  }
599
742
  }
600
743
 
744
+ /**
745
+ * Watch every directory of every plugin input, and report what a directory
746
+ * that appeared below an input already watched holds by now.
747
+ *
748
+ * Each directory has a watcher of its own, and a directory created below a
749
+ * plugin module is heard through its parent's; its own watcher is added only
750
+ * here, when that notification is decided (`decidePluginNotifications`) or
751
+ * the topology refreshes. A file written into it in between reaches no
752
+ * watcher on a platform whose watcher reports a directory's direct entries
753
+ * alone, and a build may have read the directory before the file landed. So
754
+ * once its watcher is registered, each entry it holds is noted as a plugin
755
+ * notification, as `@ttsc/unplugin`'s observer announces a directory it
756
+ * starts watching, and reported when it moved what a build reads. The
757
+ * directories of an input new to this sync are not reported: the load reports
758
+ * its inputs before any build reads them.
759
+ */
601
760
  private syncExtraWatchers(): void {
602
761
  const directories = new Map<string, string>();
762
+ const appeared: string[] = [];
603
763
  for (const input of this.extraInputs) {
764
+ const watchedBefore = this.watchedExtraInputs.has(this.pathKey(input));
604
765
  for (const directory of collectInputDirectories(input)) {
605
- directories.set(pathKey(directory), directory);
766
+ const key = this.pathKey(directory);
767
+ directories.set(key, directory);
768
+ if (watchedBefore && !this.extraWatchers.has(key)) {
769
+ appeared.push(directory);
770
+ }
606
771
  }
607
772
  }
608
773
  syncWatchers(
609
774
  this.extraWatchers,
610
775
  directories,
611
776
  (location) =>
612
- fs.watch(
777
+ this.openDirectoryWatch(
613
778
  watcherRegistrationPath(location),
614
- { persistent: true },
779
+ false,
615
780
  (_event, filename) => {
781
+ this.beginLexicalTransaction();
616
782
  const changed =
617
- filename === null
618
- ? undefined
619
- : path.resolve(location, filename.toString());
620
- this.callbacks.onInputChange({
621
- kind: "plugin",
622
- path: changed ?? location,
623
- });
783
+ filename === null ? undefined : path.resolve(location, filename);
784
+ // The one decision every watcher that hears a plugin path shares;
785
+ // here it drops the entry of a directory the build passes over.
786
+ if (changed !== undefined && !this.isPluginInput(changed)) return;
787
+ this.notePluginNotification(changed ?? location);
624
788
  },
625
789
  ),
626
790
  (location, error) => this.callbacks.onError(location, error),
627
791
  () => this.closed === false,
628
792
  );
793
+ this.watchedExtraInputs = new Set(
794
+ this.extraInputs.map((input) => this.pathKey(input)),
795
+ );
796
+ for (const directory of appeared) {
797
+ // Only a directory now watched: one whose registration failed was
798
+ // reported through `onError`, and one gone meanwhile holds nothing.
799
+ if (!this.extraWatchers.has(this.pathKey(directory))) continue;
800
+ let entries: string[];
801
+ try {
802
+ entries = fs.readdirSync(directory);
803
+ } catch {
804
+ continue;
805
+ }
806
+ for (const name of entries) {
807
+ const entry = path.join(directory, name);
808
+ if (this.isPluginInput(entry)) this.notePluginNotification(entry);
809
+ }
810
+ }
629
811
  }
630
812
 
631
813
  private syncProjectInputWatchers(
@@ -715,14 +897,12 @@ export class WatchTopology {
715
897
  this.projectInputWatchers,
716
898
  active,
717
899
  (location) =>
718
- fs.watch(
900
+ this.openDirectoryWatch(
719
901
  watcherRegistrationPath(location),
720
- { persistent: true, recursive: true },
902
+ true,
721
903
  (_event, filename) => {
722
904
  const changed =
723
- filename === null
724
- ? undefined
725
- : path.resolve(location, filename.toString());
905
+ filename === null ? undefined : path.resolve(location, filename);
726
906
  this.refreshProjectInputs(location, changed);
727
907
  },
728
908
  ),
@@ -785,7 +965,9 @@ export class WatchTopology {
785
965
  // still miss the retarget, because the watcher goes below the link.
786
966
  if (!isSymbolicLink(declared)) continue;
787
967
  if (this.isProjectInputCompilerOutput(declared, identities)) continue;
788
- const parent = nearestExistingDirectory(path.dirname(declared));
968
+ const parent = WatchPaths.nearestExistingDirectory(
969
+ path.dirname(declared),
970
+ );
789
971
  if (parent === undefined) continue;
790
972
  desired.set(identities.resolve(parent).key, parent);
791
973
  }
@@ -794,14 +976,12 @@ export class WatchTopology {
794
976
  this.projectInputLinkWatchers,
795
977
  desired,
796
978
  (location) =>
797
- fs.watch(
979
+ this.openDirectoryWatch(
798
980
  watcherRegistrationPath(location),
799
- { persistent: true },
981
+ false,
800
982
  (_event, filename) => {
801
983
  const changed =
802
- filename === null
803
- ? undefined
804
- : path.resolve(location, filename.toString());
984
+ filename === null ? undefined : path.resolve(location, filename);
805
985
  this.refreshProjectInputs(location, changed);
806
986
  },
807
987
  ),
@@ -1055,8 +1235,9 @@ export class WatchTopology {
1055
1235
  ): string | undefined {
1056
1236
  const key = projectInputDeclarationKey(kind, declaration);
1057
1237
  const retained = this.projectInputWatchRoots.get(key);
1058
- if (retained !== undefined && isDirectory(retained)) return retained;
1059
- const resolved = projectInputRecursiveWatchRoot(
1238
+ if (retained !== undefined && WatchPaths.isDirectory(retained))
1239
+ return retained;
1240
+ const resolved = ProjectInputWatchRules.projectInputRecursiveWatchRoot(
1060
1241
  target,
1061
1242
  this.projectInputs.root,
1062
1243
  );
@@ -1068,7 +1249,8 @@ export class WatchTopology {
1068
1249
  location: string,
1069
1250
  changed?: string,
1070
1251
  skipUnobservedProjectInputWatchRoots = false,
1071
- ): void {
1252
+ ): boolean {
1253
+ this.beginLexicalTransaction();
1072
1254
  try {
1073
1255
  const previous = this.projectInputMatches;
1074
1256
  const identities = createProjectInputPathIdentityContext();
@@ -1093,7 +1275,7 @@ export class WatchTopology {
1093
1275
  (this.isProjectInputCompilerOutput(changed, identities) ||
1094
1276
  (directlyMatched === false && topologyMatched === false))
1095
1277
  ) {
1096
- return;
1278
+ return false;
1097
1279
  }
1098
1280
  // Rearm before snapshotting. A watcher that has to be replaced stops
1099
1281
  // delivering the moment it is closed, so a scan taken first would become
@@ -1108,35 +1290,45 @@ export class WatchTopology {
1108
1290
  this.syncProjectInputWatchers();
1109
1291
  }
1110
1292
  const next = this.collectProjectInputMatches();
1111
- const membershipChanged = mapsEqual(previous, next) === false;
1293
+ const membershipChanged = WatchPaths.mapsEqual(previous, next) === false;
1112
1294
  const nextFingerprints =
1113
1295
  changed === undefined ||
1114
1296
  membershipChanged ||
1115
1297
  directlyMatched ||
1116
1298
  topologyMatched
1117
- ? fingerprintProjectInputMatches(next)
1299
+ ? fingerprintProjectInputMatches(next, this.readDirectory)
1118
1300
  : this.projectInputFingerprints;
1119
1301
  const contentChanged =
1120
- mapsEqual(this.projectInputFingerprints, nextFingerprints) === false;
1302
+ WatchPaths.mapsEqual(
1303
+ this.projectInputFingerprints,
1304
+ nextFingerprints,
1305
+ ) === false;
1121
1306
  const changedInputs = projectInputChangedPaths({
1122
1307
  next,
1123
1308
  nextFingerprints,
1124
1309
  previous,
1125
1310
  previousFingerprints: this.projectInputFingerprints,
1126
1311
  });
1127
- const reconciledChange =
1128
- changed ?? (changedInputs.length === 1 ? changedInputs[0] : undefined);
1312
+ const reconciledChange = reconcileProjectInputChange({
1313
+ changed,
1314
+ changedInputs,
1315
+ identities,
1316
+ next,
1317
+ previous,
1318
+ reloadDirectories: population.reloadDirectories ?? [],
1319
+ });
1129
1320
  // Both spellings classify the event. The normalized form names the file a
1130
1321
  // link pointed at when the snapshot was published, so after a retarget it
1131
1322
  // names the wrong one; only the declared form resolves to what the link
1132
1323
  // points at now, which is the selection this lane exists to protect.
1133
- const reload = projectInputReloadEventShouldNotify({
1324
+ const reloadInput = {
1134
1325
  changed: reconciledChange,
1135
1326
  changedInputs,
1136
1327
  globs: population.globs,
1137
1328
  reloadDirectories: population.reloadDirectories ?? [],
1138
1329
  reloadFiles: population.reloadFiles ?? [],
1139
- });
1330
+ };
1331
+ const reload = projectInputReloadEventShouldNotify(reloadInput);
1140
1332
  const invalidate = projectInputMembershipInvalidatesProgram({
1141
1333
  changed: reconciledChange,
1142
1334
  changedInputs,
@@ -1154,7 +1346,7 @@ export class WatchTopology {
1154
1346
  if (invalidate) {
1155
1347
  this.refreshCompilerInputs(false, skipUnobservedProjectInputWatchRoots);
1156
1348
  }
1157
- if (
1349
+ const notify =
1158
1350
  projectInputEventShouldNotify({
1159
1351
  contentChanged,
1160
1352
  directlyMatched,
@@ -1162,8 +1354,21 @@ export class WatchTopology {
1162
1354
  }) &&
1163
1355
  (reconciledChange === undefined ||
1164
1356
  this.isProjectInputCompilerOutput(reconciledChange, identities) ===
1165
- false)
1166
- ) {
1357
+ false);
1358
+ reportProjectInputDecision({
1359
+ source: "project-input",
1360
+ location,
1361
+ namedChange: changed ?? null,
1362
+ ...reloadInput,
1363
+ directlyMatched,
1364
+ topologyMatched,
1365
+ membershipChanged,
1366
+ contentChanged,
1367
+ reload,
1368
+ invalidate,
1369
+ notify,
1370
+ });
1371
+ if (notify) {
1167
1372
  this.callbacks.onInputChange(
1168
1373
  reload
1169
1374
  ? { kind: "config", path: reconciledChange }
@@ -1174,6 +1379,7 @@ export class WatchTopology {
1174
1379
  },
1175
1380
  );
1176
1381
  }
1382
+ return true;
1177
1383
  } catch (error) {
1178
1384
  // A rename can invalidate the old filesystem object before the
1179
1385
  // replacement is readable. Rebind ancestor ownership even when the
@@ -1181,6 +1387,7 @@ export class WatchTopology {
1181
1387
  // stranded without a watcher.
1182
1388
  this.syncProjectInputWatchers(skipUnobservedProjectInputWatchRoots);
1183
1389
  this.callbacks.onError(location, error);
1390
+ return false;
1184
1391
  }
1185
1392
  }
1186
1393
 
@@ -1212,7 +1419,7 @@ export class WatchTopology {
1212
1419
  }
1213
1420
  for (const directory of this.projectInputDeclarations("reload-directory")) {
1214
1421
  if (
1215
- isDirectory(directory) &&
1422
+ WatchPaths.isDirectory(directory) &&
1216
1423
  this.isProjectInputCompilerOutputDirectory(directory, identities) ===
1217
1424
  false
1218
1425
  ) {
@@ -1220,14 +1427,32 @@ export class WatchTopology {
1220
1427
  matches.set(identity.key, identity.path);
1221
1428
  }
1222
1429
  }
1430
+ const globRoots = new Map<string, { root: string; patterns: string[] }>();
1223
1431
  for (const glob of this.projectInputDeclarations("glob")) {
1224
1432
  const root = literalGlobRoot(glob);
1225
1433
  if (
1226
- isDirectory(root) === false ||
1434
+ WatchPaths.isDirectory(root) === false ||
1227
1435
  this.isProjectInputCompilerOutputDirectory(root, identities)
1228
1436
  ) {
1229
1437
  continue;
1230
1438
  }
1439
+ const identity = identities.resolve(root);
1440
+ const group = globRoots.get(identity.key) ?? {
1441
+ root: identity.path,
1442
+ patterns: [],
1443
+ };
1444
+ group.patterns.push(glob);
1445
+ globRoots.set(identity.key, group);
1446
+ }
1447
+ // One native walk serves all patterns below a physical ancestor. Per-file
1448
+ // matching still uses every declaration's own root and wildcard semantics.
1449
+ for (const root of projectInputActiveWatchDirectories(
1450
+ [...globRoots.values()].map((group) => group.root),
1451
+ identities,
1452
+ )) {
1453
+ const patterns = [...globRoots.values()]
1454
+ .filter((group) => identities.isWithin(root, group.root))
1455
+ .flatMap((group) => group.patterns);
1231
1456
  const stack = [root];
1232
1457
  while (stack.length !== 0) {
1233
1458
  const current = stack.pop()!;
@@ -1247,7 +1472,9 @@ export class WatchTopology {
1247
1472
  stack.push(location);
1248
1473
  } else if (
1249
1474
  entry.isFile() &&
1250
- matchesProjectInputGlob(glob, location, identities)
1475
+ patterns.some((glob) =>
1476
+ matchesProjectInputGlob(glob, location, identities),
1477
+ )
1251
1478
  ) {
1252
1479
  const identity = identities.resolve(location);
1253
1480
  matches.set(identity.key, identity.path);
@@ -1261,11 +1488,11 @@ export class WatchTopology {
1261
1488
  private refreshFromDirectory(location: string, changed?: string): void {
1262
1489
  if (
1263
1490
  changed !== undefined &&
1264
- isDirectory(changed) &&
1491
+ WatchPaths.isDirectory(changed) &&
1265
1492
  this.isCompilerOutputDirectory(changed) === false &&
1266
1493
  this.isProjectInputDirectory(changed) === false
1267
1494
  ) {
1268
- this.observedDirectories.set(pathKey(changed), changed);
1495
+ this.observedDirectories.set(this.pathKey(changed), changed);
1269
1496
  }
1270
1497
  try {
1271
1498
  this.refresh(true);
@@ -1273,6 +1500,7 @@ export class WatchTopology {
1273
1500
  for (const reload of reloadInputsForFailedTopologyRefresh(
1274
1501
  this.reloadFiles.values(),
1275
1502
  changed,
1503
+ this.lexicalIdentities,
1276
1504
  )) {
1277
1505
  this.callbacks.onInputChange({ kind: "config", path: reload });
1278
1506
  }
@@ -1282,13 +1510,13 @@ export class WatchTopology {
1282
1510
 
1283
1511
  private isCompilerOutputDirectory(location: string): boolean {
1284
1512
  return [...this.outputs.values()].some((output) =>
1285
- isPathWithin(output, location),
1513
+ WatchPaths.isPathWithin(output, location, this.lexicalIdentities),
1286
1514
  );
1287
1515
  }
1288
1516
 
1289
1517
  private isCompilerOutput(location: string): boolean {
1290
1518
  return (
1291
- this.outputFiles.has(pathKey(location)) ||
1519
+ this.outputFiles.has(this.pathKey(location)) ||
1292
1520
  this.isCompilerOutputDirectory(location)
1293
1521
  );
1294
1522
  }
@@ -1370,41 +1598,166 @@ export class WatchTopology {
1370
1598
  location: string,
1371
1599
  ): "compiler" | "config" | "plugin" {
1372
1600
  if (this.isPluginInput(location)) return "plugin";
1373
- return this.reloadFiles.has(pathKey(location)) ? "config" : "compiler";
1601
+ return this.reloadFiles.has(this.pathKey(location)) ? "config" : "compiler";
1374
1602
  }
1375
1603
 
1376
- private isPluginInput(location: string): boolean {
1604
+ /**
1605
+ * Note a notification at `location` against the plugin inputs it may have
1606
+ * moved, to be decided once the delivery it came in has reached every
1607
+ * listener (`decidePluginNotifications`).
1608
+ *
1609
+ * A watcher reports more than an edit. Windows reports a directory's entry as
1610
+ * changed when only its metadata moved, such as its access time after a build
1611
+ * enumerated it, and a notification taken at its word restarted the resident
1612
+ * check host for a plugin whose sources nobody edited. An input is decided by
1613
+ * what its build reads, which is every one of its source files, so the
1614
+ * notifications of one delivery are decided together: an install or a
1615
+ * checkout brings hundreds, and each input they name is read once. A location
1616
+ * no input covers, such as a directory above one, names every input.
1617
+ */
1618
+ private notePluginNotification(location: string): void {
1377
1619
  const resolved = path.resolve(location);
1378
- return this.extraInputs.some(
1379
- (input) =>
1380
- pathKey(input) === pathKey(resolved) || isPathWithin(input, resolved),
1620
+ const covering = this.extraInputs.filter((input) =>
1621
+ pluginSourceCovers(input, resolved, "entry"),
1381
1622
  );
1623
+ for (const input of covering.length === 0 ? this.extraInputs : covering) {
1624
+ const key = this.pathKey(input);
1625
+ const locations = this.pendingPluginNotifications.get(key) ?? new Set();
1626
+ locations.add(location);
1627
+ this.pendingPluginNotifications.set(key, locations);
1628
+ }
1629
+ if (this.pluginNotificationsScheduled) return;
1630
+ this.pluginNotificationsScheduled = true;
1631
+ // A watcher backend hands one delivery to its listeners within one turn
1632
+ // of the event loop, so the check phase after that turn holds all of it.
1633
+ setImmediate(() => this.decidePluginNotifications());
1382
1634
  }
1383
- }
1384
1635
 
1385
- export function reloadInputsForFailedTopologyRefresh(
1386
- reloadFiles: Iterable<string>,
1387
- changed?: string,
1388
- ): string[] {
1389
- const changedKey = changed === undefined ? undefined : pathKey(changed);
1390
- const reloads = new Map<string, string>();
1391
- for (const location of reloadFiles) {
1636
+ /**
1637
+ * Report every location noted for a plugin input whose state moved, once
1638
+ * each, and record the state it moved to. A notification that moved no input
1639
+ * is dropped.
1640
+ *
1641
+ * Whether a build must rerun and what must be watched are separate questions.
1642
+ * A delivery can name a directory created below an input: while it is empty
1643
+ * it moves nothing a build reads, yet it needs a watcher of its own before a
1644
+ * file lands in it, or on a platform whose watcher reports a directory's
1645
+ * direct entries alone that file reaches no watcher. So the watchers are
1646
+ * synced first, and what a directory they start watching already holds is
1647
+ * noted into this same decision (`syncExtraWatchers`).
1648
+ */
1649
+ private decidePluginNotifications(): void {
1650
+ if (this.closed) {
1651
+ this.pendingPluginNotifications = new Map();
1652
+ this.pluginNotificationsScheduled = false;
1653
+ return;
1654
+ }
1655
+ this.beginLexicalTransaction();
1656
+ // Still scheduled while syncing, so what the sync notes joins this decision
1657
+ // instead of scheduling another.
1658
+ this.syncExtraWatchers();
1659
+ this.pluginNotificationsScheduled = false;
1660
+ const pending = this.pendingPluginNotifications;
1661
+ this.pendingPluginNotifications = new Map();
1662
+ const reported = new Set<string>();
1663
+ for (const input of this.extraInputs) {
1664
+ const key = this.pathKey(input);
1665
+ const locations = pending.get(key);
1666
+ if (locations === undefined) continue;
1667
+ const state = pluginInputState(input);
1668
+ if (this.pluginInputStates.get(key) === state) continue;
1669
+ this.pluginInputStates.set(key, state);
1670
+ for (const location of locations) {
1671
+ if (reported.has(location)) continue;
1672
+ reported.add(location);
1673
+ this.callbacks.onInputChange({ kind: "plugin", path: location });
1674
+ }
1675
+ }
1676
+ }
1677
+
1678
+ /**
1679
+ * Whether a path is one a plugin build keys on: the plugin input itself, or a
1680
+ * path below it outside every directory the build passes over
1681
+ * (`pluginSourceCovers`). A write in a plugin module's `node_modules` or
1682
+ * `.git` is not one, whatever watcher heard it.
1683
+ *
1684
+ * Nor is such a directory's own entry. Windows reports every write inside a
1685
+ * directory as a change of that directory's entry to a watch on its parent,
1686
+ * and nothing of a directory the build passes over, or below it, is a source.
1687
+ * An entry of the same name that is a file is one the build reads.
1688
+ */
1689
+ private isPluginInput(location: string): boolean {
1392
1690
  const resolved = path.resolve(location);
1393
- const key = pathKey(resolved);
1394
1691
  if (
1395
- (changedKey !== undefined && key === changedKey) ||
1396
- fs.existsSync(resolved) === false
1692
+ prunesPluginSourceDirectory(path.basename(resolved)) &&
1693
+ WatchPaths.isDirectory(resolved)
1397
1694
  ) {
1398
- reloads.set(key, resolved);
1695
+ return false;
1399
1696
  }
1697
+ return this.extraInputs.some((input) =>
1698
+ pluginSourceCovers(input, resolved, "entry"),
1699
+ );
1400
1700
  }
1401
- return [...reloads.values()].sort();
1402
1701
  }
1403
1702
 
1703
+ type WatchTopologyOptions = Pick<
1704
+ TtscBuildOptions,
1705
+ | "binary"
1706
+ | "compilerArgsCwd"
1707
+ | "compilerProjectSelections"
1708
+ | "emit"
1709
+ | "env"
1710
+ | "outDir"
1711
+ | "passthrough"
1712
+ | "projectRoot"
1713
+ | "tsconfig"
1714
+ > & {
1715
+ cwd: string;
1716
+ files: readonly string[];
1717
+ pinCompilerProject?: boolean;
1718
+ };
1719
+
1720
+ type WatchTopologyCallbacks = {
1721
+ onError(location: string, error: unknown): void;
1722
+ onInputChange(change: WatchInputChange): void;
1723
+ onProjectInputWatchUnavailable?(roots: readonly string[]): void;
1724
+ onProjectInputWatchRoots?(roots: readonly string[]): void;
1725
+ onTopologyChange(): void;
1726
+ };
1727
+
1728
+ type ResolvedWatchTopology = {
1729
+ analysisOnly: boolean;
1730
+ directories: Map<string, string>;
1731
+ files: Map<string, string>;
1732
+ outputFiles: Map<string, string>;
1733
+ outputs: Map<string, string>;
1734
+ reloadFiles: Map<string, string>;
1735
+ };
1736
+
1737
+ type CompilerFileSnapshot = {
1738
+ content: string;
1739
+ fingerprint: string;
1740
+ owner: string;
1741
+ };
1742
+
1743
+ type CompilerFileMovement = {
1744
+ content: boolean;
1745
+ owner: boolean;
1746
+ };
1747
+
1404
1748
  function resolveWatchTopology(
1405
1749
  options: WatchTopologyOptions,
1406
1750
  extraInputs: readonly string[],
1751
+ identities: ProjectInputPathIdentityContext,
1752
+ getCompilerInputs: typeof listCompilerInputs,
1407
1753
  ): ResolvedWatchTopology {
1754
+ const selection = CompilerProjectSelection.read(options);
1755
+ if (selection.inspectionError !== undefined) throw selection.inspectionError;
1756
+ options = {
1757
+ ...options,
1758
+ compilerArgsCwd: selection.compilerArgsCwd,
1759
+ pinCompilerProject: selection.projectGuard.length !== 0,
1760
+ };
1408
1761
  let analysisOnly = options.emit === false;
1409
1762
  const files = new Map<string, string>();
1410
1763
  const outputFiles = new Map<string, string>();
@@ -1412,15 +1765,14 @@ function resolveWatchTopology(
1412
1765
  const reloadFiles = new Map<string, string>();
1413
1766
  const roots: string[] = [];
1414
1767
  if (options.files.length !== 0) {
1415
- const project = readProjectConfig({
1416
- cwd: options.cwd,
1417
- projectRoot: options.projectRoot,
1418
- tsconfig: options.tsconfig,
1419
- });
1768
+ const project = selection.project;
1769
+ const inspected = watchCompilerOptions(selection, options);
1420
1770
  analysisOnly = watchTopologyAnalysisOnly(options, project);
1771
+ addPaths(files, inspected.responseFiles, identities);
1772
+ addPaths(reloadFiles, inspected.responseFiles, identities);
1421
1773
  roots.push(project.root);
1422
- addPaths(files, project.configPaths);
1423
- addPaths(reloadFiles, project.configPaths);
1774
+ addPaths(files, project.configPaths, identities);
1775
+ addPaths(reloadFiles, project.configPaths, identities);
1424
1776
  const positionalInputs = options.files.map((file) =>
1425
1777
  path.resolve(options.cwd, file),
1426
1778
  );
@@ -1428,41 +1780,59 @@ function resolveWatchTopology(
1428
1780
  positionalInputs.length === 1 &&
1429
1781
  (options.emit ?? project.compilerOptions.noEmit !== true)
1430
1782
  ) {
1431
- addPaths(outputFiles, [
1432
- resolveSingleFileOutput({
1433
- cliOutDir: options.outDir,
1434
- cwd: options.cwd,
1435
- file: positionalInputs[0]!,
1436
- passthrough: options.passthrough,
1437
- tsconfig: options.tsconfig,
1438
- }),
1439
- ]);
1783
+ addPaths(
1784
+ outputFiles,
1785
+ [
1786
+ resolveSingleFileOutput(
1787
+ {
1788
+ cliOutDir: options.outDir,
1789
+ cwd: options.cwd,
1790
+ file: positionalInputs[0]!,
1791
+ passthrough: options.passthrough,
1792
+ tsconfig: options.tsconfig,
1793
+ },
1794
+ project,
1795
+ ),
1796
+ ],
1797
+ identities,
1798
+ );
1440
1799
  }
1441
- addPaths(files, positionalInputs);
1800
+ addPaths(files, positionalInputs, identities);
1442
1801
  } else {
1443
- const projects = readReferencedProjects(options);
1444
- if (projects[0] !== undefined) {
1445
- analysisOnly = watchTopologyAnalysisOnly(options, projects[0]);
1446
- }
1802
+ const projects = readReferencedProjects(selection.project, identities);
1447
1803
  for (const project of projects) {
1804
+ const inspected = watchCompilerOptions(selection, options);
1805
+ if (project === projects[0]) {
1806
+ analysisOnly = watchTopologyAnalysisOnly(inspected.options, project);
1807
+ }
1448
1808
  roots.push(project.root);
1449
- addPaths(files, project.configPaths);
1450
- addPaths(reloadFiles, project.configPaths);
1451
- const compilerInputs = listCompilerInputs(project, options);
1452
- const compilerOutputs = resolveCompilerOutputs(project, options);
1453
- addPaths(outputFiles, compilerOutputs.files);
1809
+ addPaths(files, project.configPaths, identities);
1810
+ addPaths(reloadFiles, project.configPaths, identities);
1811
+ addPaths(files, inspected.responseFiles, identities);
1812
+ addPaths(reloadFiles, inspected.responseFiles, identities);
1813
+ const compilerInputs = getCompilerInputs(project, options);
1814
+ CompilerProjectSelection.assertCurrent(selection);
1815
+ const compilerOutputs = resolveCompilerOutputs(project, inspected.options);
1816
+ addPaths(outputFiles, compilerOutputs.files, identities);
1454
1817
  addPaths(
1455
1818
  outputFiles,
1456
- inferPerSourceCompilerOutputs(project, options, compilerInputs),
1819
+ inferPerSourceCompilerOutputs(
1820
+ project,
1821
+ inspected.options,
1822
+ compilerInputs,
1823
+ identities,
1824
+ ),
1825
+ identities,
1457
1826
  );
1458
- addPaths(outputs, compilerOutputs.directories);
1459
- addPaths(files, compilerInputs);
1827
+ addPaths(outputs, compilerOutputs.directories, identities);
1828
+ addPaths(files, compilerInputs, identities);
1460
1829
  }
1461
1830
  }
1462
- addPaths(files, extraInputs);
1831
+ CompilerProjectSelection.assertCurrent(selection);
1832
+ addPaths(files, extraInputs, identities);
1463
1833
  return {
1464
1834
  analysisOnly,
1465
- directories: collectTopologyDirectories(files.values(), roots),
1835
+ directories: collectTopologyDirectories(files.values(), roots, identities),
1466
1836
  files,
1467
1837
  outputFiles,
1468
1838
  outputs,
@@ -1470,32 +1840,51 @@ function resolveWatchTopology(
1470
1840
  };
1471
1841
  }
1472
1842
 
1843
+ /**
1844
+ * Share the root selection's observed options across its referenced projects.
1845
+ * The original request still reaches the compiler-input operation. Positional
1846
+ * output placement remains the single-file launcher's own copy policy.
1847
+ */
1848
+ function watchCompilerOptions(
1849
+ selection: ReturnType<typeof CompilerProjectSelection.read>,
1850
+ options: WatchTopologyOptions,
1851
+ ): {
1852
+ options: WatchTopologyOptions;
1853
+ responseFiles: readonly string[];
1854
+ } {
1855
+ return {
1856
+ options: { ...options, passthrough: selection.inspectedArgs },
1857
+ responseFiles: [...selection.observations.keys()],
1858
+ };
1859
+ }
1860
+
1473
1861
  function watchTopologyAnalysisOnly(
1474
1862
  options: WatchTopologyOptions,
1475
1863
  project: ITtscParsedProjectConfig,
1476
1864
  ): boolean {
1477
- if (options.emit !== undefined) return options.emit === false;
1478
1865
  const noEmit =
1479
- passthroughBooleanOption(options.passthrough, "--noEmit") ??
1480
- project.compilerOptions.noEmit === true;
1866
+ passthroughBooleanOption(
1867
+ readCompilerOptionValues(options.passthrough).values,
1868
+ "--noEmit",
1869
+ ) ??
1870
+ (options.emit === undefined
1871
+ ? project.compilerOptions.noEmit === true
1872
+ : options.emit === false);
1481
1873
  return noEmit;
1482
1874
  }
1483
1875
 
1484
1876
  function readReferencedProjects(
1485
- options: WatchTopologyOptions,
1877
+ root: ITtscParsedProjectConfig,
1878
+ identities: ProjectInputPathIdentityContext,
1486
1879
  ): ITtscParsedProjectConfig[] {
1487
- const root = readProjectConfig({
1488
- cwd: options.cwd,
1489
- projectRoot: options.projectRoot,
1490
- tsconfig: options.tsconfig,
1491
- });
1492
1880
  const projects: ITtscParsedProjectConfig[] = [];
1493
1881
  const queue = [root];
1494
1882
  const seen = new Set<string>();
1495
- while (queue.length !== 0) {
1496
- const project = queue.shift()!;
1497
- if (seen.has(pathKey(project.path))) continue;
1498
- seen.add(pathKey(project.path));
1883
+ for (let cursor = 0; cursor < queue.length; cursor++) {
1884
+ const project = queue[cursor]!;
1885
+ const key = WatchPaths.pathKey(project.path, identities);
1886
+ if (seen.has(key)) continue;
1887
+ seen.add(key);
1499
1888
  projects.push(project);
1500
1889
  for (const reference of readProjectReferences(project.path)) {
1501
1890
  queue.push(
@@ -1550,9 +1939,10 @@ function listCompilerInputs(
1550
1939
  "--pretty",
1551
1940
  "false",
1552
1941
  ...(options.passthrough ?? []),
1942
+ ...(options.pinCompilerProject === true ? ["-p", project.path] : []),
1553
1943
  ],
1554
1944
  {
1555
- cwd: project.root,
1945
+ cwd: options.compilerArgsCwd ?? project.root,
1556
1946
  env: { ...process.env, ...options.env },
1557
1947
  encoding: "utf8",
1558
1948
  },
@@ -1609,6 +1999,7 @@ function inferPerSourceCompilerOutputs(
1609
1999
  project: ITtscParsedProjectConfig,
1610
2000
  options: WatchTopologyOptions,
1611
2001
  inputs: readonly string[],
2002
+ identities: ProjectInputPathIdentityContext,
1612
2003
  ): string[] {
1613
2004
  const emit = effectiveCompilerEmit(project, options);
1614
2005
  const outputs = new Set<string>();
@@ -1626,7 +2017,7 @@ function inferPerSourceCompilerOutputs(
1626
2017
  adjacentWhenOutside: boolean,
1627
2018
  ): string | undefined => {
1628
2019
  if (directory === undefined) return stem;
1629
- if (!isPathWithin(sourceRoot, input)) {
2020
+ if (!WatchPaths.isPathWithin(sourceRoot, input, identities)) {
1630
2021
  return adjacentWhenOutside ? stem : undefined;
1631
2022
  }
1632
2023
  return path.resolve(directory, path.relative(sourceRoot, stem));
@@ -1642,7 +2033,8 @@ function inferPerSourceCompilerOutputs(
1642
2033
  }
1643
2034
  continue;
1644
2035
  }
1645
- if (!isCompilerEmittableSourceExtension(extension)) continue;
2036
+ if (!ProjectInputWatchRules.isCompilerEmittableSourceExtension(extension))
2037
+ continue;
1646
2038
  if (
1647
2039
  emit.javascript &&
1648
2040
  (emit.outDir !== undefined ||
@@ -1686,19 +2078,6 @@ function inferPerSourceCompilerOutputs(
1686
2078
  return [...outputs];
1687
2079
  }
1688
2080
 
1689
- function isCompilerEmittableSourceExtension(extension: string): boolean {
1690
- return [
1691
- ".cjs",
1692
- ".cts",
1693
- ".js",
1694
- ".jsx",
1695
- ".mjs",
1696
- ".mts",
1697
- ".ts",
1698
- ".tsx",
1699
- ].includes(extension);
1700
- }
1701
-
1702
2081
  function isJavaScriptSourceExtension(extension: string): boolean {
1703
2082
  return [".cjs", ".js", ".jsx", ".mjs"].includes(extension);
1704
2083
  }
@@ -1722,7 +2101,7 @@ function effectiveCompilerEmit(
1722
2101
  options: WatchTopologyOptions,
1723
2102
  ): EffectiveCompilerEmit {
1724
2103
  const compilerOptions = project.compilerOptions;
1725
- const passthrough = options.passthrough;
2104
+ const passthrough = readCompilerOptionValues(options.passthrough).values;
1726
2105
  const noEmit =
1727
2106
  passthroughBooleanOption(passthrough, "--noEmit") ??
1728
2107
  (options.emit === false
@@ -1770,9 +2149,15 @@ function effectiveCompilerEmit(
1770
2149
  passthrough,
1771
2150
  "--tsBuildInfoFile",
1772
2151
  );
1773
- const jsx =
1774
- passthroughStringOption(passthrough, "--jsx") ?? compilerOptions.jsx;
1775
- const compilerCwd = project.root;
2152
+ // Presence carries explicit null/empty enum resets. A configured JSX string
2153
+ // follows JSON's lowercase-only contract, never the CLI whitespace trim.
2154
+ const rawJsx = passthrough.has("jsx")
2155
+ ? passthrough.get("jsx")
2156
+ : typeof compilerOptions.jsx === "string"
2157
+ ? normalizeCompilerEnumValue(compilerOptions.jsx, "json")
2158
+ : undefined;
2159
+ const jsx = typeof rawJsx === "string" ? rawJsx : undefined;
2160
+ const compilerCwd = options.compilerArgsCwd ?? project.root;
1776
2161
  return {
1777
2162
  declaration,
1778
2163
  declarationDir:
@@ -1842,74 +2227,51 @@ function replaceOutputExtension(location: string, extension: string): string {
1842
2227
  }
1843
2228
 
1844
2229
  function passthroughBooleanOption(
1845
- tokens: readonly string[] | undefined,
2230
+ values: ReadonlyMap<string, unknown>,
1846
2231
  name: string,
1847
2232
  ): boolean | undefined {
1848
- let value: boolean | undefined;
1849
- for (let index = 0; index < (tokens?.length ?? 0); index++) {
1850
- const token = tokens?.[index];
1851
- if (token === undefined) continue;
1852
- if (!passthroughOptionMatches(token, name)) continue;
1853
- const next = tokens?.[index + 1];
1854
- if (next === "true" || next === "false" || next === "null") {
1855
- value = next === "true";
1856
- index++;
1857
- } else {
1858
- value = true;
1859
- }
1860
- }
1861
- return value;
2233
+ const value = values.get(name.slice(2));
2234
+ return typeof value === "boolean"
2235
+ ? value
2236
+ : value === null
2237
+ ? false
2238
+ : undefined;
1862
2239
  }
1863
2240
 
1864
2241
  function passthroughPathOption(
1865
- tokens: readonly string[] | undefined,
2242
+ values: ReadonlyMap<string, unknown>,
1866
2243
  name: string,
1867
2244
  ): string | null | undefined {
1868
- let value: string | null | undefined;
1869
- for (let index = 0; index < (tokens?.length ?? 0); index++) {
1870
- const token = tokens?.[index];
1871
- if (token === undefined) continue;
1872
- if (!passthroughOptionMatches(token, name)) continue;
1873
- if (index + 1 < (tokens?.length ?? 0)) {
1874
- const next = tokens?.[++index];
1875
- value = next === "null" ? null : next;
1876
- }
1877
- }
1878
- return value;
1879
- }
1880
-
1881
- function passthroughStringOption(
1882
- tokens: readonly string[] | undefined,
1883
- name: string,
1884
- ): string | undefined {
1885
- return passthroughPathOption(tokens, name)?.toLowerCase() ?? undefined;
1886
- }
1887
-
1888
- function passthroughOptionMatches(token: string, name: string): boolean {
1889
- if (!token.startsWith("-")) return false;
1890
- if (token.includes("=")) return false;
1891
- return resolveFlagSpec(token)?.name === resolveFlagSpec(name)?.name;
2245
+ const value = values.get(name.slice(2));
2246
+ return typeof value === "string" || value === null ? value : undefined;
1892
2247
  }
1893
2248
 
1894
2249
  function collectTopologyDirectories(
1895
2250
  files: Iterable<string>,
1896
2251
  roots: readonly string[],
2252
+ identities: ProjectInputPathIdentityContext,
1897
2253
  ): Map<string, string> {
1898
2254
  const directories = new Map<string, string>();
1899
2255
  for (const root of roots) {
1900
- directories.set(pathKey(root), root);
2256
+ directories.set(WatchPaths.pathKey(root, identities), root);
1901
2257
  }
1902
2258
  for (const file of files) {
1903
2259
  const directory = path.dirname(file);
1904
- const root = roots.find((candidate) => isPathWithin(candidate, directory));
2260
+ const root = roots.find((candidate) =>
2261
+ WatchPaths.isPathWithin(candidate, directory, identities),
2262
+ );
1905
2263
  if (root === undefined) {
1906
- directories.set(pathKey(directory), directory);
2264
+ directories.set(WatchPaths.pathKey(directory, identities), directory);
1907
2265
  continue;
1908
2266
  }
1909
2267
  let current = directory;
1910
2268
  while (true) {
1911
- directories.set(pathKey(current), current);
1912
- if (pathKey(current) === pathKey(root)) break;
2269
+ directories.set(WatchPaths.pathKey(current, identities), current);
2270
+ if (
2271
+ WatchPaths.pathKey(current, identities) ===
2272
+ WatchPaths.pathKey(root, identities)
2273
+ )
2274
+ break;
1913
2275
  const parent = path.dirname(current);
1914
2276
  if (parent === current) break;
1915
2277
  current = parent;
@@ -1918,27 +2280,16 @@ function collectTopologyDirectories(
1918
2280
  return directories;
1919
2281
  }
1920
2282
 
2283
+ /**
2284
+ * Every directory of a plugin input a watch observes: the input and the
2285
+ * directories below it, except those the plugin build passes over and all below
2286
+ * them (`prunesPluginSourceDirectory`). The input is a plugin's whole Go
2287
+ * module, which can be a repository with its own `node_modules` and `.git`;
2288
+ * watching those would rebuild for every package install and commit without the
2289
+ * build reading any of it.
2290
+ */
1921
2291
  function collectInputDirectories(input: string): string[] {
1922
- if (isDirectory(input) === false) return [];
1923
- const directories: string[] = [];
1924
- const stack = [input];
1925
- while (stack.length !== 0) {
1926
- const current = stack.pop()!;
1927
- directories.push(current);
1928
- let entries: fs.Dirent[];
1929
- try {
1930
- entries = fs.readdirSync(current, { withFileTypes: true });
1931
- } catch (error) {
1932
- if (isVanishedFilesystemEntry(error)) continue;
1933
- throw error;
1934
- }
1935
- for (const entry of entries) {
1936
- if (entry.isDirectory()) {
1937
- stack.push(path.join(current, entry.name));
1938
- }
1939
- }
1940
- }
1941
- return directories;
2292
+ return collectPluginSourceDirectories(input);
1942
2293
  }
1943
2294
 
1944
2295
  function isVanishedFilesystemEntry(error: unknown): boolean {
@@ -1949,75 +2300,31 @@ function isVanishedFilesystemEntry(error: unknown): boolean {
1949
2300
  );
1950
2301
  }
1951
2302
 
1952
- function isDirectory(location: string): boolean {
1953
- try {
1954
- return fs.statSync(location).isDirectory();
1955
- } catch {
1956
- return false;
1957
- }
1958
- }
1959
-
1960
- type SynchronizedWatcher = {
1961
- close(): void;
1962
- on(event: "error", listener: (error: Error) => void): unknown;
1963
- };
1964
-
1965
- export function syncWatchers<T extends SynchronizedWatcher>(
1966
- watchers: Map<string, T>,
1967
- desired: ReadonlyMap<string, string>,
1968
- create: (location: string, key: string) => T,
1969
- onError: (location: string, error: unknown) => void,
1970
- shouldContinue: () => boolean = () => true,
1971
- ): boolean {
1972
- let complete = true;
1973
- for (const [key, location] of desired) {
1974
- if (!shouldContinue()) {
1975
- complete = false;
1976
- break;
1977
- }
1978
- if (watchers.has(key)) continue;
1979
- try {
1980
- const watcher = create(location, key);
1981
- watcher.on("error", (error) => {
1982
- if (watchers.get(key) === watcher) {
1983
- watchers.delete(key);
1984
- }
1985
- watcher.close();
1986
- onError(location, error);
1987
- });
1988
- watchers.set(key, watcher);
1989
- } catch (error) {
1990
- complete = false;
1991
- onError(location, error);
1992
- }
1993
- }
1994
- if (!complete) return false;
1995
- for (const [key, watcher] of watchers) {
1996
- if (desired.has(key)) continue;
1997
- watcher.close();
1998
- watchers.delete(key);
1999
- }
2000
- return true;
2001
- }
2002
-
2003
- function closeWatchers(watchers: Map<string, fs.FSWatcher>): void {
2303
+ function closeWatchers(watchers: Map<string, DirectoryWatcher>): void {
2004
2304
  for (const watcher of watchers.values()) watcher.close();
2005
2305
  watchers.clear();
2006
2306
  }
2007
2307
 
2008
- function addPaths(target: Map<string, string>, paths: Iterable<string>): void {
2308
+ function addPaths(
2309
+ target: Map<string, string>,
2310
+ paths: Iterable<string>,
2311
+ identities: ProjectInputPathIdentityContext,
2312
+ ): void {
2009
2313
  for (const location of paths) {
2010
2314
  const resolved = path.resolve(location);
2011
- target.set(pathKey(resolved), resolved);
2315
+ target.set(WatchPaths.pathKey(resolved, identities), resolved);
2012
2316
  }
2013
2317
  }
2014
2318
 
2015
- function uniqueExistingPaths(paths: readonly string[]): string[] {
2319
+ function uniqueExistingPaths(
2320
+ paths: readonly string[],
2321
+ identities: ProjectInputPathIdentityContext,
2322
+ ): string[] {
2016
2323
  const unique = new Map<string, string>();
2017
2324
  for (const location of paths) {
2018
2325
  if (location.length === 0) continue;
2019
2326
  const resolved = path.resolve(location);
2020
- unique.set(pathKey(resolved), resolved);
2327
+ unique.set(WatchPaths.pathKey(resolved, identities), resolved);
2021
2328
  }
2022
2329
  return [...unique.values()];
2023
2330
  }
@@ -2072,24 +2379,6 @@ function projectInputSnapshotsEqual(
2072
2379
  );
2073
2380
  }
2074
2381
 
2075
- export function literalGlobRoot(pattern: string): string {
2076
- const resolved = path.resolve(pattern);
2077
- const normalized = resolved.split("\\").join("/");
2078
- const wildcard = normalized.search(/[*?]/);
2079
- if (wildcard === -1) return path.dirname(resolved);
2080
- const separator = normalized.lastIndexOf("/", wildcard);
2081
- const prefix = separator < 0 ? "." : normalized.slice(0, separator);
2082
- const volumeRoot = path.parse(resolved).root;
2083
- const normalizedVolumeRoot = volumeRoot.split("\\").join("/");
2084
- if (
2085
- prefix.length === 0 ||
2086
- prefix === normalizedVolumeRoot.replace(/\/$/, "")
2087
- ) {
2088
- return volumeRoot;
2089
- }
2090
- return path.resolve(prefix);
2091
- }
2092
-
2093
2382
  function projectInputDeclarationKey(
2094
2383
  kind: "file" | "glob" | "reload" | "reload-directory",
2095
2384
  declaration: string,
@@ -2098,146 +2387,26 @@ function projectInputDeclarationKey(
2098
2387
  }
2099
2388
 
2100
2389
  /**
2101
- * Chooses the one stable recursive watcher root owned by a project-input
2102
- * declaration.
2390
+ * Metadata, fingerprint, and physical-owner identities for a tracked file.
2103
2391
  *
2104
- * Inputs inside the project share its physical root so directory replacement
2105
- * cannot strand a child handle. External inputs use the nearest existing
2106
- * ancestor of their declared parent, which is the explicit boundary for
2107
- * observing a currently missing external tree without polling every file --
2108
- * except that the boundary never rises to a directory holding the project,
2109
- * since such a root outranks the project's own in the active merge and leaves
2110
- * one handle over a shared system directory to carry everything. An external
2111
- * declaration that can only be owned that way falls back to its own tree, and
2112
- * is left unwatched when even that would contain the project.
2392
+ * Modification time and size avoid a read on an ordinary broad scan. A strong
2393
+ * event compares the fingerprint, so a timestamp collision cannot hide an edit
2394
+ * and a metadata-only notification does not create a build. Device and inode
2395
+ * answer whether a POSIX per-file watcher still owns the path.
2113
2396
  */
2114
- export function projectInputWatchDirectories(
2115
- target: string,
2116
- projectRoot: string,
2117
- ): string[] {
2118
- const root = projectInputRecursiveWatchRoot(target, projectRoot);
2119
- return root === undefined ? [] : [root];
2120
- }
2121
-
2122
- /**
2123
- * Removes recursive roots already covered by an ancestor without rewriting the
2124
- * declaration-specific roots retained by WatchTopology.
2125
- */
2126
- export function projectInputActiveWatchDirectories(
2127
- directories: Iterable<string>,
2128
- identities = createProjectInputPathIdentityContext(),
2129
- ): string[] {
2130
- const unique = new Map<string, string>();
2131
- for (const directory of directories) {
2132
- // Coverage is decided on physical identity so two spellings of one
2133
- // directory cannot both survive, but the surviving entry keeps the
2134
- // caller's spelling: this function selects roots, it does not rename them.
2135
- const identity = identities.resolve(directory);
2136
- if (!unique.has(identity.key)) unique.set(identity.key, directory);
2137
- }
2138
- return [...unique]
2139
- .filter(([key]) => {
2140
- let ancestor = path.dirname(key);
2141
- while (ancestor !== key) {
2142
- if (unique.has(ancestor)) return false;
2143
- const parent = path.dirname(ancestor);
2144
- if (parent === ancestor) break;
2145
- ancestor = parent;
2146
- }
2147
- return true;
2148
- })
2149
- .map(([, directory]) => directory);
2150
- }
2151
-
2152
- export function projectInputAvailableWatchDirectory(
2397
+ function compilerFileSnapshot(
2153
2398
  location: string,
2154
- rejected: ReadonlySet<string>,
2155
- identities: ProjectInputPathIdentityContext = createProjectInputPathIdentityContext(),
2156
- projectRoot?: string,
2157
- ): string | undefined {
2158
- const resolvedProjectRoot =
2159
- projectRoot === undefined ? undefined : path.resolve(projectRoot);
2160
- let current = path.resolve(location);
2161
- while (true) {
2162
- const identity = identities.resolve(current);
2163
- // Escalation obeys the same ceiling root selection does. A watcher that
2164
- // failed once would otherwise be replaced by one over a directory holding
2165
- // the project, which outranks the project's own root in the active merge
2166
- // and re-opens, through the recovery path, the exact swallow that selection
2167
- // refuses to create. Giving up the failed root is the lesser loss.
2168
- if (
2169
- resolvedProjectRoot !== undefined &&
2170
- identity.key !== identities.resolve(resolvedProjectRoot).key &&
2171
- identities.isWithin(identity.path, resolvedProjectRoot)
2172
- ) {
2173
- return undefined;
2174
- }
2175
- if (!rejected.has(identity.key)) return identity.path;
2176
- const parent = path.dirname(current);
2177
- if (parent === current) return undefined;
2178
- const fallback = nearestExistingDirectory(parent);
2179
- if (fallback === undefined) return undefined;
2180
- current = fallback;
2181
- }
2182
- }
2183
-
2184
- function projectInputRecursiveWatchRoot(
2185
- target: string,
2186
- projectRoot: string,
2187
- identities = createProjectInputPathIdentityContext(),
2188
- ): string | undefined {
2189
- const resolvedTarget = path.resolve(target);
2190
- const resolvedProjectRoot = path.resolve(projectRoot);
2191
- if (identities.isWithin(resolvedProjectRoot, resolvedTarget)) {
2192
- return nearestExistingDirectory(resolvedProjectRoot);
2193
- }
2194
- // An external anchor rises to the declared parent so a tree that does not
2195
- // exist yet is still observed, and so siblings under it share one handle. It
2196
- // may not rise past the project, though: a directory that contains the
2197
- // project swallows the project's own root when the two are merged, and every
2198
- // in-project declaration then rides one recursive handle over a shared system
2199
- // directory — a temp root, or the filesystem root itself — which delivers
2200
- // nothing. Prefer the declared parent, fall back to the target's own tree,
2201
- // and decline rather than widen past the project.
2202
- for (const candidate of [
2203
- nearestExistingDirectory(path.dirname(resolvedTarget)),
2204
- nearestExistingDirectory(resolvedTarget),
2205
- ]) {
2206
- if (candidate === undefined) continue;
2207
- // The project root cannot outrank itself in the merge, so it is the one
2208
- // container that is never a swallow — it is the owner the internal branch
2209
- // would have chosen anyway. A declaration reached through an in-project
2210
- // directory symlink lands here, and rejecting it would drop the hoist that
2211
- // keeps a replaced directory from stranding a child handle.
2212
- if (
2213
- identities.resolve(candidate).key !==
2214
- identities.resolve(resolvedProjectRoot).key &&
2215
- identities.isWithin(candidate, resolvedProjectRoot)
2216
- ) {
2217
- continue;
2218
- }
2219
- return candidate;
2220
- }
2221
- return undefined;
2222
- }
2223
-
2224
- /**
2225
- * Cheap content and physical-owner identities for a tracked file.
2226
- *
2227
- * Modification time and size answer "did the bytes move" without reading the
2228
- * file. Device and inode answer whether a POSIX per-file watcher still owns the
2229
- * path. Keeping the answers separate lets an identical atomic replacement
2230
- * rebind its watcher without inventing a compiler notification.
2231
- */
2232
- function compilerFileSnapshot(location: string): CompilerFileSnapshot {
2399
+ fingerprint: string,
2400
+ ): CompilerFileSnapshot {
2233
2401
  try {
2234
2402
  const stats = fs.statSync(location);
2235
2403
  return {
2236
2404
  content: `${stats.mtimeMs}:${stats.size}`,
2405
+ fingerprint,
2237
2406
  owner: `${stats.dev}:${stats.ino}`,
2238
2407
  };
2239
2408
  } catch {
2240
- return { content: "", owner: "" };
2409
+ return { content: "", fingerprint: "", owner: "" };
2241
2410
  }
2242
2411
  }
2243
2412
 
@@ -2249,16 +2418,6 @@ function isSymbolicLink(location: string): boolean {
2249
2418
  }
2250
2419
  }
2251
2420
 
2252
- function nearestExistingDirectory(location: string): string | undefined {
2253
- let current = path.resolve(location);
2254
- while (true) {
2255
- if (isDirectory(current)) return current;
2256
- const parent = path.dirname(current);
2257
- if (parent === current) return undefined;
2258
- current = parent;
2259
- }
2260
- }
2261
-
2262
2421
  function matchesProjectInput(
2263
2422
  snapshot: ITtscProjectInputSnapshot,
2264
2423
  location: string,
@@ -2280,123 +2439,70 @@ function matchesProjectInput(
2280
2439
  }
2281
2440
 
2282
2441
  /**
2283
- * Whether a replacement at this path leaves a recursive watcher bound to the
2284
- * object that was replaced.
2442
+ * Attribute a complete population scan to the changes it actually observed.
2285
2443
  *
2286
- * Only one backend needs the answer. Node routes a recursive watch to its own
2287
- * per-directory implementation when the platform is neither macOS nor Windows,
2288
- * and that implementation keys its handles by path: the handle for a directory
2289
- * renamed away stays bound to the object that left, and any child whose name
2290
- * survives the swap is skipped as already known. The native subtree backends
2291
- * both other platforms use follow the path, so retiring their watcher would buy
2292
- * nothing and would open a window in which no events are delivered.
2293
- *
2294
- * The answer is deliberately narrower than the rescan rule, because
2295
- * reinstalling a root costs one watch descriptor per entry beneath it, which an
2296
- * install storm would pay thousands of times. A directory appearing inside a
2297
- * glob root deserves a rescan but replaces nothing a root stands on, and a
2298
- * reload directory anchors the directory that contains it rather than itself,
2299
- * since its fingerprint is a digest of its own immediate entries and nothing
2300
- * below it can reach the declared corpus.
2444
+ * Observer attention can arrive late for bytes already admitted while another
2445
+ * member has changed. Such a name must not consume that member's delta under
2446
+ * the wrong path or select execution reload for unchanged selection bytes. A
2447
+ * directory event remains a valid cause when it contains every changed member.
2448
+ * Ancestor resolution-directory digests accompany those members rather than
2449
+ * replace their identity; unrelated directory deltas remain separate. When only
2450
+ * those digests changed, an untracked native name can still explain an
2451
+ * immediate-entry change whose member was not selected, but not another
2452
+ * directory's independent delta.
2301
2453
  */
2302
- export function projectInputReplacementStrandsWatchers(
2303
- snapshot: ITtscProjectInputSnapshot,
2304
- location: string,
2305
- identities = createProjectInputPathIdentityContext(),
2306
- platform: NodeJS.Platform = process.platform,
2307
- ): boolean {
2308
- if (platform === "darwin" || platform === "win32") return false;
2309
- const changed = path.resolve(location);
2310
- if (!isDirectory(changed)) return false;
2311
- return projectInputAnchorsDeclaration(
2312
- snapshot,
2313
- path.dirname(changed),
2314
- identities,
2315
- );
2316
- }
2317
-
2318
- function projectInputAnchorsDeclaration(
2319
- snapshot: ITtscProjectInputSnapshot,
2320
- directory: string,
2321
- identities: ProjectInputPathIdentityContext,
2322
- ): boolean {
2323
- return (
2324
- snapshot.files.some((file) => identities.isWithin(directory, file)) ||
2325
- (snapshot.reloadFiles ?? []).some((file) =>
2326
- identities.isWithin(directory, file),
2327
- ) ||
2328
- (snapshot.reloadDirectories ?? []).some(
2329
- (entry) =>
2330
- // A reload directory anchors the directory that contains it, never
2331
- // itself. Its own fingerprint is a digest of its immediate entries, so
2332
- // nothing below it can reach the corpus, and treating it as its own
2333
- // anchor would rearm for every entry created directly inside it —
2334
- // including `node_modules`, which contributors publish as one.
2335
- identities.isWithin(directory, entry) &&
2336
- identities.resolve(directory).key !== identities.resolve(entry).key,
2337
- ) ||
2338
- snapshot.globs.some((glob) =>
2339
- identities.isWithin(directory, literalGlobRoot(glob)),
2340
- )
2454
+ function reconcileProjectInputChange(input: {
2455
+ changed?: string;
2456
+ changedInputs: readonly string[];
2457
+ identities: ProjectInputPathIdentityContext;
2458
+ next: ReadonlyMap<string, string>;
2459
+ previous: ReadonlyMap<string, string>;
2460
+ reloadDirectories: readonly string[];
2461
+ }): string | undefined {
2462
+ const directories = new Set(
2463
+ input.reloadDirectories.map(
2464
+ (location) => input.identities.resolve(location).key,
2465
+ ),
2341
2466
  );
2342
- }
2343
-
2344
- /**
2345
- * Decide whether an event that named no declared input can still have moved
2346
- * one.
2347
- *
2348
- * The admitted set is the only bound on how often a watch session re-reads and
2349
- * re-hashes its declared corpus, and both directions cost: too narrow drops an
2350
- * atomic replacement, too wide re-fingerprints on every entry an install
2351
- * creates. Exported so that boundary is pinned directly instead of being
2352
- * inferred from a rebuild that a silent rescan and a skipped rescan produce
2353
- * identically.
2354
- */
2355
- export function projectInputTopologyMayAffect(
2356
- snapshot: ITtscProjectInputSnapshot,
2357
- location: string,
2358
- previous: ReadonlyMap<string, string>,
2359
- identities = createProjectInputPathIdentityContext(),
2360
- ): boolean {
2361
- const changed = path.resolve(location);
2362
- const anchors = (directory: string): boolean =>
2363
- projectInputAnchorsDeclaration(snapshot, directory, identities);
2364
- // An atomic replacement never names the declared file whose bytes it changed;
2365
- // it names the directory that was swapped, and that directory can be one the
2366
- // declaration does not contain — renaming `docs` away reports the arriving
2367
- // `docs-old`, not `docs`. So a directory event is admitted from where it
2368
- // happened rather than from what it contains: its own parent must already lie
2369
- // on the path to a declared input. A tree no declaration reaches, such as
2370
- // `node_modules` under an ordinary project, then costs nothing per created
2371
- // entry instead of a population rescan and a full content re-fingerprint. A
2372
- // glob whose literal root covers that tree still admits every directory
2373
- // beneath it through the branch below, because a directory appearing inside a
2374
- // glob root can hold matches; the declaration decides that reach, not this
2375
- // rule.
2376
- if (isDirectory(changed) && anchors(path.dirname(changed))) return true;
2377
- return (
2378
- anchors(changed) ||
2379
- (snapshot.reloadDirectories ?? []).some((directory) =>
2380
- identities.isWithin(directory, changed),
2381
- ) ||
2382
- snapshot.globs.some((glob) => {
2383
- const root = literalGlobRoot(glob);
2384
- if (identities.isWithin(changed, root)) return true;
2385
- if (identities.isWithin(root, changed) === false) return false;
2386
- if (isDirectory(changed)) return true;
2387
- return [...previous.values()].some((input) =>
2388
- identities.isWithin(changed, input),
2389
- );
2390
- })
2467
+ const members = input.changedInputs.filter(
2468
+ (location) => !directories.has(input.identities.resolve(location).key),
2391
2469
  );
2392
- }
2393
-
2394
- export function projectInputEventShouldNotify(input: {
2395
- contentChanged: boolean;
2396
- directlyMatched: boolean;
2397
- membershipChanged: boolean;
2398
- }): boolean {
2399
- return input.contentChanged || input.membershipChanged;
2470
+ const memberAncestors = new Set<string>();
2471
+ for (const member of members) {
2472
+ let ancestor = path.dirname(input.identities.resolve(member).path);
2473
+ while (true) {
2474
+ const identity = input.identities.resolve(ancestor);
2475
+ if (memberAncestors.has(identity.key)) break;
2476
+ memberAncestors.add(identity.key);
2477
+ const parent = path.dirname(identity.path);
2478
+ if (parent === identity.path) break;
2479
+ ancestor = parent;
2480
+ }
2481
+ }
2482
+ const observed = input.changedInputs.filter((location) => {
2483
+ const key = input.identities.resolve(location).key;
2484
+ return !directories.has(key) || !memberAncestors.has(key);
2485
+ });
2486
+ const changed = input.changed;
2487
+ if (changed !== undefined) {
2488
+ const key = input.identities.resolve(changed).key;
2489
+ if (
2490
+ observed.every((location) =>
2491
+ input.identities.isWithin(changed, location),
2492
+ ) ||
2493
+ (members.length === 0 &&
2494
+ !input.previous.has(key) &&
2495
+ !input.next.has(key) &&
2496
+ observed.every(
2497
+ (location) =>
2498
+ input.identities.resolve(location).key ===
2499
+ input.identities.resolve(path.dirname(changed)).key,
2500
+ ))
2501
+ ) {
2502
+ return changed;
2503
+ }
2504
+ }
2505
+ return observed.length === 1 ? observed[0] : undefined;
2400
2506
  }
2401
2507
 
2402
2508
  function projectInputChangedPaths(input: {
@@ -2425,171 +2531,6 @@ function projectInputChangedPaths(input: {
2425
2531
  return [...changed.values()];
2426
2532
  }
2427
2533
 
2428
- /**
2429
- * Classify an exact execution-selection input ahead of ordinary project data.
2430
- *
2431
- * `changedInputs` carries fingerprint or membership deltas, so a filename-less
2432
- * event can still select the cold lane. A named exact event selects the cold
2433
- * lane only after the surrounding change detector admits the event; unchanged
2434
- * bytes remain quiet before this classifier is observed.
2435
- */
2436
- export function projectInputReloadEventShouldNotify(input: {
2437
- causedBy?: readonly string[];
2438
- changed?: string;
2439
- changedInputs: readonly string[];
2440
- reloadDirectories?: readonly string[];
2441
- reloadFiles: readonly string[];
2442
- globs?: readonly string[];
2443
- }): boolean {
2444
- const identities = createProjectInputPathIdentityContext();
2445
- const reloadFiles = new Set(
2446
- input.reloadFiles.map((location) => identities.resolve(location).key),
2447
- );
2448
- const reloadDirectories = (input.reloadDirectories ?? []).map((location) =>
2449
- identities.resolve(location),
2450
- );
2451
- // Territory a declared glob is rooted at, judged against the resolution
2452
- // directory that would otherwise claim it. A project root is published as a
2453
- // resolution directory because the config lives there, so the directory a
2454
- // glob is rooted at reads as a new immediate entry the moment it appears --
2455
- // and appearing is what a declared population does. The data lane already
2456
- // reports it, with program invalidation when the membership moved, which is
2457
- // the cold-Program-same-process transition that belongs to data.
2458
- //
2459
- // Data can only carve out strictly below a resolution directory. A glob
2460
- // rooted on that directory, or above it -- `literalGlobRoot` answers with the
2461
- // volume root for a pattern with no literal prefix -- would otherwise exempt
2462
- // everything the directory exists to classify, and the selection lane would
2463
- // retire in silence. Its role predates any glob drawn around it.
2464
- //
2465
- // Only glob roots, either way. A declared file sitting directly in a
2466
- // resolution directory is still a selection surface: its own bytes are what a
2467
- // project rule reads to decide, once per execution.
2468
- const globRoots = (input.globs ?? []).map((glob) =>
2469
- identities.resolve(literalGlobRoot(glob)),
2470
- );
2471
- const exemptedFrom = (
2472
- directory: ProjectInputPathIdentity,
2473
- location: string,
2474
- ): boolean =>
2475
- globRoots.some(
2476
- (globRoot) =>
2477
- globRoot.key !== directory.key &&
2478
- identities.isWithin(directory.path, globRoot.path) &&
2479
- identities.isWithin(globRoot.path, location),
2480
- );
2481
- // A reload directory is a non-recursive surface: its digest covers its
2482
- // immediate entries' names, kinds, and link targets, so it moves only when the
2483
- // directory itself moves or when an entry it holds directly does. Matching the
2484
- // whole subtree instead makes a resolution ancestor -- the lint config graph
2485
- // publishes every node_modules level it searched, up to the filesystem root --
2486
- // read every edit beneath it as a selection change, which restarts the sidecar
2487
- // on each keystroke and ends warm reuse for any project inside one.
2488
- const holdsAsImmediateEntry = (location: string): boolean => {
2489
- const parent = identities.resolve(path.dirname(location)).key;
2490
- return reloadDirectories.some(
2491
- (directory) =>
2492
- directory.key === parent && exemptedFrom(directory, location) === false,
2493
- );
2494
- };
2495
- const namesDirectory = (location: string): boolean => {
2496
- const key = identities.resolve(location).key;
2497
- return reloadDirectories.some((directory) => directory.key === key);
2498
- };
2499
- // A digest delta on the directory itself is the only signal there is when the
2500
- // entry that appeared is not a declared match, so it cannot simply be dropped
2501
- // -- but it also cannot say what appeared. The event being classified in the
2502
- // same pass can: when it names data, the delta it caused is that data's, and
2503
- // when it names anything else, or nothing at all, the safe reading is that
2504
- // resolution moved. A missed reselection is a wrong answer; a spare restart is
2505
- // a slow one.
2506
- const explains = (directory: ProjectInputPathIdentity): boolean => {
2507
- const causes =
2508
- input.causedBy ?? (input.changed === undefined ? [] : [input.changed]);
2509
- // Only an immediate entry can move this directory's digest, so only an
2510
- // immediate entry can account for the delta. Asking whether the event was
2511
- // data somewhere else answers a different directory's question, and one
2512
- // exemption would then cancel every other directory's evidence.
2513
- return causes.some((location) => {
2514
- const parent = identities.resolve(path.dirname(location)).key;
2515
- return parent === directory.key && exemptedFrom(directory, location);
2516
- });
2517
- };
2518
- const isReloadDirectoryEvent = (location: string): boolean =>
2519
- namesDirectory(location) || holdsAsImmediateEntry(location);
2520
- const isReloadDirectoryDelta = (location: string): boolean => {
2521
- if (holdsAsImmediateEntry(location)) return true;
2522
- const key = identities.resolve(location).key;
2523
- return reloadDirectories.some(
2524
- (directory) => directory.key === key && explains(directory) === false,
2525
- );
2526
- };
2527
- return (
2528
- (input.changed !== undefined &&
2529
- (reloadFiles.has(identities.resolve(input.changed).key) ||
2530
- isReloadDirectoryEvent(input.changed))) ||
2531
- input.changedInputs.some(
2532
- (location) =>
2533
- reloadFiles.has(identities.resolve(location).key) ||
2534
- isReloadDirectoryDelta(location),
2535
- )
2536
- );
2537
- }
2538
-
2539
- /**
2540
- * Return whether a project-input population transition can reshape a Program.
2541
- *
2542
- * JSON is data to a ProjectRule but may simultaneously be a `resolveJsonModule`
2543
- * source. TypeScript and JavaScript paths can likewise overlap a project-input
2544
- * declaration. Their creation or deletion therefore requires a cold Program
2545
- * inside the existing resident process. A filename-less event cannot identify
2546
- * the changed member and is conservatively invalidating whenever the population
2547
- * moved.
2548
- */
2549
- export function projectInputMembershipInvalidatesProgram(input: {
2550
- changed?: string;
2551
- changedInputs?: readonly string[];
2552
- contentChanged?: boolean;
2553
- next: ReadonlyMap<string, string>;
2554
- previous: ReadonlyMap<string, string>;
2555
- }): boolean {
2556
- if (
2557
- input.contentChanged === true &&
2558
- (
2559
- input.changedInputs ??
2560
- (input.changed === undefined ? [] : [input.changed])
2561
- ).some(
2562
- (location) => path.basename(location).toLowerCase() === "package.json",
2563
- )
2564
- ) {
2565
- return true;
2566
- }
2567
- if (mapsEqual(input.previous, input.next)) return false;
2568
- if (input.changed === undefined) return true;
2569
- for (const [key, location] of input.previous) {
2570
- if (
2571
- input.next.has(key) === false &&
2572
- projectInputPathMayAffectProgram(location)
2573
- ) {
2574
- return true;
2575
- }
2576
- }
2577
- for (const [key, location] of input.next) {
2578
- if (
2579
- input.previous.has(key) === false &&
2580
- projectInputPathMayAffectProgram(location)
2581
- ) {
2582
- return true;
2583
- }
2584
- }
2585
- return false;
2586
- }
2587
-
2588
- function projectInputPathMayAffectProgram(location: string): boolean {
2589
- const extension = path.extname(location).toLowerCase();
2590
- return extension === ".json" || isCompilerEmittableSourceExtension(extension);
2591
- }
2592
-
2593
2534
  function compilerMembershipChange(
2594
2535
  previous: ReadonlyMap<string, string>,
2595
2536
  next: ReadonlyMap<string, string>,
@@ -2608,10 +2549,11 @@ function projectInputCompilerMembershipChange(
2608
2549
  snapshot: ITtscProjectInputSnapshot,
2609
2550
  changed: readonly string[],
2610
2551
  ): string[] {
2552
+ const identities = createProjectInputPathIdentityContext();
2611
2553
  return changed.filter(
2612
2554
  (location) =>
2613
- matchesProjectInput(snapshot, location) &&
2614
- projectInputPathMayAffectProgram(location),
2555
+ matchesProjectInput(snapshot, location, identities) &&
2556
+ ProjectInputWatchRules.projectInputPathMayAffectProgram(location),
2615
2557
  );
2616
2558
  }
2617
2559
 
@@ -2633,9 +2575,15 @@ function projectInputCompilerMembershipProjectChanges(
2633
2575
  const changes = new Map<string, string>();
2634
2576
  for (const location of locations) {
2635
2577
  const candidate = identities.resolve(location);
2636
- const root = roots
2637
- .filter((entry) => identities.isWithin(entry.path, candidate.path))
2638
- .sort((left, right) => right.path.length - left.path.length)[0];
2578
+ let root: (typeof roots)[number] | undefined;
2579
+ for (const entry of roots) {
2580
+ if (
2581
+ identities.isWithin(entry.path, candidate.path) &&
2582
+ (root === undefined || entry.path.length > root.path.length)
2583
+ ) {
2584
+ root = entry;
2585
+ }
2586
+ }
2639
2587
  const change = root ?? candidate;
2640
2588
  changes.set(change.key, change.path);
2641
2589
  }
@@ -2644,13 +2592,14 @@ function projectInputCompilerMembershipProjectChanges(
2644
2592
 
2645
2593
  function fingerprintProjectInputMatches(
2646
2594
  matches: ReadonlyMap<string, string>,
2595
+ readDirectory: typeof fs.readdirSync,
2647
2596
  ): Map<string, string> {
2648
2597
  const fingerprints = new Map<string, string>();
2649
2598
  for (const [key, location] of matches) {
2650
2599
  fingerprints.set(
2651
2600
  key,
2652
- isDirectory(location)
2653
- ? fingerprintProjectInputDirectory(location)
2601
+ WatchPaths.isDirectory(location)
2602
+ ? fingerprintProjectInputDirectory(location, readDirectory)
2654
2603
  : fingerprintProjectInputFile(location),
2655
2604
  );
2656
2605
  }
@@ -2668,10 +2617,12 @@ function fingerprintProjectInputFile(location: string): string {
2668
2617
  }
2669
2618
  }
2670
2619
 
2671
- function fingerprintProjectInputDirectory(location: string): string {
2620
+ function fingerprintProjectInputDirectory(
2621
+ location: string,
2622
+ readDirectory: typeof fs.readdirSync,
2623
+ ): string {
2672
2624
  try {
2673
- const entries = fs
2674
- .readdirSync(location, { withFileTypes: true })
2625
+ const entries = readDirectory(location, { withFileTypes: true })
2675
2626
  .map((entry) => {
2676
2627
  const kind = entry.isDirectory()
2677
2628
  ? "directory"
@@ -2712,13 +2663,17 @@ function matchesProjectInputGlob(
2712
2663
  const candidateParts = path
2713
2664
  .relative(root.path, candidate.path)
2714
2665
  .split(path.sep);
2715
- return matchProjectInputGlobParts(
2716
- sensitive
2717
- ? patternParts
2718
- : patternParts.map((segment) => segment.toLowerCase()),
2719
- sensitive
2720
- ? candidateParts
2721
- : candidateParts.map((segment) => segment.toLowerCase()),
2666
+ // Unknown capability is an observation-routing question, not an identity
2667
+ // proof: admit either interpretation so an unproven case policy cannot hide
2668
+ // a possible declared input. The resolver retains distinct physical keys.
2669
+ return (
2670
+ (sensitive !== false &&
2671
+ matchProjectInputGlobParts(patternParts, candidateParts)) ||
2672
+ (sensitive !== true &&
2673
+ matchProjectInputGlobParts(
2674
+ patternParts.map((segment) => segment.toLowerCase()),
2675
+ candidateParts.map((segment) => segment.toLowerCase()),
2676
+ ))
2722
2677
  );
2723
2678
  }
2724
2679
 
@@ -2767,14 +2722,6 @@ function matchProjectInputGlobSegment(
2767
2722
  return new RegExp(`${source}$`, "u").test(candidate);
2768
2723
  }
2769
2724
 
2770
- function mapsEqual(
2771
- left: ReadonlyMap<string, string>,
2772
- right: ReadonlyMap<string, string>,
2773
- ): boolean {
2774
- if (left.size !== right.size) return false;
2775
- return [...left].every(([key, value]) => right.get(key) === value);
2776
- }
2777
-
2778
2725
  function arraysEqual(
2779
2726
  left: readonly string[],
2780
2727
  right: readonly string[],
@@ -2784,65 +2731,24 @@ function arraysEqual(
2784
2731
  );
2785
2732
  }
2786
2733
 
2787
- function isPathWithin(root: string, candidate: string): boolean {
2788
- const relative = path.relative(root, candidate);
2789
- return (
2790
- relative === "" ||
2791
- (relative !== ".." &&
2792
- relative.startsWith(`..${path.sep}`) === false &&
2793
- !path.isAbsolute(relative))
2794
- );
2734
+ function isRecord(value: unknown): value is Record<string, unknown> {
2735
+ return typeof value === "object" && value !== null;
2795
2736
  }
2796
2737
 
2797
2738
  /**
2798
- * Plan one compiler-directory event without relying on backend timing.
2799
- *
2800
- * POSIX file watchers own ordinary content changes. A named rename re-arms the
2801
- * replaced file; an unnamed event conservatively re-arms and reports every
2802
- * surviving tracked input below the watch root. Windows has no per-file
2803
- * watchers here, so both named and unnamed directory events report inputs.
2739
+ * What a plugin build keys a plugin input on: the digest of the files its build
2740
+ * reads from a source directory (`pluginSourceDigest`), or a file's bytes. An
2741
+ * input that cannot be read has a state of its own, so the change that made it
2742
+ * unreadable is reported and the build names the failure.
2804
2743
  */
2805
- export function planCompilerDirectoryWatchEvent(input: {
2806
- changed?: string;
2807
- event: string;
2808
- exists(location: string): boolean;
2809
- location: string;
2810
- platform: NodeJS.Platform;
2811
- trackedFiles: ReadonlyMap<string, string>;
2812
- }): CompilerDirectoryWatchEventPlan {
2813
- const candidates =
2814
- input.changed === undefined
2815
- ? [...input.trackedFiles.values()].filter(
2816
- (file) =>
2817
- input.exists(file) &&
2818
- isPathWithin(input.location, path.resolve(file)),
2819
- )
2820
- : input.trackedFiles.has(
2821
- pathKeyForPlatform(input.changed, input.platform),
2822
- ) && input.exists(input.changed)
2823
- ? [input.changed]
2824
- : [];
2825
- if (input.changed === undefined) {
2826
- return {
2827
- changes: candidates,
2828
- rearm: input.platform === "win32" ? [] : candidates,
2829
- refresh: true,
2830
- };
2831
- }
2832
- if (candidates.length === 0) {
2833
- return { changes: [], rearm: [], refresh: true };
2834
- }
2835
- if (input.platform === "win32") {
2836
- return { changes: candidates, rearm: [], refresh: false };
2837
- }
2838
- if (input.event === "rename") {
2839
- return { changes: candidates, rearm: candidates, refresh: false };
2744
+ function pluginInputState(input: string): string {
2745
+ try {
2746
+ return WatchPaths.isDirectory(input)
2747
+ ? `directory:${pluginSourceDigest(input)}`
2748
+ : `file:${fingerprintProjectInputFile(input)}`;
2749
+ } catch (error) {
2750
+ return `unreadable:${error instanceof Error ? error.message : String(error)}`;
2840
2751
  }
2841
- return { changes: [], rearm: [], refresh: false };
2842
- }
2843
-
2844
- function isRecord(value: unknown): value is Record<string, unknown> {
2845
- return typeof value === "object" && value !== null;
2846
2752
  }
2847
2753
 
2848
2754
  /**
@@ -2873,14 +2779,13 @@ function watcherRegistrationPath(location: string): string {
2873
2779
  }
2874
2780
  }
2875
2781
 
2876
- function pathKey(location: string): string {
2877
- return pathKeyForPlatform(location, process.platform);
2878
- }
2879
-
2880
- function pathKeyForPlatform(
2881
- location: string,
2882
- platform: NodeJS.Platform,
2883
- ): string {
2884
- const resolved = path.resolve(location);
2885
- return platform === "win32" ? resolved.toLowerCase() : resolved;
2782
+ /**
2783
+ * Report the actual decision inputs, without additional filesystem
2784
+ * observations.
2785
+ */
2786
+ function reportProjectInputDecision(decision: Record<string, unknown>): void {
2787
+ if (!process.env.TTSC_WATCH_DEBUG_INPUTS) return;
2788
+ process.stdout.write(
2789
+ `[ttsc:debug] project-input decision ${JSON.stringify(decision)}\n`,
2790
+ );
2886
2791
  }