ttsc 0.30.3 → 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.
- package/cmd/graphbench/main.go +2 -3
- package/cmd/graphdump/main.go +42 -16
- package/cmd/graphdump/run_declares_the_capability_its_output_carries_test.go +32 -18
- package/cmd/graphdump/run_reports_an_unknown_flag_without_exiting_the_process_test.go +10 -9
- package/cmd/graphdump/run_reports_an_unloadable_project_without_printing_a_dump_test.go +8 -7
- package/cmd/platform/command_operation_families_test.go +192 -0
- package/cmd/platform/main.go +11 -1
- package/cmd/ttsc/api_compile.go +166 -46
- package/cmd/ttsc/api_compile_branches_test.go +97 -10
- package/cmd/ttsc/api_transform.go +134 -46
- package/cmd/ttsc/api_transform_branches_test.go +10 -7
- package/cmd/ttsc/build.go +177 -68
- package/cmd/ttsc/build_branches_test.go +35 -7
- package/cmd/ttsc/cli_command_operation_families_test.go +1287 -0
- package/cmd/ttsc/cli_contract_helpers_test.go +82 -0
- package/cmd/ttsc/compiler_argument_cwd_test.go +57 -0
- package/cmd/ttsc/filter.go +31 -14
- package/cmd/ttsc/filter_resolves_flag_names_case_insensitively_test.go +10 -13
- package/cmd/ttsc/filter_strips_unknown_forwarded_flag_test.go +10 -16
- package/cmd/ttsc/flags_gen.go +2 -2
- package/cmd/ttsc/helpers_test.go +67 -10
- package/cmd/ttsc/main.go +122 -21
- package/cmd/ttsc/main_alias_branches_test.go +35 -9
- package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/ambient.d.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/main.ts +2 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/mytype.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/tsconfig.base.json +3 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestAPITransformEnvelopeCarriesReferenceGraph/tsconfig.json +5 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/index.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/decorated/main.ts +10 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/decorated/types.ts +3 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/helpers.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/isolated.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/main.ts +7 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/src/nested/model.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPICompileAndTransform/tsconfig.json +14 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPITransformUsesCurrentDirectory/index.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIAPITransformUsesCurrentDirectory/tsconfig.json +7 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildAllowsUnusedTypeParametersOnOverloadSignatures/index.ts +4 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildAllowsUnusedTypeParametersOnOverloadSignatures/tsconfig.json +11 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSemanticDiagnostics/index.ts +2 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSemanticDiagnostics/tsconfig.json +9 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSyntacticDiagnostics/index.ts +2 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksSyntacticDiagnostics/tsconfig.json +8 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksUnusedParameters/index.ts +3 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildBlocksUnusedParameters/tsconfig.json +10 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildEmitErrorRejectsManifest/index.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIProjectBuildEmitErrorRejectsManifest/tsconfig.json +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIReportsDiagnosticsWithoutEmit/index.ts +1 -0
- package/cmd/ttsc/testdata/cli_operation_families/TestCLIReportsDiagnosticsWithoutEmit/tsconfig.json +8 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/emit.json +8 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/flag-shaped.json +7 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/index.ts +2 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/nested/tsconfig.app.json +11 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/outside.json +8 -0
- package/cmd/ttsc/testdata/cli_operation_families/shared-value-one/project/tsconfig.json +8 -0
- package/cmd/ttscgraph/auxiliary_identity_state_tracks_retargets_not_source_contents_test.go +26 -15
- package/cmd/ttscgraph/disk_realpath_other.go +2 -0
- package/cmd/ttscgraph/dump.go +46 -29
- package/cmd/ttscgraph/prepared_projection.go +61 -0
- package/cmd/ttscgraph/projection_fixture_test.go +96 -0
- package/cmd/ttscgraph/run_dump_claims_artifacts_only_when_it_asked_test.go +30 -5
- package/cmd/ttscgraph/run_dump_declares_the_capability_its_output_carries_test.go +6 -1
- package/cmd/ttscgraph/run_dump_emits_only_checker_verified_member_relations_test.go +12 -5
- package/cmd/ttscgraph/run_dump_prints_the_graph_as_json_test.go +17 -12
- package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +8 -3
- package/cmd/ttscgraph/serve.go +116 -79
- package/cmd/ttscgraph/serve_adopts_a_republished_artifact_set_test.go +16 -167
- package/cmd/ttscgraph/serve_adopts_a_republished_set_over_the_shard_protocol_test.go +122 -0
- package/cmd/ttscgraph/serve_answers_a_project_that_implements_its_own_ambient_declaration_test.go +35 -7
- package/cmd/ttscgraph/serve_early_error_encode_failure_is_observable_test.go +5 -0
- package/cmd/ttscgraph/serve_error_response_still_names_its_mode_test.go +10 -5
- package/cmd/ttscgraph/serve_git_ignore_projection_test.go +150 -0
- package/cmd/ttscgraph/serve_keeps_a_startup_set_a_client_never_mentions_test.go +69 -0
- package/cmd/ttscgraph/serve_object_members_refresh_without_identity_collisions_test.go +82 -0
- package/cmd/ttscgraph/serve_phase_trace_accounts_for_load_failure_test.go +9 -3
- package/cmd/ttscgraph/serve_phase_trace_is_opt_in_and_payload_free_test.go +12 -6
- package/cmd/ttscgraph/serve_projects_an_artifact_no_source_owns_test.go +13 -16
- package/cmd/ttscgraph/serve_protocol_fails_the_stream_on_an_unaddressable_request_line_test.go +10 -9
- package/cmd/ttscgraph/serve_protocol_negotiates_incremental_shards_test.go +37 -2
- package/cmd/ttscgraph/serve_protocol_retries_session_creation_test.go +7 -2
- package/cmd/ttscgraph/serve_protocol_reuses_session_test.go +13 -3
- package/cmd/ttscgraph/serve_session_applies_source_edit_incrementally_test.go +12 -7
- package/cmd/ttscgraph/serve_session_fails_closed_on_deleted_config_test.go +12 -7
- package/cmd/ttscgraph/serve_session_fails_closed_on_invalid_config_test.go +8 -3
- package/cmd/ttscgraph/serve_session_keeps_base_url_fallback_unchanged_test.go +7 -2
- package/cmd/ttscgraph/serve_session_keeps_change_detection_live_after_initial_dump_error_test.go +66 -0
- package/cmd/ttscgraph/serve_session_keeps_esm_directory_candidate_unchanged_test.go +12 -3
- package/cmd/ttscgraph/serve_session_keeps_exports_blocked_file_candidates_unchanged_test.go +8 -3
- package/cmd/ttscgraph/serve_session_keeps_inactive_conditional_export_unchanged_test.go +12 -3
- package/cmd/ttscgraph/serve_session_keeps_lower_priority_module_candidate_unchanged_test.go +14 -8
- package/cmd/ttscgraph/serve_session_keeps_lower_priority_paths_pattern_unchanged_test.go +12 -3
- package/cmd/ttscgraph/serve_session_keeps_missing_literal_root_unchanged_test.go +7 -2
- package/cmd/ttscgraph/serve_session_keeps_nonlongest_root_dirs_candidate_unchanged_test.go +12 -3
- package/cmd/ttscgraph/serve_session_rebuilds_import_graph_change_test.go +17 -8
- package/cmd/ttscgraph/serve_session_reloads_commonjs_package_entry_for_esm_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_created_literal_root_test.go +7 -2
- package/cmd/ttscgraph/serve_session_reloads_extended_config_change_test.go +9 -4
- package/cmd/ttscgraph/serve_session_reloads_module_suffix_candidate_test.go +13 -4
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_conditional_export_test.go +13 -8
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_config_types_test.go +7 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_excluded_import_test.go +11 -3
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_export_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_import_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_path_alias_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_reference_path_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_root_dirs_target_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_type_reference_test.go +11 -2
- package/cmd/ttscgraph/serve_session_reloads_root_file_set_test.go +11 -5
- package/cmd/ttscgraph/serve_session_reloads_source_deleted_during_load_test.go +16 -9
- package/cmd/ttscgraph/serve_session_reloads_superseding_module_candidates_test.go +18 -13
- package/cmd/ttscgraph/serve_session_reloads_transitive_project_reference_test.go +14 -5
- package/cmd/ttscgraph/serve_session_reloads_when_program_plugin_linked_test.go +13 -8
- package/cmd/ttscgraph/serve_session_retries_a_pending_dump_before_unchanged_test.go +62 -0
- package/cmd/ttscgraph/serve_session_reuses_unchanged_preamble_source_test.go +21 -0
- package/cmd/ttscgraph/serve_session_reuses_unchanged_snapshot_test.go +12 -7
- package/cmd/ttscgraph/serve_session_revisits_source_edited_during_load_test.go +18 -8
- package/cmd/ttscgraph/serve_session_tolerates_os_invalid_resolution_candidate_test.go +13 -9
- package/cmd/ttscgraph/serve_session_tracks_all_module_specifier_forms_test.go +12 -3
- package/cmd/ttscgraph/serve_session_tracks_diamond_project_references_once_test.go +12 -8
- package/cmd/ttscgraph/serve_shards.go +356 -279
- package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +41 -16
- package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +14 -4
- package/cmd/ttscgraph/serve_shards_external_endpoints_test.go +18 -2
- package/cmd/ttscgraph/serve_shards_keep_source_distributed_dependencies_at_the_boundary_test.go +36 -5
- package/cmd/ttscgraph/serve_shards_match_full_dump_oracle_test.go +12 -3
- package/cmd/ttscgraph/serve_shards_merge_pending_and_new_edits_test.go +36 -3
- package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +18 -2
- package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +16 -13
- package/cmd/ttscgraph/serve_shards_rebuild_declaration_edit_test.go +14 -4
- package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +24 -5
- package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +30 -7
- package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +14 -11
- package/cmd/ttscgraph/serve_shards_retry_preserves_committed_generation_test.go +17 -7
- package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +21 -7
- package/cmd/ttscgraph/serve_snapshot_proves_its_program_without_a_second_read_test.go +57 -16
- package/cmd/ttscgraph/serve_source_encoding_test.go +133 -0
- package/cmd/ttscserver/command_operation_families_test.go +207 -0
- package/cmd/ttscserver/main.go +121 -39
- package/cmd/ttscserver/resolve_launch_uses_native_flag_authority_test.go +147 -0
- package/cmd/ttscserver/run_lsp_forwards_execute_command_advertisement_flags_test.go +7 -0
- package/cmd/ttscserver/run_lsp_prefers_tsgo_flag_test.go +13 -1
- package/cmd/ttscserver/run_lsp_reports_getwd_error_test.go +5 -0
- package/cmd/ttscserver/run_lsp_reports_server_error_test.go +10 -3
- package/cmd/ttscserver/run_lsp_uses_native_plugin_manifest_source_test.go +13 -10
- package/cmd/ttscserver/run_lsp_uses_tsgo_environment_test.go +10 -3
- package/driver/authored_region_maps_positions_around_the_preamble_test.go +95 -0
- package/driver/build_information_uses_selected_output_identity_test.go +148 -0
- package/driver/check_observations.go +67 -0
- package/driver/config_discovery.go +93 -24
- package/driver/declaration_shape.go +9 -0
- package/driver/diagnostics_preamble.go +8 -7
- package/driver/emit_containment.go +29 -8
- package/driver/emit_plugin.go +106 -36
- package/driver/emit_plugin_output.go +26 -2
- package/driver/emit_provenance.go +155 -0
- package/driver/graph.go +54 -20
- package/driver/host.go +26 -3
- package/driver/input_observation.go +78 -16
- package/driver/input_observation_test.go +34 -11
- package/driver/lsp.go +401 -30
- package/driver/overlay.go +69 -2
- package/driver/plugins.go +256 -24
- package/driver/private_result.go +43 -0
- package/driver/program.go +439 -95
- package/driver/resolution_candidates.go +63 -14
- package/driver/resolution_candidates_test.go +28 -0
- package/driver/resolutioninputs/recorder.cjs +1149 -0
- package/driver/resolutioninputs/resolutioninputs.go +37 -0
- package/driver/rewrite.go +373 -420
- package/driver/session.go +80 -12
- package/driver/sourcemap_preamble.go +38 -16
- package/driver/transform_dependencies.go +38 -10
- package/driver/transform_dependencies_declares_every_file_without_a_contributor_test.go +9 -8
- package/driver/transform_dependencies_drops_a_self_reported_dependency_test.go +7 -6
- package/driver/transform_dependencies_keys_a_reported_path_like_the_envelope_test.go +9 -9
- package/driver/transform_dependencies_requires_every_contributor_to_declare_test.go +10 -5
- package/driver/transform_dependencies_stays_silent_for_an_undeclared_contributor_test.go +8 -6
- package/driver/transform_dependencies_withdraws_completeness_after_an_unusable_dependency_test.go +9 -5
- package/driver/transform_source_map.go +388 -0
- package/driver/windowsjunction/create_preserves_existing_directory_windows_test.go +48 -0
- package/driver/windowsjunction/create_treats_paths_as_data_windows_test.go +55 -0
- package/driver/windowsjunction/windowsjunction.go +17 -1
- package/go.mod +10 -10
- package/go.sum +10 -10
- package/internal/cwd/cwd.go +13 -0
- package/internal/e2etrace/artifact.go +147 -0
- package/internal/e2etrace/completion_hints.go +35 -0
- package/internal/e2etrace/completion_hints_test.go +76 -0
- package/internal/e2etrace/e2etrace.go +303 -0
- package/internal/e2etrace/output.go +50 -0
- package/internal/graph/artifacts.go +69 -12
- package/internal/graph/artifacts_index_what_a_plugin_published_test.go +19 -8
- package/internal/graph/artifacts_survive_a_partial_rebuild_test.go +11 -12
- package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +10 -12
- package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +7 -1
- package/internal/graph/build.go +122 -38
- package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +9 -3
- package/internal/graph/build_keeps_source_distributed_dependencies_at_the_external_boundary_test.go +10 -1
- package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +10 -4
- package/internal/graph/build_releases_the_scratch_it_no_longer_reads_test.go +22 -15
- package/internal/graph/decorators.go +18 -0
- package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +9 -4
- package/internal/graph/diagnostics.go +21 -8
- package/internal/graph/doc_refs_are_the_use_the_checker_already_counts_test.go +25 -13
- package/internal/graph/doc_refs_resolve_documentation_links_test.go +19 -15
- package/internal/graph/doc_tags.go +28 -19
- package/internal/graph/doc_tags_are_claimed_before_they_are_read_test.go +16 -6
- package/internal/graph/doc_tags_capture_every_unrecognized_tag_test.go +9 -2
- package/internal/graph/doc_tags_read_only_what_the_parser_attached_test.go +12 -8
- package/internal/graph/doc_tags_stop_at_the_external_boundary_test.go +11 -1
- package/internal/graph/doc_tags_survive_line_endings_and_repeated_blocks_test.go +16 -6
- package/internal/graph/dump.go +200 -51
- package/internal/graph/dump_checkout_paths_are_stable_test.go +9 -2
- package/internal/graph/dump_diagnostics_ride_the_generation_that_built_it_test.go +10 -11
- package/internal/graph/dump_evidence_skips_leading_trivia_test.go +8 -2
- package/internal/graph/dump_is_a_function_of_the_source_test.go +12 -13
- package/internal/graph/dump_never_serializes_a_list_as_null_test.go +9 -9
- package/internal/graph/dump_path_mapper_caches_alias_resolution_test.go +10 -2
- package/internal/graph/dump_path_mapper_rejects_unportable_roots_and_collisions_test.go +53 -0
- package/internal/graph/{dump_paths_are_portable_and_injective_test.go → dump_path_mapper_uses_portable_coordinates_test.go} +8 -43
- package/internal/graph/dump_paths.go +61 -25
- package/internal/graph/dump_paths_canonicalize_windows_short_root_test.go +45 -8
- package/internal/graph/dump_rejects_provenance_only_path_errors_test.go +5 -0
- package/internal/graph/dump_serializes_the_full_graph_test.go +13 -19
- package/internal/graph/dump_symlink_project_publishes_matching_base_test.go +8 -0
- package/internal/graph/dump_uses_ecma_line_terminators_test.go +12 -6
- package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +11 -8
- package/internal/graph/edge_spans_point_to_resolved_usage_test.go +13 -5
- package/internal/graph/edges.go +44 -47
- package/internal/graph/edges_cover_class_level_references_test.go +14 -11
- package/internal/graph/enum_initializer_calls_are_edges_test.go +13 -3
- package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +19 -26
- package/internal/graph/exports.go +3 -5
- package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +9 -4
- package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +11 -5
- package/internal/graph/function_locals_do_not_collide_test.go +27 -7
- package/internal/graph/gitignore.go +25 -12
- package/internal/graph/graph.go +167 -52
- package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +11 -3
- package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +6 -0
- package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +9 -3
- package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +11 -4
- package/internal/graph/line_model.go +44 -25
- package/internal/graph/literals.go +6 -7
- package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +10 -5
- package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +15 -17
- package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +10 -9
- package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +11 -11
- package/internal/graph/literals_resolve_through_alias_indirection_test.go +11 -11
- package/internal/graph/member_relation_edges_follow_checker_validity_test.go +11 -2
- package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +11 -1
- package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +12 -7
- package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +12 -3
- package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +12 -2
- package/internal/graph/node_identity_is_position_invariant_test.go +8 -2
- package/internal/graph/node_ids_preserve_hash_bearing_components_test.go +10 -2
- package/internal/graph/node_modifiers_emit_union_strings_test.go +13 -12
- package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +12 -14
- package/internal/graph/object_literal_declarations_resolve_calls_test.go +170 -0
- package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +14 -13
- package/internal/graph/object_member_signatures_preserve_literal_whitespace_test.go +11 -7
- package/internal/graph/object_members.go +100 -1
- package/internal/graph/overload_implementation_replaces_signature_test.go +13 -2
- package/internal/graph/property_member_edges_remain_owner_visible_test.go +9 -3
- package/internal/graph/provenance.go +172 -87
- package/internal/graph/resolve.go +46 -12
- package/internal/graph/resolve_prefers_implementation_declaration_test.go +10 -2
- package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +16 -20
- package/internal/graph/source.go +16 -6
- package/internal/graph/source_texts_cover_every_resident_program_source_test.go +11 -7
- package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +21 -2
- package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +8 -3
- package/internal/graph/value_access_edges_cover_properties_test.go +11 -3
- package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +10 -4
- package/internal/graph/value_call_edges_cover_jsx_components_test.go +12 -8
- package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +12 -9
- package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +9 -3
- package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +10 -3
- package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +12 -9
- package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +10 -3
- package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +16 -5
- package/internal/graph/wire_node_ids_share_alias_resolution_test.go +10 -4
- package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +16 -4
- package/internal/graphsymbols/provider.go +278 -113
- package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +14 -12
- package/internal/lspserver/lsp_completion_gate_never_refuses_a_matching_line_test.go +7 -1
- package/internal/lspserver/lsp_completion_hints_longest_trigger_wins_test.go +30 -5
- package/internal/lspserver/lsp_completion_hints_nearest_trigger_wins_test.go +5 -0
- package/internal/lspserver/lsp_completion_merges_into_upstream_response_test.go +23 -10
- package/internal/lspserver/lsp_completion_nearest_hint_replaces_nearest_filter_test.go +7 -1
- package/internal/lspserver/lsp_completion_preserves_completion_list_extensions_test.go +13 -5
- package/internal/lspserver/lsp_completion_refuses_hints_inside_a_string_literal_test.go +11 -7
- package/internal/lspserver/lsp_completion_replaces_full_filter_in_rank_order_test.go +12 -2
- package/internal/lspserver/lsp_completion_request.go +5 -26
- package/internal/lspserver/lsp_completion_scope.go +13 -10
- package/internal/lspserver/lsp_completion_scope_bench_test.go +11 -5
- package/internal/lspserver/lsp_completion_scope_classifies_regex_statement_and_operator_boundaries_test.go +8 -1
- package/internal/lspserver/lsp_completion_scope_ignores_jsdoc_bytes_in_literals_test.go +11 -10
- package/internal/lspserver/lsp_completion_scope_refuses_regex_hints_test.go +7 -3
- package/internal/lspserver/lsp_completion_trigger_uses_last_rune_test.go +6 -0
- package/internal/lspserver/lsp_deleted_watched_file_withdraws_plugin_diagnostics_test.go +11 -10
- package/internal/lspserver/lsp_didsave_keeps_the_incremental_changed_uri_path_test.go +12 -9
- package/internal/lspserver/lsp_document_diagnostics_omits_cached_project_when_current_result_has_none_test.go +17 -5
- package/internal/lspserver/lsp_envelope.go +84 -11
- package/internal/lspserver/lsp_executable_project_input_change_requests_launcher_restart_test.go +12 -9
- package/internal/lspserver/lsp_external_watched_change_retains_program_test.go +8 -2
- package/internal/lspserver/lsp_frame.go +42 -10
- package/internal/lspserver/lsp_hints_absence_is_not_an_error_test.go +16 -15
- package/internal/lspserver/lsp_hints_refresh_coalesces_concurrent_requests_test.go +21 -12
- package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +20 -12
- package/internal/lspserver/lsp_hints_refresh_keeps_each_producer_isolated_test.go +30 -9
- package/internal/lspserver/lsp_hints_refresh_replaces_the_session_snapshot_test.go +25 -18
- package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +12 -12
- package/internal/lspserver/lsp_hints_refresh_serves_completion_while_running_test.go +21 -8
- package/internal/lspserver/lsp_index_byte_from_bounds_its_search_start_test.go +9 -7
- package/internal/lspserver/lsp_initialize_constrains_position_encoding_to_utf16_test.go +57 -21
- package/internal/lspserver/lsp_late_completion_trigger_is_reported_once_test.go +16 -17
- package/internal/lspserver/lsp_native_completion_hints_decode_flat_lint_wire_test.go +8 -2
- package/internal/lspserver/lsp_native_completion_hints_grouped_compatibility_boundary_test.go +5 -0
- package/internal/lspserver/lsp_native_plugin_source.go +381 -202
- package/internal/lspserver/lsp_native_plugin_source_ends_the_session_on_a_selection_input_test.go +234 -0
- package/internal/lspserver/lsp_native_reply_policies_test.go +475 -0
- package/internal/lspserver/lsp_native_reply_policy.go +232 -0
- package/internal/lspserver/lsp_native_resident.go +171 -57
- package/internal/lspserver/lsp_plugin.go +372 -68
- package/internal/lspserver/lsp_plugin_completion_resolve_stays_local_test.go +13 -4
- package/internal/lspserver/lsp_plugin_selection_inputs.go +283 -0
- package/internal/lspserver/lsp_plugin_selection_inputs_follow_directory_case_semantics_windows_test.go +81 -0
- package/internal/lspserver/lsp_position_conversions_span_astral_and_combining_runes_test.go +33 -11
- package/internal/lspserver/lsp_project_context_transport_identity_test.go +14 -2
- package/internal/lspserver/lsp_project_diagnostics.go +25 -4
- package/internal/lspserver/lsp_project_diagnostics_capability_is_independent_test.go +13 -2
- package/internal/lspserver/lsp_project_diagnostics_program_input_overlap_refreshes_all_producers_test.go +14 -4
- package/internal/lspserver/lsp_project_diagnostics_refresh_accumulates_owner_freshness_test.go +8 -2
- package/internal/lspserver/lsp_project_diagnostics_refresh_keeps_each_producer_last_good_test.go +10 -5
- package/internal/lspserver/lsp_project_diagnostics_refreshes_only_input_owners_test.go +14 -2
- package/internal/lspserver/lsp_project_diagnostics_resume_preserves_generation_test.go +8 -2
- package/internal/lspserver/lsp_project_diagnostics_translates_relative_client_project_test.go +15 -11
- package/internal/lspserver/lsp_project_input_ownership_resolves_declared_spellings_test.go +17 -8
- package/internal/lspserver/lsp_project_input_path_key_windows.go +16 -16
- package/internal/lspserver/lsp_project_input_path_key_windows_test.go +34 -18
- package/internal/lspserver/lsp_project_input_registration.go +5 -1
- package/internal/lspserver/lsp_project_input_registration_rechecks_selection_baseline_test.go +10 -4
- package/internal/lspserver/lsp_project_input_registration_reconciles_rejected_pending_request_test.go +5 -0
- package/internal/lspserver/lsp_project_input_registration_shapes_patterns_test.go +9 -3
- package/internal/lspserver/lsp_project_input_watchers_anchor_missing_paths_test.go +8 -3
- package/internal/lspserver/lsp_project_inputs.go +203 -59
- package/internal/lspserver/lsp_project_inputs_match_missing_exact_and_glob_test.go +10 -6
- package/internal/lspserver/lsp_project_inputs_reject_invalid_and_foreign_snapshots_test.go +25 -2
- package/internal/lspserver/lsp_proxy.go +239 -80
- package/internal/lspserver/lsp_refresh.go +16 -1
- package/internal/lspserver/lsp_reload_directories_compare_immediate_topology_test.go +66 -19
- package/internal/lspserver/lsp_reload_directories_separate_glob_territory_test.go +26 -6
- package/internal/lspserver/lsp_reload_file_fingerprint_preserves_raw_symlink_target_test.go +12 -6
- package/internal/lspserver/lsp_reload_fingerprints_read_a_junction_as_a_link_test.go +76 -0
- package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +20 -13
- package/internal/lspserver/lsp_resident_invalidation_broadcasts_program_input_overlap_test.go +9 -4
- package/internal/lspserver/lsp_resident_invalidation_targets_project_input_owners_test.go +6 -1
- package/internal/lspserver/lsp_resident_maps_verb_args_test.go +5 -0
- package/internal/lspserver/lsp_same_transport_entries_are_deduplicated_test.go +10 -1
- package/internal/lspserver/lsp_server.go +124 -21
- package/internal/lspserver/lsp_symbols.go +92 -13
- package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +11 -10
- package/internal/sourceprocess/complete_group.go +70 -0
- package/internal/sourceprocess/complete_group_preserves_original_wait_and_requires_independent_absence_test.go +145 -0
- package/internal/sourceprocess/contain_unix.go +143 -0
- package/internal/sourceprocess/contain_windows.go +442 -0
- package/internal/sourceprocess/darwin_group_retirement_preserves_phase_evidence_test.go +287 -0
- package/internal/sourceprocess/observe_exit_darwin.go +57 -0
- package/internal/sourceprocess/observe_exit_linux.go +27 -0
- package/internal/sourceprocess/observe_exit_other.go +11 -0
- package/internal/sourceprocess/reap_linux.go +31 -0
- package/internal/sourceprocess/reap_other.go +10 -0
- package/internal/sourceprocess/request_preserves_native_command_inputs_test.go +86 -0
- package/internal/sourceprocess/run.go +216 -0
- package/internal/sourceprocess/target_windows.go +211 -0
- package/internal/sourceprocess/windows_job_accounting_rejects_invalid_boundary_test.go +97 -0
- package/internal/sourceprocess/windows_target_owns_suspended_admission_test.go +179 -0
- package/internal/watchhelper/run.go +32 -0
- package/internal/watchhelper/run_linux.go +323 -0
- package/internal/watchhelper/run_linux_test.go +418 -0
- package/internal/watchhelper/run_other.go +16 -0
- package/internal/watchhelper/watchhelper.go +100 -0
- package/lib/TtscCompiler.d.ts +118 -21
- package/lib/TtscCompiler.js +175 -179
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/TtscService.d.ts +66 -18
- package/lib/TtscService.js +81 -24
- package/lib/TtscService.js.map +1 -1
- package/lib/TtscServiceRequestOptions.d.ts +21 -0
- package/lib/TtscServiceRequestOptions.js +3 -0
- package/lib/TtscServiceRequestOptions.js.map +1 -0
- package/lib/compiler/internal/CapturedProcessOutput.d.ts +61 -0
- package/lib/compiler/internal/CapturedProcessOutput.js +3 -0
- package/lib/compiler/internal/CapturedProcessOutput.js.map +1 -0
- package/lib/compiler/internal/CompilerArgumentsInspection.d.ts +53 -0
- package/lib/compiler/internal/CompilerArgumentsInspection.js +173 -0
- package/lib/compiler/internal/CompilerArgumentsInspection.js.map +1 -0
- package/lib/compiler/internal/EmitOwnershipIndex.d.ts +92 -0
- package/lib/compiler/internal/EmitOwnershipIndex.js +215 -0
- package/lib/compiler/internal/EmitOwnershipIndex.js.map +1 -0
- package/lib/compiler/internal/PrivateCompilerOutput.d.ts +67 -0
- package/lib/compiler/internal/PrivateCompilerOutput.js +245 -0
- package/lib/compiler/internal/PrivateCompilerOutput.js.map +1 -0
- package/lib/compiler/internal/ResidentCheckProcess.d.ts +127 -0
- package/lib/compiler/internal/ResidentCheckProcess.js +403 -0
- package/lib/compiler/internal/ResidentCheckProcess.js.map +1 -0
- package/lib/compiler/internal/ResidentCheckProcessOptions.d.ts +29 -0
- package/lib/compiler/internal/ResidentCheckProcessOptions.js +3 -0
- package/lib/compiler/internal/ResidentCheckProcessOptions.js.map +1 -0
- package/lib/compiler/internal/ResidentCheckRequest.d.ts +37 -0
- package/lib/compiler/internal/ResidentCheckRequest.js +3 -0
- package/lib/compiler/internal/ResidentCheckRequest.js.map +1 -0
- package/lib/compiler/internal/ResidentCheckResult.d.ts +23 -0
- package/lib/compiler/internal/ResidentCheckResult.js +3 -0
- package/lib/compiler/internal/ResidentCheckResult.js.map +1 -0
- package/lib/compiler/internal/ResidentCheckTelemetry.d.ts +33 -0
- package/lib/compiler/internal/ResidentCheckTelemetry.js +3 -0
- package/lib/compiler/internal/ResidentCheckTelemetry.js.map +1 -0
- package/lib/compiler/internal/ResidentReplyKind.d.ts +18 -0
- package/lib/compiler/internal/ResidentReplyKind.js +3 -0
- package/lib/compiler/internal/ResidentReplyKind.js.map +1 -0
- package/lib/compiler/internal/ResidentTransformProcess.d.ts +83 -0
- package/lib/compiler/internal/ResidentTransformProcess.js +261 -0
- package/lib/compiler/internal/ResidentTransformProcess.js.map +1 -0
- package/lib/compiler/internal/ResidentTransformProcessOptions.d.ts +27 -0
- package/lib/compiler/internal/ResidentTransformProcessOptions.js +3 -0
- package/lib/compiler/internal/ResidentTransformProcessOptions.js.map +1 -0
- package/lib/compiler/internal/ResidentTransformReply.d.ts +51 -0
- package/lib/compiler/internal/ResidentTransformReply.js +79 -0
- package/lib/compiler/internal/ResidentTransformReply.js.map +1 -0
- package/lib/compiler/internal/ResidentTransformRequestOptions.d.ts +16 -0
- package/lib/compiler/internal/ResidentTransformRequestOptions.js +3 -0
- package/lib/compiler/internal/ResidentTransformRequestOptions.js.map +1 -0
- package/lib/compiler/internal/ResidentTransformRequests.d.ts +102 -0
- package/lib/compiler/internal/ResidentTransformRequests.js +172 -0
- package/lib/compiler/internal/ResidentTransformRequests.js.map +1 -0
- package/lib/compiler/internal/StartedResidentTransform.d.ts +27 -0
- package/lib/compiler/internal/StartedResidentTransform.js +3 -0
- package/lib/compiler/internal/StartedResidentTransform.js.map +1 -0
- package/lib/compiler/internal/TransformProjectWorkerReply.d.ts +34 -0
- package/lib/compiler/internal/TransformProjectWorkerReply.js +3 -0
- package/lib/compiler/internal/TransformProjectWorkerReply.js.map +1 -0
- package/lib/compiler/internal/TransformProjectWorkerRequest.d.ts +39 -0
- package/lib/compiler/internal/TransformProjectWorkerRequest.js +3 -0
- package/lib/compiler/internal/TransformProjectWorkerRequest.js.map +1 -0
- package/lib/compiler/internal/build/BuildExecution.d.ts +359 -0
- package/lib/compiler/internal/build/BuildExecution.js +977 -0
- package/lib/compiler/internal/build/BuildExecution.js.map +1 -0
- package/lib/compiler/internal/build/BuildTiming.d.ts +99 -0
- package/lib/compiler/internal/build/BuildTiming.js +113 -0
- package/lib/compiler/internal/build/BuildTiming.js.map +1 -0
- package/lib/compiler/internal/build/CompilerDiagnostics.d.ts +82 -0
- package/lib/compiler/internal/build/CompilerDiagnostics.js +270 -0
- package/lib/compiler/internal/build/CompilerDiagnostics.js.map +1 -0
- package/lib/compiler/internal/build/NativePluginArguments.d.ts +114 -0
- package/lib/compiler/internal/build/NativePluginArguments.js +255 -0
- package/lib/compiler/internal/build/NativePluginArguments.js.map +1 -0
- package/lib/compiler/internal/build/PassthroughFlags.d.ts +137 -0
- package/lib/compiler/internal/build/PassthroughFlags.js +213 -0
- package/lib/compiler/internal/build/PassthroughFlags.js.map +1 -0
- package/lib/compiler/internal/build/PluginFailureDiagnostics.d.ts +48 -0
- package/lib/compiler/internal/build/PluginFailureDiagnostics.js +68 -0
- package/lib/compiler/internal/build/PluginFailureDiagnostics.js.map +1 -0
- package/lib/compiler/internal/build/ResidentCheckEntryPlan.d.ts +38 -0
- package/lib/compiler/internal/build/ResidentCheckEntryPlan.js +3 -0
- package/lib/compiler/internal/build/ResidentCheckEntryPlan.js.map +1 -0
- package/lib/compiler/internal/build/ResidentCheckWatchChange.d.ts +30 -0
- package/lib/compiler/internal/build/ResidentCheckWatchChange.js +3 -0
- package/lib/compiler/internal/build/ResidentCheckWatchChange.js.map +1 -0
- package/lib/compiler/internal/build/ResidentCheckWatchSession.d.ts +113 -0
- package/lib/compiler/internal/build/ResidentCheckWatchSession.js +378 -0
- package/lib/compiler/internal/build/ResidentCheckWatchSession.js.map +1 -0
- package/lib/compiler/internal/build/RunBuildOptions.d.ts +130 -0
- package/lib/compiler/internal/build/RunBuildOptions.js +3 -0
- package/lib/compiler/internal/build/RunBuildOptions.js.map +1 -0
- package/lib/compiler/internal/build/TsgoArguments.d.ts +168 -0
- package/lib/compiler/internal/build/TsgoArguments.js +324 -0
- package/lib/compiler/internal/build/TsgoArguments.js.map +1 -0
- package/lib/compiler/internal/build/appendBuildOutput.d.ts +41 -0
- package/lib/compiler/internal/build/appendBuildOutput.js +182 -0
- package/lib/compiler/internal/build/appendBuildOutput.js.map +1 -0
- package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.d.ts +20 -0
- package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.js +40 -0
- package/lib/compiler/internal/build/bufferResidentCheckEntryRequests.js.map +1 -0
- package/lib/compiler/internal/build/createProcessDiagnostic.d.ts +19 -0
- package/lib/compiler/internal/build/createProcessDiagnostic.js +30 -0
- package/lib/compiler/internal/build/createProcessDiagnostic.js.map +1 -0
- package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.d.ts +22 -0
- package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.js +59 -0
- package/lib/compiler/internal/build/isAbsoluteLocalProjectInputPath.js.map +1 -0
- package/lib/compiler/internal/build/mergeProjectInputSnapshots.d.ts +28 -0
- package/lib/compiler/internal/build/mergeProjectInputSnapshots.js +121 -0
- package/lib/compiler/internal/build/mergeProjectInputSnapshots.js.map +1 -0
- package/lib/compiler/internal/build/normalizeBuildOutput.d.ts +29 -0
- package/lib/compiler/internal/build/normalizeBuildOutput.js +72 -0
- package/lib/compiler/internal/build/normalizeBuildOutput.js.map +1 -0
- package/lib/compiler/internal/build/parseProjectInputSnapshot.d.ts +26 -0
- package/lib/compiler/internal/build/parseProjectInputSnapshot.js +68 -0
- package/lib/compiler/internal/build/parseProjectInputSnapshot.js.map +1 -0
- package/lib/compiler/internal/build/planResidentCheckEntries.d.ts +21 -0
- package/lib/compiler/internal/build/planResidentCheckEntries.js +45 -0
- package/lib/compiler/internal/build/planResidentCheckEntries.js.map +1 -0
- package/lib/compiler/internal/build/privateRuntimeRootDir.d.ts +20 -0
- package/lib/compiler/internal/build/privateRuntimeRootDir.js +35 -0
- package/lib/compiler/internal/build/privateRuntimeRootDir.js.map +1 -0
- package/lib/compiler/internal/build/residentCheckRequest.d.ts +22 -0
- package/lib/compiler/internal/build/residentCheckRequest.js +42 -0
- package/lib/compiler/internal/build/residentCheckRequest.js.map +1 -0
- package/lib/compiler/internal/build/runBuild.d.ts +22 -0
- package/lib/compiler/internal/build/runBuild.js +44 -0
- package/lib/compiler/internal/build/runBuild.js.map +1 -0
- package/lib/compiler/internal/build/runExternalEmitProvenance.d.ts +61 -0
- package/lib/compiler/internal/build/runExternalEmitProvenance.js +451 -0
- package/lib/compiler/internal/build/runExternalEmitProvenance.js.map +1 -0
- package/lib/compiler/internal/build/takeResidentCheckEntryRequest.d.ts +18 -0
- package/lib/compiler/internal/build/takeResidentCheckEntryRequest.js +28 -0
- package/lib/compiler/internal/build/takeResidentCheckEntryRequest.js.map +1 -0
- package/lib/compiler/internal/buildNativeCompiler.d.ts +16 -1
- package/lib/compiler/internal/buildNativeCompiler.js +14 -2
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/compiler/internal/captureProcessOutput.d.ts +23 -21
- package/lib/compiler/internal/captureProcessOutput.js +40 -26
- package/lib/compiler/internal/captureProcessOutput.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.d.ts +30 -7
- package/lib/compiler/internal/compileProjectInMemory.js +103 -83
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/ensureExecutable.d.ts +15 -0
- package/lib/compiler/internal/ensureExecutable.js +40 -0
- package/lib/compiler/internal/ensureExecutable.js.map +1 -0
- package/lib/compiler/internal/findNearestGoMod.d.ts +23 -0
- package/lib/compiler/internal/findNearestGoMod.js +48 -0
- package/lib/compiler/internal/findNearestGoMod.js.map +1 -0
- package/lib/compiler/internal/isOutsideRelativePath.d.ts +18 -0
- package/lib/compiler/internal/isOutsideRelativePath.js +30 -0
- package/lib/compiler/internal/isOutsideRelativePath.js.map +1 -0
- package/lib/compiler/internal/outputText.d.ts +16 -0
- package/lib/compiler/internal/outputText.js +25 -0
- package/lib/compiler/internal/outputText.js.map +1 -0
- package/lib/compiler/internal/packageRootDir.d.ts +25 -0
- package/lib/compiler/internal/packageRootDir.js +47 -0
- package/lib/compiler/internal/packageRootDir.js.map +1 -0
- package/lib/compiler/internal/parseNativeTransformOutput.d.ts +88 -0
- package/lib/compiler/internal/parseNativeTransformOutput.js +552 -0
- package/lib/compiler/internal/parseNativeTransformOutput.js.map +1 -0
- package/lib/compiler/internal/project/CompilerProjectSelection.d.ts +80 -0
- package/lib/compiler/internal/project/CompilerProjectSelection.js +187 -0
- package/lib/compiler/internal/project/CompilerProjectSelection.js.map +1 -0
- package/lib/compiler/internal/project/ConfigJsonText.d.ts +50 -0
- package/lib/compiler/internal/project/ConfigJsonText.js +61 -0
- package/lib/compiler/internal/project/ConfigJsonText.js.map +1 -0
- package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.d.ts +48 -0
- package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.js +119 -0
- package/lib/compiler/internal/project/compilerUsesCaseSensitiveFileNames.js.map +1 -0
- package/lib/compiler/internal/project/createNativeProjectContextArgs.d.ts +11 -8
- package/lib/compiler/internal/project/createNativeProjectContextArgs.js +15 -17
- package/lib/compiler/internal/project/createNativeProjectContextArgs.js.map +1 -1
- package/lib/compiler/internal/project/createNativeProjectContextJson.d.ts +19 -0
- package/lib/compiler/internal/project/createNativeProjectContextJson.js +27 -0
- package/lib/compiler/internal/project/createNativeProjectContextJson.js.map +1 -0
- package/lib/compiler/internal/project/parseJsonc.d.ts +42 -0
- package/lib/compiler/internal/project/parseJsonc.js +317 -0
- package/lib/compiler/internal/project/parseJsonc.js.map +1 -0
- package/lib/compiler/internal/project/readJsonFile.d.ts +21 -0
- package/lib/compiler/internal/project/readJsonFile.js +38 -0
- package/lib/compiler/internal/project/readJsonFile.js.map +1 -0
- package/lib/compiler/internal/project/readJsoncFile.d.ts +20 -0
- package/lib/compiler/internal/project/readJsoncFile.js +47 -0
- package/lib/compiler/internal/project/readJsoncFile.js.map +1 -0
- package/lib/compiler/internal/project/readProjectConfig.d.ts +29 -2
- package/lib/compiler/internal/project/readProjectConfig.js +105 -168
- package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
- package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +65 -0
- package/lib/compiler/internal/project/resolveOwningProjectConfig.js +248 -0
- package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -0
- package/lib/compiler/internal/project/resolveProjectConfig.d.ts +17 -14
- package/lib/compiler/internal/project/resolveProjectConfig.js +19 -122
- package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -1
- package/lib/compiler/internal/project/resolveProjectIdentity.d.ts +32 -0
- package/lib/compiler/internal/project/resolveProjectIdentity.js +144 -0
- package/lib/compiler/internal/project/resolveProjectIdentity.js.map +1 -0
- package/lib/compiler/internal/project/resolveTsconfigExtends.d.ts +38 -0
- package/lib/compiler/internal/project/resolveTsconfigExtends.js +163 -0
- package/lib/compiler/internal/project/resolveTsconfigExtends.js.map +1 -0
- package/lib/compiler/internal/project/selectReferencedProject.d.ts +26 -0
- package/lib/compiler/internal/project/selectReferencedProject.js +48 -0
- package/lib/compiler/internal/project/selectReferencedProject.js.map +1 -0
- package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.d.ts +34 -0
- package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.js +55 -0
- package/lib/compiler/internal/project/tsconfigExtendsFileCandidates.js.map +1 -0
- package/lib/compiler/internal/readEffectiveCompilerOptions.d.ts +54 -0
- package/lib/compiler/internal/readEffectiveCompilerOptions.js +116 -0
- package/lib/compiler/internal/readEffectiveCompilerOptions.js.map +1 -0
- package/lib/compiler/internal/resolveBinary.d.ts +17 -1
- package/lib/compiler/internal/resolveBinary.js +24 -9
- package/lib/compiler/internal/resolveBinary.js.map +1 -1
- package/lib/compiler/internal/resolveTsgo.d.ts +22 -7
- package/lib/compiler/internal/resolveTsgo.js +25 -9
- package/lib/compiler/internal/resolveTsgo.js.map +1 -1
- package/lib/compiler/internal/runNativeCheckWithObservations.d.ts +41 -0
- package/lib/compiler/internal/runNativeCheckWithObservations.js +185 -0
- package/lib/compiler/internal/runNativeCheckWithObservations.js.map +1 -0
- package/lib/compiler/internal/runSingleFileEmit.d.ts +26 -5
- package/lib/compiler/internal/runSingleFileEmit.js +82 -27
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.d.ts +2 -0
- package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.js +6 -0
- package/lib/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.js.map +1 -0
- package/lib/compiler/internal/sharedHost/SidecarEnvironment.d.ts +90 -0
- package/lib/compiler/internal/sharedHost/SidecarEnvironment.js +153 -0
- package/lib/compiler/internal/sharedHost/SidecarEnvironment.js.map +1 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.d.ts +7 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.js +11 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.js.map +1 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.d.ts +7 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.js +11 -0
- package/lib/compiler/internal/sharedHost/TSGO_ARGS_ENV.js.map +1 -0
- package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.d.ts +24 -0
- package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.js +46 -0
- package/lib/compiler/internal/sharedHost/assertSharedHostCompatibility.js.map +1 -0
- package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.d.ts +15 -0
- package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.js +23 -0
- package/lib/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.js.map +1 -0
- package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.d.ts +23 -0
- package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.js +33 -0
- package/lib/compiler/internal/sharedHost/clearInheritedTsgoArgs.js.map +1 -0
- package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.d.ts +27 -0
- package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.js +41 -0
- package/lib/compiler/internal/sharedHost/inheritedSidecarEnv.js.map +1 -0
- package/lib/compiler/internal/sharedHost/isLinkedTransform.d.ts +16 -0
- package/lib/compiler/internal/sharedHost/isLinkedTransform.js +21 -0
- package/lib/compiler/internal/sharedHost/isLinkedTransform.js.map +1 -0
- package/lib/compiler/internal/sharedHost/linkedTransformPlugins.d.ts +19 -0
- package/lib/compiler/internal/sharedHost/linkedTransformPlugins.js +25 -0
- package/lib/compiler/internal/sharedHost/linkedTransformPlugins.js.map +1 -0
- package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.d.ts +25 -0
- package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.js +35 -0
- package/lib/compiler/internal/sharedHost/publishLinkedTransformPlugins.js.map +1 -0
- package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.d.ts +26 -0
- package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.js +36 -0
- package/lib/compiler/internal/sharedHost/resolvePluginConfigDir.js.map +1 -0
- package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.d.ts +22 -0
- package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.js +32 -0
- package/lib/compiler/internal/sharedHost/selectSharedHostPlugin.js.map +1 -0
- package/lib/compiler/internal/spawnNative.d.ts +15 -16
- package/lib/compiler/internal/spawnNative.js +20 -48
- package/lib/compiler/internal/spawnNative.js.map +1 -1
- package/lib/compiler/internal/startResidentTransform.d.ts +26 -17
- package/lib/compiler/internal/startResidentTransform.js +51 -36
- package/lib/compiler/internal/startResidentTransform.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.d.ts +42 -5
- package/lib/compiler/internal/transformProjectInMemory.js +197 -471
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/transformProjectInWorker.d.ts +49 -0
- package/lib/compiler/internal/transformProjectInWorker.js +168 -0
- package/lib/compiler/internal/transformProjectInWorker.js.map +1 -0
- package/lib/compiler/internal/transformProjectWorker.js +37 -0
- package/lib/compiler/internal/transformProjectWorker.js.map +1 -0
- package/lib/flags/AnySubcommand.d.ts +18 -0
- package/lib/flags/AnySubcommand.js +3 -0
- package/lib/flags/AnySubcommand.js.map +1 -0
- package/lib/flags/COMPILER_ENUM_WHITESPACE.d.ts +2 -0
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js +38 -0
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -0
- package/lib/flags/COMPILER_OPTIONS.d.ts +6 -0
- package/lib/flags/COMPILER_OPTIONS.js +509 -0
- package/lib/flags/COMPILER_OPTIONS.js.map +1 -0
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.d.ts +2 -0
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +13 -0
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -0
- package/lib/flags/COMPILER_OPTION_KINDS.d.ts +2 -0
- package/lib/flags/COMPILER_OPTION_KINDS.js +14 -0
- package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -0
- package/lib/flags/CompilerOptionSpec.d.ts +27 -0
- package/lib/flags/CompilerOptionSpec.js +3 -0
- package/lib/flags/CompilerOptionSpec.js.map +1 -0
- package/lib/flags/FLAG_BY_TOKEN.d.ts +8 -0
- package/lib/flags/FLAG_BY_TOKEN.js +34 -0
- package/lib/flags/FLAG_BY_TOKEN.js.map +1 -0
- package/lib/flags/FLAG_SCHEMA.d.ts +35 -0
- package/lib/flags/{schema.js → FLAG_SCHEMA.js} +47 -153
- package/lib/flags/FLAG_SCHEMA.js.map +1 -0
- package/lib/flags/FlagKind.d.ts +22 -0
- package/lib/flags/FlagKind.js +3 -0
- package/lib/flags/FlagKind.js.map +1 -0
- package/lib/flags/FlagLayer.d.ts +19 -0
- package/lib/flags/FlagLayer.js +3 -0
- package/lib/flags/FlagLayer.js.map +1 -0
- package/lib/flags/FlagSpec.d.ts +104 -0
- package/lib/flags/FlagSpec.js +3 -0
- package/lib/flags/FlagSpec.js.map +1 -0
- package/lib/flags/ParseOptions.d.ts +92 -0
- package/lib/flags/ParseOptions.js +3 -0
- package/lib/flags/ParseOptions.js.map +1 -0
- package/lib/flags/ParseResult.d.ts +37 -0
- package/lib/flags/ParseResult.js +3 -0
- package/lib/flags/ParseResult.js.map +1 -0
- package/lib/flags/TtscSubcommand.d.ts +14 -0
- package/lib/flags/TtscSubcommand.js +3 -0
- package/lib/flags/TtscSubcommand.js.map +1 -0
- package/lib/flags/TtsxSubcommand.d.ts +13 -0
- package/lib/flags/TtsxSubcommand.js +3 -0
- package/lib/flags/TtsxSubcommand.js.map +1 -0
- package/lib/flags/ValueValidator.d.ts +14 -0
- package/lib/flags/ValueValidator.js +3 -0
- package/lib/flags/ValueValidator.js.map +1 -0
- package/lib/flags/buildGoAllowList.d.ts +18 -0
- package/lib/flags/buildGoAllowList.js +45 -0
- package/lib/flags/buildGoAllowList.js.map +1 -0
- package/lib/flags/flagsForSubcommand.d.ts +18 -0
- package/lib/flags/flagsForSubcommand.js +23 -0
- package/lib/flags/flagsForSubcommand.js.map +1 -0
- package/lib/flags/getBoolean.d.ts +19 -0
- package/lib/flags/getBoolean.js +27 -0
- package/lib/flags/getBoolean.js.map +1 -0
- package/lib/flags/getNumber.d.ts +16 -0
- package/lib/flags/getNumber.js +24 -0
- package/lib/flags/getNumber.js.map +1 -0
- package/lib/flags/getString.d.ts +16 -0
- package/lib/flags/getString.js +24 -0
- package/lib/flags/getString.js.map +1 -0
- package/lib/flags/getStringList.d.ts +19 -0
- package/lib/flags/getStringList.js +24 -0
- package/lib/flags/getStringList.js.map +1 -0
- package/lib/flags/normalizeCompilerEnumValue.d.ts +20 -0
- package/lib/flags/normalizeCompilerEnumValue.js +40 -0
- package/lib/flags/normalizeCompilerEnumValue.js.map +1 -0
- package/lib/flags/normalizeFlagToken.d.ts +28 -0
- package/lib/flags/normalizeFlagToken.js +38 -0
- package/lib/flags/normalizeFlagToken.js.map +1 -0
- package/lib/flags/parseFlags.d.ts +18 -0
- package/lib/flags/parseFlags.js +288 -0
- package/lib/flags/parseFlags.js.map +1 -0
- package/lib/flags/readCompilerOptionOccurrence.d.ts +34 -0
- package/lib/flags/readCompilerOptionOccurrence.js +81 -0
- package/lib/flags/readCompilerOptionOccurrence.js.map +1 -0
- package/lib/flags/readCompilerOptionValues.d.ts +33 -0
- package/lib/flags/readCompilerOptionValues.js +58 -0
- package/lib/flags/readCompilerOptionValues.js.map +1 -0
- package/lib/flags/resolveFlagSpec.d.ts +21 -0
- package/lib/flags/resolveFlagSpec.js +32 -0
- package/lib/flags/resolveFlagSpec.js.map +1 -0
- package/lib/index.d.ts +8 -3
- package/lib/index.js +10 -3
- package/lib/index.js.map +1 -1
- package/lib/internal/CanonicalTempDirectoryOperations.d.ts +73 -0
- package/lib/internal/CanonicalTempDirectoryOperations.js +3 -0
- package/lib/internal/CanonicalTempDirectoryOperations.js.map +1 -0
- package/lib/internal/CompilerContextSnapshot.d.ts +66 -0
- package/lib/internal/CompilerContextSnapshot.js +121 -0
- package/lib/internal/CompilerContextSnapshot.js.map +1 -0
- package/lib/internal/CompilerResultAdapter.d.ts +129 -0
- package/lib/internal/CompilerResultAdapter.js +247 -0
- package/lib/internal/CompilerResultAdapter.js.map +1 -0
- package/lib/internal/E2ETrace.d.ts +219 -0
- package/lib/internal/E2ETrace.js +541 -0
- package/lib/internal/E2ETrace.js.map +1 -0
- package/lib/internal/IJavaScriptRuntimeCapabilities.d.ts +48 -0
- package/lib/internal/IJavaScriptRuntimeCapabilities.js +3 -0
- package/lib/internal/IJavaScriptRuntimeCapabilities.js.map +1 -0
- package/lib/internal/OwnedNativeProcess.d.ts +66 -0
- package/lib/internal/OwnedNativeProcess.js +317 -0
- package/lib/internal/OwnedNativeProcess.js.map +1 -0
- package/lib/internal/OwnedSynchronousProcess.d.ts +158 -0
- package/lib/internal/OwnedSynchronousProcess.js +171 -0
- package/lib/internal/OwnedSynchronousProcess.js.map +1 -0
- package/lib/internal/RetireLockDirectoryOperations.d.ts +77 -0
- package/lib/internal/RetireLockDirectoryOperations.js +3 -0
- package/lib/internal/RetireLockDirectoryOperations.js.map +1 -0
- package/lib/internal/SafeCacheCleanupTarget.d.ts +39 -0
- package/lib/internal/SafeCacheCleanupTarget.js +3 -0
- package/lib/internal/SafeCacheCleanupTarget.js.map +1 -0
- package/lib/internal/SourceNativeRetirement.d.ts +384 -0
- package/lib/internal/SourceNativeRetirement.js +892 -0
- package/lib/internal/SourceNativeRetirement.js.map +1 -0
- package/lib/internal/SpawnSyncOutputFiles.d.ts +28 -0
- package/lib/internal/SpawnSyncOutputFiles.js +3 -0
- package/lib/internal/SpawnSyncOutputFiles.js.map +1 -0
- package/lib/internal/cacheEntryExists.d.ts +13 -0
- package/lib/internal/cacheEntryExists.js +32 -0
- package/lib/internal/cacheEntryExists.js.map +1 -0
- package/lib/internal/createCanonicalTempDirectory.d.ts +23 -13
- package/lib/internal/createCanonicalTempDirectory.js +31 -12
- package/lib/internal/createCanonicalTempDirectory.js.map +1 -1
- package/lib/internal/isContendedCandidateRename.d.ts +27 -0
- package/lib/internal/isContendedCandidateRename.js +37 -0
- package/lib/internal/isContendedCandidateRename.js.map +1 -0
- package/lib/internal/isSpawnSyncFdExhaustion.d.ts +16 -0
- package/lib/internal/isSpawnSyncFdExhaustion.js +23 -0
- package/lib/internal/isSpawnSyncFdExhaustion.js.map +1 -0
- package/lib/internal/javascriptRuntimeCapabilities.d.ts +20 -0
- package/lib/internal/javascriptRuntimeCapabilities.js +142 -0
- package/lib/internal/javascriptRuntimeCapabilities.js.map +1 -0
- package/lib/internal/nativeBinary.d.ts +11 -0
- package/lib/internal/nativeBinary.js +16 -0
- package/lib/internal/nativeBinary.js.map +1 -0
- package/lib/internal/parseWindowsDirectoryCaseSensitivity.d.ts +24 -0
- package/lib/internal/parseWindowsDirectoryCaseSensitivity.js +47 -0
- package/lib/internal/parseWindowsDirectoryCaseSensitivity.js.map +1 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentity.d.ts +43 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentity.js +3 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentity.js.map +1 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityContext.d.ts +176 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityContext.js +3 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityContext.js.map +1 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.d.ts +100 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.js +3 -0
- package/lib/internal/pathIdentity/FilesystemPathIdentityOperations.js.map +1 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentity.d.ts +20 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentity.js +3 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentity.js.map +1 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.d.ts +20 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.js +3 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityContext.js.map +1 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.d.ts +20 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.js +3 -0
- package/lib/internal/pathIdentity/ProjectInputPathIdentityOperations.js.map +1 -0
- package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.d.ts +25 -0
- package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js +336 -0
- package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js.map +1 -0
- package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.d.ts +28 -0
- package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.js +33 -0
- package/lib/internal/pathIdentity/createProjectInputPathIdentityContext.js.map +1 -0
- package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.d.ts +20 -0
- package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.js +33 -0
- package/lib/internal/pathIdentity/isFilesystemPathIdentityWithin.js.map +1 -0
- package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.d.ts +15 -0
- package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.js +22 -0
- package/lib/internal/pathIdentity/isProjectInputPathIdentityWithin.js.map +1 -0
- package/lib/internal/pathIdentity/resolveFilesystemPath.d.ts +22 -0
- package/lib/internal/pathIdentity/resolveFilesystemPath.js +44 -0
- package/lib/internal/pathIdentity/resolveFilesystemPath.js.map +1 -0
- package/lib/internal/pathIdentity/resolvePhysicalPath.d.ts +21 -0
- package/lib/internal/pathIdentity/resolvePhysicalPath.js +35 -0
- package/lib/internal/pathIdentity/resolvePhysicalPath.js.map +1 -0
- package/lib/internal/pathIdentity/resolveProjectInputPath.d.ts +14 -0
- package/lib/internal/pathIdentity/resolveProjectInputPath.js +21 -0
- package/lib/internal/pathIdentity/resolveProjectInputPath.js.map +1 -0
- package/lib/internal/pluginSource.d.ts +26 -0
- package/lib/internal/pluginSource.js +43 -0
- package/lib/internal/pluginSource.js.map +1 -0
- package/lib/internal/projectInputPathIdentity.d.ts +27 -31
- package/lib/internal/projectInputPathIdentity.js +37 -275
- package/lib/internal/projectInputPathIdentity.js.map +1 -1
- package/lib/internal/resolveNodeBinary.d.ts +9 -7
- package/lib/internal/resolveNodeBinary.js +14 -120
- package/lib/internal/resolveNodeBinary.js.map +1 -1
- package/lib/internal/resolveSafeCacheCleanupTargets.d.ts +27 -8
- package/lib/internal/resolveSafeCacheCleanupTargets.js +44 -11
- package/lib/internal/resolveSafeCacheCleanupTargets.js.map +1 -1
- package/lib/internal/restoreCompilerError.d.ts +21 -0
- package/lib/internal/restoreCompilerError.js +164 -0
- package/lib/internal/restoreCompilerError.js.map +1 -0
- package/lib/internal/retireLockDirectory.d.ts +45 -0
- package/lib/internal/retireLockDirectory.js +152 -0
- package/lib/internal/retireLockDirectory.js.map +1 -0
- package/lib/internal/runHoldingLock.d.ts +30 -0
- package/lib/internal/runHoldingLock.js +53 -0
- package/lib/internal/runHoldingLock.js.map +1 -0
- package/lib/internal/runtimeExecutableIdentity.d.ts +20 -0
- package/lib/internal/runtimeExecutableIdentity.js +171 -0
- package/lib/internal/runtimeExecutableIdentity.js.map +1 -0
- package/lib/internal/serializeCompilerError.d.ts +28 -0
- package/lib/internal/serializeCompilerError.js +138 -0
- package/lib/internal/serializeCompilerError.js.map +1 -0
- package/lib/internal/spawnSyncResilient.d.ts +31 -0
- package/lib/internal/spawnSyncResilient.js +50 -0
- package/lib/internal/spawnSyncResilient.js.map +1 -0
- package/lib/internal/spawnSyncWithLowDescriptors.d.ts +30 -0
- package/lib/internal/spawnSyncWithLowDescriptors.js +194 -0
- package/lib/internal/spawnSyncWithLowDescriptors.js.map +1 -0
- package/lib/internal/tsconfig.d.ts +16 -0
- package/lib/internal/tsconfig.js +33 -0
- package/lib/internal/tsconfig.js.map +1 -0
- package/lib/launcher/internal/PendingResidentCheckWatchChanges.d.ts +56 -0
- package/lib/launcher/internal/PendingResidentCheckWatchChanges.js +97 -0
- package/lib/launcher/internal/PendingResidentCheckWatchChanges.js.map +1 -0
- package/lib/launcher/internal/TtscBuildMode.d.ts +14 -0
- package/lib/launcher/internal/TtscBuildMode.js +3 -0
- package/lib/launcher/internal/TtscBuildMode.js.map +1 -0
- package/lib/launcher/internal/TtsxEntryOptions.d.ts +50 -0
- package/lib/launcher/internal/TtsxEntryOptions.js +94 -0
- package/lib/launcher/internal/TtsxEntryOptions.js.map +1 -0
- package/lib/launcher/internal/assertNoSolutionBuild.d.ts +17 -10
- package/lib/launcher/internal/assertNoSolutionBuild.js +16 -9
- package/lib/launcher/internal/assertNoSolutionBuild.js.map +1 -1
- package/lib/launcher/internal/assertTtsxNoWatch.d.ts +25 -0
- package/lib/launcher/internal/assertTtsxNoWatch.js +46 -0
- package/lib/launcher/internal/assertTtsxNoWatch.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootProject.d.ts +108 -0
- package/lib/launcher/internal/buildSingleRootProject.js +229 -0
- package/lib/launcher/internal/buildSingleRootProject.js.map +1 -0
- package/lib/launcher/internal/getCompilerVersionText.d.ts +14 -1
- package/lib/launcher/internal/getCompilerVersionText.js +21 -6
- package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
- package/lib/launcher/internal/inlineServedSourceMap.d.ts +35 -0
- package/lib/launcher/internal/inlineServedSourceMap.js +255 -0
- package/lib/launcher/internal/inlineServedSourceMap.js.map +1 -0
- package/lib/launcher/internal/linkVirtualEntry.d.ts +31 -0
- package/lib/launcher/internal/linkVirtualEntry.js +87 -0
- package/lib/launcher/internal/linkVirtualEntry.js.map +1 -0
- package/lib/launcher/internal/parseCommonJsExports.d.ts +17 -0
- package/lib/launcher/internal/{commonJsExportMetadata.js → parseCommonJsExports.js} +13 -3
- package/lib/launcher/internal/parseCommonJsExports.js.map +1 -0
- package/lib/launcher/internal/parseTtscBuildArgs.d.ts +34 -0
- package/lib/launcher/internal/parseTtscBuildArgs.js +97 -0
- package/lib/launcher/internal/parseTtscBuildArgs.js.map +1 -0
- package/lib/launcher/internal/parseTtsxCLI.d.ts +35 -0
- package/lib/launcher/internal/parseTtsxCLI.js +187 -0
- package/lib/launcher/internal/parseTtsxCLI.js.map +1 -0
- package/lib/launcher/internal/prepareExecution.d.ts +49 -5
- package/lib/launcher/internal/prepareExecution.js +360 -324
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/prepareTtscBuildMode.d.ts +23 -0
- package/lib/launcher/internal/prepareTtscBuildMode.js +58 -0
- package/lib/launcher/internal/prepareTtscBuildMode.js.map +1 -0
- package/lib/launcher/internal/resolveCacheDir.d.ts +12 -3
- package/lib/launcher/internal/resolveCacheDir.js +12 -3
- package/lib/launcher/internal/resolveCacheDir.js.map +1 -1
- package/lib/launcher/internal/resolveSingleFileOutput.d.ts +35 -0
- package/lib/launcher/internal/resolveSingleFileOutput.js +115 -0
- package/lib/launcher/internal/resolveSingleFileOutput.js.map +1 -0
- package/lib/launcher/internal/resolveTtscserverBinary.d.ts +15 -3
- package/lib/launcher/internal/resolveTtscserverBinary.js +19 -5
- package/lib/launcher/internal/resolveTtscserverBinary.js.map +1 -1
- package/lib/launcher/internal/runTtsc.d.ts +23 -23
- package/lib/launcher/internal/runTtsc.js +336 -286
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtsx.d.ts +32 -4
- package/lib/launcher/internal/runTtsx.js +286 -138
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtime/CommonJsRuntimeSource.d.ts +92 -0
- package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js +354 -0
- package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildAdmission.d.ts +72 -0
- package/lib/launcher/internal/runtime/DependencyBuildAdmission.js +120 -0
- package/lib/launcher/internal/runtime/DependencyBuildAdmission.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildGeneration.d.ts +185 -0
- package/lib/launcher/internal/runtime/DependencyBuildGeneration.js +153 -0
- package/lib/launcher/internal/runtime/DependencyBuildGeneration.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockFence.d.ts +22 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockFence.js +3 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockFence.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockLease.d.ts +22 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockLease.js +3 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockLease.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockObservation.d.ts +41 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockObservation.js +3 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockObservation.js.map +1 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.d.ts +83 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.js +126 -0
- package/lib/launcher/internal/runtime/DependencyBuildLockProtocol.js.map +1 -0
- package/lib/launcher/internal/runtime/OwnedProjectSource.d.ts +112 -0
- package/lib/launcher/internal/runtime/OwnedProjectSource.js +59 -0
- package/lib/launcher/internal/runtime/OwnedProjectSource.js.map +1 -0
- package/lib/launcher/internal/runtime/OwningModuleOptions.d.ts +21 -0
- package/lib/launcher/internal/runtime/OwningModuleOptions.js +3 -0
- package/lib/launcher/internal/runtime/OwningModuleOptions.js.map +1 -0
- package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.d.ts +89 -0
- package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.js +115 -0
- package/lib/launcher/internal/runtime/PluginDescriptorInputObservation.js.map +1 -0
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.d.ts +168 -0
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js +251 -0
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js.map +1 -0
- package/lib/launcher/internal/runtime/ResolveResult.d.ts +24 -0
- package/lib/launcher/internal/runtime/ResolveResult.js +3 -0
- package/lib/launcher/internal/runtime/ResolveResult.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeEmitProvenance.d.ts +38 -0
- package/lib/launcher/internal/runtime/RuntimeEmitProvenance.js +60 -0
- package/lib/launcher/internal/runtime/RuntimeEmitProvenance.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeEntryPreparer.d.ts +22 -0
- package/lib/launcher/internal/runtime/RuntimeEntryPreparer.js +3 -0
- package/lib/launcher/internal/runtime/RuntimeEntryPreparer.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeFilesystem.d.ts +52 -0
- package/lib/launcher/internal/runtime/RuntimeFilesystem.js +73 -0
- package/lib/launcher/internal/runtime/RuntimeFilesystem.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeHookOptions.d.ts +22 -0
- package/lib/launcher/internal/runtime/RuntimeHookOptions.js +3 -0
- package/lib/launcher/internal/runtime/RuntimeHookOptions.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.d.ts +53 -0
- package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.js +88 -0
- package/lib/launcher/internal/runtime/RuntimeIsolatedEmit.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.d.ts +78 -0
- package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.js +256 -0
- package/lib/launcher/internal/runtime/RuntimeLoaderCapabilities.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeManifest.d.ts +65 -0
- package/lib/launcher/internal/runtime/RuntimeManifest.js +3 -0
- package/lib/launcher/internal/runtime/RuntimeManifest.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeManifestRegistry.d.ts +95 -0
- package/lib/launcher/internal/runtime/RuntimeManifestRegistry.js +268 -0
- package/lib/launcher/internal/runtime/RuntimeManifestRegistry.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeModuleFormat.d.ts +60 -0
- package/lib/launcher/internal/runtime/RuntimeModuleFormat.js +249 -0
- package/lib/launcher/internal/runtime/RuntimeModuleFormat.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.d.ts +50 -0
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js +134 -0
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js.map +1 -0
- package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.d.ts +11 -0
- package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.js +15 -0
- package/lib/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.js.map +1 -0
- package/lib/launcher/internal/runtime/acquireDependencyBuildLock.d.ts +22 -0
- package/lib/launcher/internal/runtime/acquireDependencyBuildLock.js +74 -0
- package/lib/launcher/internal/runtime/acquireDependencyBuildLock.js.map +1 -0
- package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.d.ts +30 -0
- package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.js +83 -0
- package/lib/launcher/internal/runtime/checkNodeRuntimeSupport.js.map +1 -0
- package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.d.ts +30 -0
- package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.js +52 -0
- package/lib/launcher/internal/runtime/claimRuntimeProjectDirectory.js.map +1 -0
- package/lib/launcher/internal/runtime/commonJsExportNames.d.ts +21 -0
- package/lib/launcher/internal/runtime/commonJsExportNames.js +68 -0
- package/lib/launcher/internal/runtime/commonJsExportNames.js.map +1 -0
- package/lib/launcher/internal/runtime/commonJsImportFacade.d.ts +32 -0
- package/lib/launcher/internal/runtime/commonJsImportFacade.js +56 -0
- package/lib/launcher/internal/runtime/commonJsImportFacade.js.map +1 -0
- package/lib/launcher/internal/runtime/dependencyCacheKey.d.ts +36 -0
- package/lib/launcher/internal/runtime/dependencyCacheKey.js +57 -0
- package/lib/launcher/internal/runtime/dependencyCacheKey.js.map +1 -0
- package/lib/launcher/internal/runtime/dependencyCacheRoot.d.ts +32 -0
- package/lib/launcher/internal/runtime/dependencyCacheRoot.js +98 -0
- package/lib/launcher/internal/runtime/dependencyCacheRoot.js.map +1 -0
- package/lib/launcher/internal/runtime/inspectDependencyBuildLock.d.ts +23 -0
- package/lib/launcher/internal/runtime/inspectDependencyBuildLock.js +126 -0
- package/lib/launcher/internal/runtime/inspectDependencyBuildLock.js.map +1 -0
- package/lib/launcher/internal/runtime/installRuntimeHooks.d.ts +58 -0
- package/lib/launcher/internal/runtime/installRuntimeHooks.js +1988 -0
- package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -0
- package/lib/launcher/internal/runtime/interopProbe.d.ts +8 -0
- package/lib/launcher/internal/runtime/interopProbe.js +3 -0
- package/lib/launcher/internal/runtime/interopProbe.js.map +1 -0
- package/lib/launcher/internal/runtime/isLocalProcessGone.d.ts +33 -0
- package/lib/launcher/internal/runtime/isLocalProcessGone.js +60 -0
- package/lib/launcher/internal/runtime/isLocalProcessGone.js.map +1 -0
- package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.d.ts +28 -0
- package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.js +50 -0
- package/lib/launcher/internal/runtime/observeMappedDescriptorResolution.js.map +1 -0
- package/lib/launcher/internal/runtime/projectModuleOptions.d.ts +16 -0
- package/lib/launcher/internal/runtime/projectModuleOptions.js +28 -0
- package/lib/launcher/internal/runtime/projectModuleOptions.js.map +1 -0
- package/lib/launcher/internal/runtime/readDependencyCache.d.ts +28 -0
- package/lib/launcher/internal/runtime/readDependencyCache.js +83 -0
- package/lib/launcher/internal/runtime/readDependencyCache.js.map +1 -0
- package/lib/launcher/internal/runtime/realPath.d.ts +22 -0
- package/lib/launcher/internal/runtime/realPath.js +37 -0
- package/lib/launcher/internal/runtime/realPath.js.map +1 -0
- package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.d.ts +17 -0
- package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.js +23 -0
- package/lib/launcher/internal/runtime/reclaimDependencyBuildLock.js.map +1 -0
- package/lib/launcher/internal/runtime/releaseDependencyBuildLock.d.ts +17 -0
- package/lib/launcher/internal/runtime/releaseDependencyBuildLock.js +23 -0
- package/lib/launcher/internal/runtime/releaseDependencyBuildLock.js.map +1 -0
- package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.d.ts +34 -0
- package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js +88 -0
- package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js.map +1 -0
- package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.d.ts +20 -0
- package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.js +30 -0
- package/lib/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.js.map +1 -0
- package/lib/launcher/internal/runtime/runtimeRunKey.d.ts +24 -0
- package/lib/launcher/internal/runtime/runtimeRunKey.js +36 -0
- package/lib/launcher/internal/runtime/runtimeRunKey.js.map +1 -0
- package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.d.ts +21 -0
- package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.js +29 -0
- package/lib/launcher/internal/runtime/selectRuntimePluginPolicy.js.map +1 -0
- package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.d.ts +35 -0
- package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.js +76 -0
- package/lib/launcher/internal/runtime/withRuntimeDirectoryLock.js.map +1 -0
- package/lib/launcher/internal/runtimeCompilerArgs.d.ts +35 -6
- package/lib/launcher/internal/runtimeCompilerArgs.js +87 -58
- package/lib/launcher/internal/runtimeCompilerArgs.js.map +1 -1
- package/lib/launcher/internal/runtimeEmitProfile.d.ts +39 -0
- package/lib/launcher/internal/runtimeEmitProfile.js +56 -0
- package/lib/launcher/internal/runtimeEmitProfile.js.map +1 -0
- package/lib/launcher/internal/runtimeHookPreload.js +4 -4
- package/lib/launcher/internal/runtimeHookPreload.js.map +1 -1
- package/lib/launcher/internal/runtimeOwnerPreload.d.ts +1 -0
- package/lib/launcher/internal/runtimeOwnerPreload.js +43 -0
- package/lib/launcher/internal/runtimeOwnerPreload.js.map +1 -0
- package/lib/launcher/internal/singleRootProjectConfig.d.ts +34 -0
- package/lib/launcher/internal/singleRootProjectConfig.js +39 -0
- package/lib/launcher/internal/singleRootProjectConfig.js.map +1 -0
- package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.d.ts +61 -0
- package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.js +3 -0
- package/lib/launcher/internal/ttscserver/ILSPPluginSelectionInputs.js.map +1 -0
- package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.d.ts +95 -0
- package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.js +270 -0
- package/lib/launcher/internal/ttscserver/LSPProjectInputDigest.js.map +1 -0
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.d.ts +46 -0
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js +91 -0
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js.map +1 -0
- package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.d.ts +21 -0
- package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.js +39 -0
- package/lib/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.js.map +1 -0
- package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.d.ts +18 -0
- package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.js +27 -0
- package/lib/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.js.map +1 -0
- package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.d.ts +26 -0
- package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.js +62 -0
- package/lib/launcher/internal/ttscserver/materializeLSPPluginManifest.js.map +1 -0
- package/lib/launcher/internal/ttscserver/needsStdio.d.ts +17 -0
- package/lib/launcher/internal/ttscserver/needsStdio.js +36 -0
- package/lib/launcher/internal/ttscserver/needsStdio.js.map +1 -0
- package/lib/launcher/internal/ttscserver/runTtscserver.d.ts +25 -0
- package/lib/launcher/internal/ttscserver/runTtscserver.js +439 -0
- package/lib/launcher/internal/ttscserver/runTtscserver.js.map +1 -0
- package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.d.ts +29 -0
- package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.js +3 -0
- package/lib/launcher/internal/watch/CompilerDirectoryWatchEventPlan.js.map +1 -0
- package/lib/launcher/internal/watch/DirectoryWatcher.d.ts +44 -0
- package/lib/launcher/internal/watch/DirectoryWatcher.js +3 -0
- package/lib/launcher/internal/watch/DirectoryWatcher.js.map +1 -0
- package/lib/launcher/internal/watch/FseventsStreams.d.ts +87 -0
- package/lib/launcher/internal/watch/FseventsStreams.js +266 -0
- package/lib/launcher/internal/watch/FseventsStreams.js.map +1 -0
- package/lib/launcher/internal/watch/ProjectInputWatchRules.d.ts +92 -0
- package/lib/launcher/internal/watch/ProjectInputWatchRules.js +163 -0
- package/lib/launcher/internal/watch/ProjectInputWatchRules.js.map +1 -0
- package/lib/launcher/internal/watch/WatchInputChange.d.ts +29 -0
- package/lib/launcher/internal/watch/WatchInputChange.js +3 -0
- package/lib/launcher/internal/watch/WatchInputChange.js.map +1 -0
- package/lib/launcher/internal/watch/WatchPaths.d.ts +101 -0
- package/lib/launcher/internal/watch/WatchPaths.js +150 -0
- package/lib/launcher/internal/watch/WatchPaths.js.map +1 -0
- package/lib/launcher/internal/watch/WatchTopology.d.ts +384 -0
- package/lib/launcher/internal/{watchTopology.js → watch/WatchTopology.js} +726 -799
- package/lib/launcher/internal/watch/WatchTopology.js.map +1 -0
- package/lib/launcher/internal/watch/literalGlobRoot.d.ts +22 -0
- package/lib/launcher/internal/watch/literalGlobRoot.js +45 -0
- package/lib/launcher/internal/watch/literalGlobRoot.js.map +1 -0
- package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.d.ts +40 -0
- package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.js +69 -0
- package/lib/launcher/internal/watch/planCompilerDirectoryWatchEvent.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.d.ts +19 -0
- package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.js +52 -0
- package/lib/launcher/internal/watch/projectInputActiveWatchDirectories.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.d.ts +21 -0
- package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.js +55 -0
- package/lib/launcher/internal/watch/projectInputAvailableWatchDirectory.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputEventShouldNotify.d.ts +21 -0
- package/lib/launcher/internal/watch/projectInputEventShouldNotify.js +23 -0
- package/lib/launcher/internal/watch/projectInputEventShouldNotify.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.d.ts +27 -0
- package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.js +54 -0
- package/lib/launcher/internal/watch/projectInputMembershipInvalidatesProgram.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.d.ts +26 -0
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js +100 -0
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.d.ts +37 -0
- package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.js +54 -0
- package/lib/launcher/internal/watch/projectInputReplacementStrandsWatchers.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputTopologyMayAffect.d.ts +23 -0
- package/lib/launcher/internal/watch/projectInputTopologyMayAffect.js +67 -0
- package/lib/launcher/internal/watch/projectInputTopologyMayAffect.js.map +1 -0
- package/lib/launcher/internal/watch/projectInputWatchDirectories.d.ts +22 -0
- package/lib/launcher/internal/watch/projectInputWatchDirectories.js +30 -0
- package/lib/launcher/internal/watch/projectInputWatchDirectories.js.map +1 -0
- package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.d.ts +22 -0
- package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.js +45 -0
- package/lib/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.js.map +1 -0
- package/lib/launcher/internal/watch/syncWatchers.d.ts +25 -0
- package/lib/launcher/internal/watch/syncWatchers.js +61 -0
- package/lib/launcher/internal/watch/syncWatchers.js.map +1 -0
- package/lib/launcher/internal/watch/watchDirectory.d.ts +28 -0
- package/lib/launcher/internal/watch/watchDirectory.js +46 -0
- package/lib/launcher/internal/watch/watchDirectory.js.map +1 -0
- package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.d.ts +28 -0
- package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.js +38 -0
- package/lib/launcher/internal/watch/watchDirectoryThroughFsWatch.js.map +1 -0
- package/lib/launcher/ttscserver.js +1 -1
- package/lib/launcher/ttscserver.js.map +1 -1
- package/lib/launcher/ttsx.js +2 -3
- package/lib/launcher/ttsx.js.map +1 -1
- package/lib/plugin/CapabilityPluginResolver.d.ts +140 -0
- package/lib/plugin/CapabilityPluginResolver.js +400 -0
- package/lib/plugin/CapabilityPluginResolver.js.map +1 -0
- package/lib/plugin/ITtscCapabilityPlugin.d.ts +87 -0
- package/lib/plugin/ITtscCapabilityPlugin.js +3 -0
- package/lib/plugin/ITtscCapabilityPlugin.js.map +1 -0
- package/lib/plugin/internal/CapabilityPluginResult.d.ts +66 -0
- package/lib/plugin/internal/CapabilityPluginResult.js +86 -0
- package/lib/plugin/internal/CapabilityPluginResult.js.map +1 -0
- package/lib/plugin/internal/CapabilityResolutionFormat.d.ts +114 -0
- package/lib/plugin/internal/CapabilityResolutionFormat.js +229 -0
- package/lib/plugin/internal/CapabilityResolutionFormat.js.map +1 -0
- package/lib/plugin/internal/ITtscCapabilityPluginSource.d.ts +35 -0
- package/lib/plugin/internal/ITtscCapabilityPluginSource.js +3 -0
- package/lib/plugin/internal/ITtscCapabilityPluginSource.js.map +1 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionEntry.d.ts +49 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionEntry.js +3 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionEntry.js.map +1 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.d.ts +21 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.js +3 -0
- package/lib/plugin/internal/ITtscCapabilityResolutionPlugin.js.map +1 -0
- package/lib/plugin/internal/capabilityPluginWorker.d.ts +1 -0
- package/lib/plugin/internal/capabilityPluginWorker.js +178 -0
- package/lib/plugin/internal/capabilityPluginWorker.js.map +1 -0
- package/lib/plugin/internal/decodeCapabilityCommandReply.d.ts +23 -0
- package/lib/plugin/internal/decodeCapabilityCommandReply.js +25 -0
- package/lib/plugin/internal/decodeCapabilityCommandReply.js.map +1 -0
- package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.d.ts +15 -0
- package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.js +182 -0
- package/lib/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.js.map +1 -0
- package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.d.ts +11 -0
- package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.js +62 -0
- package/lib/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.js.map +1 -0
- package/lib/plugin/internal/load/PluginDescriptorAdmission.d.ts +46 -0
- package/lib/plugin/internal/load/PluginDescriptorAdmission.js +72 -0
- package/lib/plugin/internal/load/PluginDescriptorAdmission.js.map +1 -0
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +154 -0
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +317 -0
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -0
- package/lib/plugin/internal/load/PluginPackageResolution.d.ts +208 -0
- package/lib/plugin/internal/load/PluginPackageResolution.js +593 -0
- package/lib/plugin/internal/load/PluginPackageResolution.js.map +1 -0
- package/lib/plugin/internal/load/ProjectPluginEntries.d.ts +60 -0
- package/lib/plugin/internal/load/ProjectPluginEntries.js +164 -0
- package/lib/plugin/internal/load/ProjectPluginEntries.js.map +1 -0
- package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.d.ts +13 -0
- package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.js +21 -0
- package/lib/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.js.map +1 -0
- package/lib/plugin/internal/load/collectProjectHostInputs.d.ts +16 -0
- package/lib/plugin/internal/load/collectProjectHostInputs.js +66 -0
- package/lib/plugin/internal/load/collectProjectHostInputs.js.map +1 -0
- package/lib/plugin/internal/load/composePluginSources.d.ts +20 -0
- package/lib/plugin/internal/load/composePluginSources.js +95 -0
- package/lib/plugin/internal/load/composePluginSources.js.map +1 -0
- package/lib/plugin/internal/load/declaresHostInputReads.d.ts +24 -0
- package/lib/plugin/internal/load/declaresHostInputReads.js +48 -0
- package/lib/plugin/internal/load/declaresHostInputReads.js.map +1 -0
- package/lib/plugin/internal/load/hasProjectPluginEntries.d.ts +21 -0
- package/lib/plugin/internal/load/hasProjectPluginEntries.js +29 -0
- package/lib/plugin/internal/load/hasProjectPluginEntries.js.map +1 -0
- package/lib/plugin/internal/load/hashHostInputPaths.d.ts +17 -0
- package/lib/plugin/internal/load/hashHostInputPaths.js +46 -0
- package/lib/plugin/internal/load/hashHostInputPaths.js.map +1 -0
- package/lib/plugin/internal/load/isRelativePluginSpecifier.d.ts +22 -0
- package/lib/plugin/internal/load/isRelativePluginSpecifier.js +33 -0
- package/lib/plugin/internal/load/isRelativePluginSpecifier.js.map +1 -0
- package/lib/plugin/internal/load/loadProjectPlugins.d.ts +113 -0
- package/lib/plugin/internal/load/loadProjectPlugins.js +1615 -0
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -0
- package/lib/plugin/internal/load/moduleResolutionBaseSelects.d.ts +42 -0
- package/lib/plugin/internal/load/moduleResolutionBaseSelects.js +51 -0
- package/lib/plugin/internal/load/moduleResolutionBaseSelects.js.map +1 -0
- package/lib/plugin/internal/load/observeImportSearchRoots.d.ts +29 -0
- package/lib/plugin/internal/load/observeImportSearchRoots.js +38 -0
- package/lib/plugin/internal/load/observeImportSearchRoots.js.map +1 -0
- package/lib/plugin/internal/load/pluginLabel.d.ts +15 -0
- package/lib/plugin/internal/load/pluginLabel.js +25 -0
- package/lib/plugin/internal/load/pluginLabel.js.map +1 -0
- package/lib/plugin/internal/load/realpathHostInput.d.ts +14 -0
- package/lib/plugin/internal/load/realpathHostInput.js +29 -0
- package/lib/plugin/internal/load/realpathHostInput.js.map +1 -0
- package/lib/plugin/internal/load/realpathHostInputPaths.d.ts +17 -0
- package/lib/plugin/internal/load/realpathHostInputPaths.js +28 -0
- package/lib/plugin/internal/load/realpathHostInputPaths.js.map +1 -0
- package/lib/plugin/internal/load/rejectJsTransformFunctions.d.ts +13 -0
- package/lib/plugin/internal/load/rejectJsTransformFunctions.js +22 -0
- package/lib/plugin/internal/load/rejectJsTransformFunctions.js.map +1 -0
- package/lib/plugin/internal/load/requirePluginSource.d.ts +14 -0
- package/lib/plugin/internal/load/requirePluginSource.js +38 -0
- package/lib/plugin/internal/load/requirePluginSource.js.map +1 -0
- package/lib/plugin/internal/load/resolveNativeSource.d.ts +29 -0
- package/lib/plugin/internal/load/resolveNativeSource.js +37 -0
- package/lib/plugin/internal/load/resolveNativeSource.js.map +1 -0
- package/lib/plugin/internal/load/validatePluginContributors.d.ts +22 -0
- package/lib/plugin/internal/load/validatePluginContributors.js +86 -0
- package/lib/plugin/internal/load/validatePluginContributors.js.map +1 -0
- package/lib/plugin/internal/load/validatePluginSource.d.ts +14 -0
- package/lib/plugin/internal/load/validatePluginSource.js +21 -0
- package/lib/plugin/internal/load/validatePluginSource.js.map +1 -0
- package/lib/plugin/internal/load/visitImportMappedCandidates.d.ts +36 -0
- package/lib/plugin/internal/load/visitImportMappedCandidates.js +45 -0
- package/lib/plugin/internal/load/visitImportMappedCandidates.js.map +1 -0
- package/lib/plugin/internal/pluginDescriptorFailureReason.d.ts +23 -0
- package/lib/plugin/internal/pluginDescriptorFailureReason.js +43 -0
- package/lib/plugin/internal/pluginDescriptorFailureReason.js.map +1 -0
- package/lib/plugin/internal/pluginDescriptorProcessFailure.d.ts +28 -0
- package/lib/plugin/internal/pluginDescriptorProcessFailure.js +37 -0
- package/lib/plugin/internal/pluginDescriptorProcessFailure.js.map +1 -0
- package/lib/plugin/internal/readCapabilityResolution.d.ts +42 -0
- package/lib/plugin/internal/readCapabilityResolution.js +158 -0
- package/lib/plugin/internal/readCapabilityResolution.js.map +1 -0
- package/lib/plugin/internal/receiveCapabilityFailure.d.ts +21 -0
- package/lib/plugin/internal/receiveCapabilityFailure.js +28 -0
- package/lib/plugin/internal/receiveCapabilityFailure.js.map +1 -0
- package/lib/plugin/internal/source/CachePrunePolicy.d.ts +42 -0
- package/lib/plugin/internal/source/CachePrunePolicy.js +47 -0
- package/lib/plugin/internal/source/CachePrunePolicy.js.map +1 -0
- package/lib/plugin/internal/source/GoBuildCacheCoordination.d.ts +159 -0
- package/lib/plugin/internal/source/GoBuildCacheCoordination.js +475 -0
- package/lib/plugin/internal/source/GoBuildCacheCoordination.js.map +1 -0
- package/lib/plugin/internal/source/GoSourceInputs.d.ts +124 -0
- package/lib/plugin/internal/source/GoSourceInputs.js +180 -0
- package/lib/plugin/internal/source/GoSourceInputs.js.map +1 -0
- package/lib/plugin/internal/source/GoToolResolution.d.ts +125 -0
- package/lib/plugin/internal/source/GoToolResolution.js +278 -0
- package/lib/plugin/internal/source/GoToolResolution.js.map +1 -0
- package/lib/plugin/internal/source/IGoBuildCachePruneOptions.d.ts +30 -0
- package/lib/plugin/internal/source/IGoBuildCachePruneOptions.js +3 -0
- package/lib/plugin/internal/source/IGoBuildCachePruneOptions.js.map +1 -0
- package/lib/plugin/internal/source/IPluginCachePruneOptions.d.ts +33 -0
- package/lib/plugin/internal/source/IPluginCachePruneOptions.js +3 -0
- package/lib/plugin/internal/source/IPluginCachePruneOptions.js.map +1 -0
- package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.d.ts +27 -0
- package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.js +3 -0
- package/lib/plugin/internal/source/IPluginModuleReplaceDirectory.js.map +1 -0
- package/lib/plugin/internal/source/ITtscBuildContributor.d.ts +18 -0
- package/lib/plugin/internal/source/ITtscBuildContributor.js +3 -0
- package/lib/plugin/internal/source/ITtscBuildContributor.js.map +1 -0
- package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.d.ts +25 -0
- package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.js +3 -0
- package/lib/plugin/internal/source/ITtscSourceBuildCachePaths.js.map +1 -0
- package/lib/plugin/internal/source/NativeSourcePackages.d.ts +155 -0
- package/lib/plugin/internal/source/NativeSourcePackages.js +317 -0
- package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -0
- package/lib/plugin/internal/source/PluginBinaryUse.d.ts +66 -0
- package/lib/plugin/internal/source/PluginBinaryUse.js +163 -0
- package/lib/plugin/internal/source/PluginBinaryUse.js.map +1 -0
- package/lib/plugin/internal/source/PluginBinaryWaitResult.d.ts +34 -0
- package/lib/plugin/internal/source/PluginBinaryWaitResult.js +3 -0
- package/lib/plugin/internal/source/PluginBinaryWaitResult.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +90 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +207 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.d.ts +128 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.js +209 -0
- package/lib/plugin/internal/source/PluginBuildEnvironmentWitness.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildLockFence.d.ts +25 -0
- package/lib/plugin/internal/source/PluginBuildLockFence.js +3 -0
- package/lib/plugin/internal/source/PluginBuildLockFence.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildLockLease.d.ts +29 -0
- package/lib/plugin/internal/source/PluginBuildLockLease.js +3 -0
- package/lib/plugin/internal/source/PluginBuildLockLease.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildLockObservation.d.ts +42 -0
- package/lib/plugin/internal/source/PluginBuildLockObservation.js +3 -0
- package/lib/plugin/internal/source/PluginBuildLockObservation.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildLockOwner.d.ts +126 -0
- package/lib/plugin/internal/source/PluginBuildLockOwner.js +165 -0
- package/lib/plugin/internal/source/PluginBuildLockOwner.js.map +1 -0
- package/lib/plugin/internal/source/PluginBuildLockProtocol.d.ts +234 -0
- package/lib/plugin/internal/source/PluginBuildLockProtocol.js +287 -0
- package/lib/plugin/internal/source/PluginBuildLockProtocol.js.map +1 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.d.ts +183 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js +291 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js.map +1 -0
- package/lib/plugin/internal/source/SourceBuildFilesystemOperations.d.ts +32 -0
- package/lib/plugin/internal/source/SourceBuildFilesystemOperations.js +3 -0
- package/lib/plugin/internal/source/SourceBuildFilesystemOperations.js.map +1 -0
- package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +80 -0
- package/lib/plugin/internal/source/SourcePluginAdmission.js +114 -0
- package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -0
- package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +122 -0
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +307 -0
- package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -0
- package/lib/plugin/internal/source/acquirePluginBuildLock.d.ts +35 -0
- package/lib/plugin/internal/source/acquirePluginBuildLock.js +176 -0
- package/lib/plugin/internal/source/acquirePluginBuildLock.js.map +1 -0
- package/lib/plugin/internal/source/autoQuoteGoModToken.d.ts +24 -0
- package/lib/plugin/internal/source/autoQuoteGoModToken.js +110 -0
- package/lib/plugin/internal/source/autoQuoteGoModToken.js.map +1 -0
- package/lib/plugin/internal/source/buildSourcePlugin.d.ts +86 -0
- package/lib/plugin/internal/source/buildSourcePlugin.js +857 -0
- package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -0
- package/lib/plugin/internal/source/collectPluginSourceDirectories.d.ts +30 -0
- package/lib/plugin/internal/source/collectPluginSourceDirectories.js +77 -0
- package/lib/plugin/internal/source/collectPluginSourceDirectories.js.map +1 -0
- package/lib/plugin/internal/source/collectPluginSourceFiles.d.ts +40 -0
- package/lib/plugin/internal/source/collectPluginSourceFiles.js +95 -0
- package/lib/plugin/internal/source/collectPluginSourceFiles.js.map +1 -0
- package/lib/plugin/internal/source/computeCacheKey.d.ts +73 -0
- package/lib/plugin/internal/source/computeCacheKey.js +113 -0
- package/lib/plugin/internal/source/computeCacheKey.js.map +1 -0
- package/lib/plugin/internal/source/copiesPluginSourceEntry.d.ts +33 -0
- package/lib/plugin/internal/source/copiesPluginSourceEntry.js +57 -0
- package/lib/plugin/internal/source/copiesPluginSourceEntry.js.map +1 -0
- package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.d.ts +22 -0
- package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.js +60 -0
- package/lib/plugin/internal/source/createExternalSourceSnapshotLayout.js.map +1 -0
- package/lib/plugin/internal/source/ensureExecutableGoToolchain.d.ts +25 -0
- package/lib/plugin/internal/source/ensureExecutableGoToolchain.js +96 -0
- package/lib/plugin/internal/source/ensureExecutableGoToolchain.js.map +1 -0
- package/lib/plugin/internal/source/formatDuration.d.ts +18 -0
- package/lib/plugin/internal/source/formatDuration.js +36 -0
- package/lib/plugin/internal/source/formatDuration.js.map +1 -0
- package/lib/plugin/internal/source/formatGoWorkPath.d.ts +35 -0
- package/lib/plugin/internal/source/formatGoWorkPath.js +42 -0
- package/lib/plugin/internal/source/formatGoWorkPath.js.map +1 -0
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +47 -0
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +663 -0
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -0
- package/lib/plugin/internal/source/inspectPluginBuildLock.d.ts +29 -0
- package/lib/plugin/internal/source/inspectPluginBuildLock.js +285 -0
- package/lib/plugin/internal/source/inspectPluginBuildLock.js.map +1 -0
- package/lib/plugin/internal/source/isPathWithin.d.ts +16 -0
- package/lib/plugin/internal/source/isPathWithin.js +28 -0
- package/lib/plugin/internal/source/isPathWithin.js.map +1 -0
- package/lib/plugin/internal/source/legacyGlobalCacheTargets.d.ts +24 -0
- package/lib/plugin/internal/source/legacyGlobalCacheTargets.js +60 -0
- package/lib/plugin/internal/source/legacyGlobalCacheTargets.js.map +1 -0
- package/lib/plugin/internal/source/pluginBuildEnvironment.d.ts +31 -0
- package/lib/plugin/internal/source/pluginBuildEnvironment.js +47 -0
- package/lib/plugin/internal/source/pluginBuildEnvironment.js.map +1 -0
- package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.d.ts +1 -0
- package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js +24 -0
- package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js.map +1 -0
- package/lib/plugin/internal/source/pluginBuildVersions.d.ts +31 -0
- package/lib/plugin/internal/source/pluginBuildVersions.js +65 -0
- package/lib/plugin/internal/source/pluginBuildVersions.js.map +1 -0
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.d.ts +40 -0
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js +81 -0
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js.map +1 -0
- package/lib/plugin/internal/source/pluginSourceCovers.d.ts +32 -0
- package/lib/plugin/internal/source/pluginSourceCovers.js +54 -0
- package/lib/plugin/internal/source/pluginSourceCovers.js.map +1 -0
- package/lib/plugin/internal/source/pluginSourceDigest.d.ts +40 -0
- package/lib/plugin/internal/source/pluginSourceDigest.js +60 -0
- package/lib/plugin/internal/source/pluginSourceDigest.js.map +1 -0
- package/lib/plugin/internal/source/pluginSourceFilesSignature.d.ts +38 -0
- package/lib/plugin/internal/source/pluginSourceFilesSignature.js +53 -0
- package/lib/plugin/internal/source/pluginSourceFilesSignature.js.map +1 -0
- package/lib/plugin/internal/source/pluginSourceState.d.ts +47 -0
- package/lib/plugin/internal/source/pluginSourceState.js +63 -0
- package/lib/plugin/internal/source/pluginSourceState.js.map +1 -0
- package/lib/plugin/internal/source/pluginSourceStateHolds.d.ts +34 -0
- package/lib/plugin/internal/source/pluginSourceStateHolds.js +45 -0
- package/lib/plugin/internal/source/pluginSourceStateHolds.js.map +1 -0
- package/lib/plugin/internal/source/processPluginBuildEnvironment.d.ts +33 -0
- package/lib/plugin/internal/source/processPluginBuildEnvironment.js +40 -0
- package/lib/plugin/internal/source/processPluginBuildEnvironment.js.map +1 -0
- package/lib/plugin/internal/source/pruneCacheFileRoot.d.ts +34 -0
- package/lib/plugin/internal/source/pruneCacheFileRoot.js +120 -0
- package/lib/plugin/internal/source/pruneCacheFileRoot.js.map +1 -0
- package/lib/plugin/internal/source/pruneGoBuildCacheRoot.d.ts +28 -0
- package/lib/plugin/internal/source/pruneGoBuildCacheRoot.js +185 -0
- package/lib/plugin/internal/source/pruneGoBuildCacheRoot.js.map +1 -0
- package/lib/plugin/internal/source/prunePluginCacheRoot.d.ts +46 -0
- package/lib/plugin/internal/source/prunePluginCacheRoot.js +446 -0
- package/lib/plugin/internal/source/prunePluginCacheRoot.js.map +1 -0
- package/lib/plugin/internal/source/prunesPluginSourceDirectory.d.ts +21 -0
- package/lib/plugin/internal/source/prunesPluginSourceDirectory.js +28 -0
- package/lib/plugin/internal/source/prunesPluginSourceDirectory.js.map +1 -0
- package/lib/plugin/internal/source/reclaimPluginBuildLock.d.ts +23 -0
- package/lib/plugin/internal/source/reclaimPluginBuildLock.js +48 -0
- package/lib/plugin/internal/source/reclaimPluginBuildLock.js.map +1 -0
- package/lib/plugin/internal/source/recordCacheFileUse.d.ts +22 -0
- package/lib/plugin/internal/source/recordCacheFileUse.js +43 -0
- package/lib/plugin/internal/source/recordCacheFileUse.js.map +1 -0
- package/lib/plugin/internal/source/releasePluginBuildLock.d.ts +33 -0
- package/lib/plugin/internal/source/releasePluginBuildLock.js +100 -0
- package/lib/plugin/internal/source/releasePluginBuildLock.js.map +1 -0
- package/lib/plugin/internal/source/resolveCleanTargets.d.ts +26 -0
- package/lib/plugin/internal/source/resolveCleanTargets.js +73 -0
- package/lib/plugin/internal/source/resolveCleanTargets.js.map +1 -0
- package/lib/plugin/internal/source/resolveGoCompiler.d.ts +29 -0
- package/lib/plugin/internal/source/resolveGoCompiler.js +62 -0
- package/lib/plugin/internal/source/resolveGoCompiler.js.map +1 -0
- package/lib/plugin/internal/source/resolvePluginCacheRoot.d.ts +21 -0
- package/lib/plugin/internal/source/resolvePluginCacheRoot.js +31 -0
- package/lib/plugin/internal/source/resolvePluginCacheRoot.js.map +1 -0
- package/lib/plugin/internal/source/resolvePluginGoModule.d.ts +34 -0
- package/lib/plugin/internal/source/resolvePluginGoModule.js +65 -0
- package/lib/plugin/internal/source/resolvePluginGoModule.js.map +1 -0
- package/lib/plugin/internal/source/resolveSourceBuildCachePaths.d.ts +21 -0
- package/lib/plugin/internal/source/resolveSourceBuildCachePaths.js +236 -0
- package/lib/plugin/internal/source/resolveSourceBuildCachePaths.js.map +1 -0
- package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.d.ts +29 -0
- package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.js +68 -0
- package/lib/plugin/internal/source/selectPluginModuleReplaceDirectories.js.map +1 -0
- package/lib/plugin/internal/source/spawnGoTool.d.ts +22 -0
- package/lib/plugin/internal/source/spawnGoTool.js +164 -0
- package/lib/plugin/internal/source/spawnGoTool.js.map +1 -0
- package/lib/plugin/internal/source/touchPluginCacheEntryInUse.d.ts +27 -0
- package/lib/plugin/internal/source/touchPluginCacheEntryInUse.js +48 -0
- package/lib/plugin/internal/source/touchPluginCacheEntryInUse.js.map +1 -0
- package/lib/plugin/internal/source/waitForPluginBinary.d.ts +36 -0
- package/lib/plugin/internal/source/waitForPluginBinary.js +94 -0
- package/lib/plugin/internal/source/waitForPluginBinary.js.map +1 -0
- package/lib/plugin/internal/source/windowsGoCommandArgs.d.ts +17 -0
- package/lib/plugin/internal/source/windowsGoCommandArgs.js +23 -0
- package/lib/plugin/internal/source/windowsGoCommandArgs.js.map +1 -0
- package/lib/plugin/internal/source/withGoBuildCacheLease.d.ts +37 -0
- package/lib/plugin/internal/source/withGoBuildCacheLease.js +87 -0
- package/lib/plugin/internal/source/withGoBuildCacheLease.js.map +1 -0
- package/lib/plugin/internal/writeCapabilityResolution.d.ts +80 -0
- package/lib/plugin/internal/writeCapabilityResolution.js +196 -0
- package/lib/plugin/internal/writeCapabilityResolution.js.map +1 -0
- package/lib/plugin/resolveCapabilityPlugins.d.ts +53 -32
- package/lib/plugin/resolveCapabilityPlugins.js +209 -38
- package/lib/plugin/resolveCapabilityPlugins.js.map +1 -1
- package/lib/register.js +20 -5
- package/lib/register.js.map +1 -1
- package/lib/structures/ITtscCompilerContext.d.ts +29 -11
- package/lib/structures/ITtscCompilerDiagnostic.d.ts +24 -7
- package/lib/structures/ITtscCompilerResult.d.ts +75 -25
- package/lib/structures/ITtscCompilerTransformation.d.ts +287 -64
- package/lib/structures/ITtscPlugin.d.ts +24 -8
- package/lib/structures/ITtscPluginCapabilities.d.ts +55 -5
- package/lib/structures/ITtscPluginContributor.d.ts +19 -8
- package/lib/structures/ITtscPluginFactoryContext.d.ts +12 -3
- package/lib/structures/ITtscProjectPluginConfig.d.ts +35 -10
- package/lib/structures/TtscPluginStage.d.ts +9 -0
- package/lib/structures/internal/ITtscLoadedNativePlugin.d.ts +19 -5
- package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +29 -3
- package/lib/structures/internal/ITtscProjectIdentity.d.ts +21 -6
- package/lib/structures/internal/ITtscProjectInputSnapshot.d.ts +23 -8
- package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +18 -4
- package/lib/structures/internal/TtscBuildOptions.d.ts +33 -14
- package/lib/structures/internal/TtscBuildResult.d.ts +63 -4
- package/lib/structures/internal/TtscCommonOptions.d.ts +47 -14
- package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +46 -5
- package/package.json +26 -12
- package/shim/ast/enums_gen.go +4 -2
- package/shim/ast/go.mod +5 -5
- package/shim/ast/go.sum +10 -10
- package/shim/ast/lint.go +1088 -20
- package/shim/ast/parent.go +38 -22
- package/shim/ast/safe_text.go +48 -26
- package/shim/ast/shim.go +1307 -20
- package/shim/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
- package/shim/ast/test/node_text_joins_multi_hop_qualified_name_test.go +24 -9
- package/shim/ast/test/node_text_joins_one_hop_qualified_name_test.go +9 -5
- package/shim/ast/test/node_text_returns_empty_for_nil_test.go +13 -5
- package/shim/ast/test/node_text_returns_identifier_text_test.go +12 -5
- package/shim/ast/test/node_text_skips_empty_qualified_left_test.go +35 -5
- package/shim/astnav/go.mod +5 -5
- package/shim/astnav/go.sum +12 -10
- package/shim/astnav/shim.go +9 -0
- package/shim/bundled/go.mod +7 -1
- package/shim/bundled/go.sum +12 -0
- package/shim/checker/enums_gen.go +4 -2
- package/shim/checker/extra-shim.json +6 -0
- package/shim/checker/go.mod +5 -5
- package/shim/checker/go.sum +10 -10
- package/shim/checker/node_builder_fields_gen.go +19 -0
- package/shim/checker/shim.go +827 -114
- package/shim/compiler/emit_sourcemap.go +68 -29
- package/shim/compiler/emitassemble.go +36 -2
- package/shim/compiler/emithook.go +13 -3
- package/shim/compiler/go.mod +5 -5
- package/shim/compiler/go.sum +10 -10
- package/shim/compiler/incremental.go +56 -20
- package/shim/compiler/resolution.go +92 -9
- package/shim/core/enums_gen.go +2 -2
- package/shim/core/go.mod +6 -1
- package/shim/core/go.sum +10 -0
- package/shim/core/modulekind.go +9 -0
- package/shim/core/shim.go +157 -6
- package/shim/diagnosticwriter/go.mod +10 -1
- package/shim/diagnosticwriter/go.sum +20 -0
- package/shim/diagnosticwriter/lint.go +188 -10
- package/shim/diagnosticwriter/shim.go +14 -0
- package/shim/lsp/go.mod +5 -5
- package/shim/lsp/go.sum +10 -10
- package/shim/lsp/shim.go +78 -2
- package/shim/parser/go.mod +10 -1
- package/shim/parser/go.sum +22 -0
- package/shim/printer/emithost.go +46 -1
- package/shim/printer/go.mod +5 -5
- package/shim/printer/go.sum +10 -10
- package/shim/printer/shim.go +114 -7
- package/shim/printer/sourcemap.go +55 -0
- package/shim/scanner/go.mod +10 -1
- package/shim/scanner/go.sum +20 -0
- package/shim/scanner/regexp.go +19 -4
- package/shim/scanner/shim.go +3 -0
- package/shim/stringutil/extra-shim.json +1 -0
- package/shim/stringutil/go.mod +5 -0
- package/shim/stringutil/go.sum +2 -0
- package/shim/stringutil/shim.go +119 -0
- package/shim/transformers/go.mod +5 -5
- package/shim/transformers/go.sum +12 -10
- package/shim/transformers/shim.go +12 -3
- package/shim/tsoptions/command_line_raw.go +44 -0
- package/shim/tsoptions/go.mod +10 -1
- package/shim/tsoptions/go.sum +22 -0
- package/shim/tsoptions/shim.go +1 -1
- package/shim/tspath/go.mod +1 -1
- package/shim/tspath/go.sum +6 -0
- package/shim/vfs/cachedvfs/go.mod +3 -1
- package/shim/vfs/cachedvfs/go.sum +12 -0
- package/shim/vfs/decode.go +26 -0
- package/shim/vfs/decode_test.go +42 -0
- package/shim/vfs/go.mod +7 -1
- package/shim/vfs/go.sum +12 -0
- package/shim/vfs/osvfs/go.mod +7 -1
- package/shim/vfs/osvfs/go.sum +12 -0
- package/src/TtscCompiler.ts +223 -234
- package/src/TtscService.ts +87 -31
- package/src/TtscServiceRequestOptions.ts +21 -0
- package/src/compiler/internal/CapturedProcessOutput.ts +69 -0
- package/src/compiler/internal/CompilerArgumentsInspection.ts +184 -0
- package/src/compiler/internal/EmitOwnershipIndex.ts +254 -0
- package/src/compiler/internal/PrivateCompilerOutput.ts +330 -0
- package/src/compiler/internal/ResidentCheckProcess.ts +445 -0
- package/src/compiler/internal/ResidentCheckProcessOptions.ts +32 -0
- package/src/compiler/internal/ResidentCheckRequest.ts +39 -0
- package/src/compiler/internal/ResidentCheckResult.ts +24 -0
- package/src/compiler/internal/ResidentCheckTelemetry.ts +36 -0
- package/src/compiler/internal/ResidentReplyKind.ts +18 -0
- package/src/compiler/internal/ResidentTransformProcess.ts +299 -0
- package/src/compiler/internal/ResidentTransformProcessOptions.ts +30 -0
- package/src/compiler/internal/ResidentTransformReply.ts +79 -0
- package/src/compiler/internal/ResidentTransformRequestOptions.ts +16 -0
- package/src/compiler/internal/ResidentTransformRequests.ts +198 -0
- package/src/compiler/internal/StartedResidentTransform.ts +29 -0
- package/src/compiler/internal/TransformProjectWorkerReply.ts +37 -0
- package/src/compiler/internal/TransformProjectWorkerRequest.ts +42 -0
- package/src/compiler/internal/build/BuildExecution.ts +1261 -0
- package/src/compiler/internal/build/BuildTiming.ts +145 -0
- package/src/compiler/internal/build/CompilerDiagnostics.ts +307 -0
- package/src/compiler/internal/build/NativePluginArguments.ts +302 -0
- package/src/compiler/internal/build/PassthroughFlags.ts +229 -0
- package/src/compiler/internal/build/PluginFailureDiagnostics.ts +70 -0
- package/src/compiler/internal/build/ResidentCheckEntryPlan.ts +42 -0
- package/src/compiler/internal/build/ResidentCheckWatchChange.ts +33 -0
- package/src/compiler/internal/build/ResidentCheckWatchSession.ts +501 -0
- package/src/compiler/internal/build/RunBuildOptions.ts +145 -0
- package/src/compiler/internal/build/TsgoArguments.ts +349 -0
- package/src/compiler/internal/build/appendBuildOutput.ts +218 -0
- package/src/compiler/internal/build/bufferResidentCheckEntryRequests.ts +52 -0
- package/src/compiler/internal/build/createProcessDiagnostic.ts +32 -0
- package/src/compiler/internal/build/isAbsoluteLocalProjectInputPath.ts +55 -0
- package/src/compiler/internal/build/mergeProjectInputSnapshots.ts +147 -0
- package/src/compiler/internal/build/normalizeBuildOutput.ts +89 -0
- package/src/compiler/internal/build/parseProjectInputSnapshot.ts +91 -0
- package/src/compiler/internal/build/planResidentCheckEntries.ts +55 -0
- package/src/compiler/internal/build/privateRuntimeRootDir.ts +33 -0
- package/src/compiler/internal/build/residentCheckRequest.ts +41 -0
- package/src/compiler/internal/build/runBuild.ts +61 -0
- package/src/compiler/internal/build/runExternalEmitProvenance.ts +566 -0
- package/src/compiler/internal/build/takeResidentCheckEntryRequest.ts +31 -0
- package/src/compiler/internal/buildNativeCompiler.ts +19 -2
- package/src/compiler/internal/captureProcessOutput.ts +39 -37
- package/src/compiler/internal/compileProjectInMemory.ts +139 -92
- package/src/compiler/internal/ensureExecutable.ts +32 -0
- package/src/compiler/internal/findNearestGoMod.ts +43 -0
- package/src/compiler/internal/isOutsideRelativePath.ts +26 -0
- package/src/compiler/internal/outputText.ts +21 -0
- package/src/compiler/internal/packageRootDir.ts +43 -0
- package/src/compiler/internal/parseNativeTransformOutput.ts +722 -0
- package/src/compiler/internal/project/CompilerProjectSelection.ts +204 -0
- package/src/compiler/internal/project/ConfigJsonText.ts +55 -0
- package/src/compiler/internal/project/compilerUsesCaseSensitiveFileNames.ts +124 -0
- package/src/compiler/internal/project/createNativeProjectContextArgs.ts +14 -19
- package/src/compiler/internal/project/createNativeProjectContextJson.ts +28 -0
- package/src/compiler/internal/project/parseJsonc.ts +318 -0
- package/src/compiler/internal/project/readJsonFile.ts +34 -0
- package/src/compiler/internal/project/readJsoncFile.ts +46 -0
- package/src/compiler/internal/project/readProjectConfig.ts +137 -200
- package/src/compiler/internal/project/resolveOwningProjectConfig.ts +278 -0
- package/src/compiler/internal/project/resolveProjectConfig.ts +18 -127
- package/src/compiler/internal/project/resolveProjectIdentity.ts +153 -0
- package/src/compiler/internal/project/resolveTsconfigExtends.ts +175 -0
- package/src/compiler/internal/project/selectReferencedProject.ts +54 -0
- package/src/compiler/internal/project/tsconfigExtendsFileCandidates.ts +54 -0
- package/src/compiler/internal/readEffectiveCompilerOptions.ts +126 -0
- package/src/compiler/internal/resolveBinary.ts +25 -9
- package/src/compiler/internal/resolveTsgo.ts +31 -11
- package/src/compiler/internal/runNativeCheckWithObservations.ts +211 -0
- package/src/compiler/internal/runSingleFileEmit.ts +92 -27
- package/src/compiler/internal/sharedHost/SEMANTIC_CONFIG_PATH_ENV.ts +2 -0
- package/src/compiler/internal/sharedHost/SidecarEnvironment.ts +151 -0
- package/src/compiler/internal/sharedHost/TSGO_ARGS_CWD_ENV.ts +7 -0
- package/src/compiler/internal/sharedHost/TSGO_ARGS_ENV.ts +7 -0
- package/src/compiler/internal/sharedHost/assertSharedHostCompatibility.ts +48 -0
- package/src/compiler/internal/sharedHost/clearInheritedSemanticConfigPath.ts +27 -0
- package/src/compiler/internal/sharedHost/clearInheritedTsgoArgs.ts +41 -0
- package/src/compiler/internal/sharedHost/inheritedSidecarEnv.ts +45 -0
- package/src/compiler/internal/sharedHost/isLinkedTransform.ts +19 -0
- package/src/compiler/internal/sharedHost/linkedTransformPlugins.ts +25 -0
- package/src/compiler/internal/sharedHost/publishLinkedTransformPlugins.ts +42 -0
- package/src/compiler/internal/sharedHost/resolvePluginConfigDir.ts +33 -0
- package/src/compiler/internal/sharedHost/selectSharedHostPlugin.ts +35 -0
- package/src/compiler/internal/spawnNative.ts +20 -41
- package/src/compiler/internal/startResidentTransform.ts +66 -53
- package/src/compiler/internal/transformProjectInMemory.ts +356 -634
- package/src/compiler/internal/transformProjectInWorker.ts +170 -0
- package/src/compiler/internal/transformProjectWorker.ts +43 -0
- package/src/flags/AnySubcommand.ts +19 -0
- package/src/flags/COMPILER_ENUM_WHITESPACE.ts +35 -0
- package/src/flags/COMPILER_OPTIONS.ts +512 -0
- package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +13 -0
- package/src/flags/COMPILER_OPTION_KINDS.ts +14 -0
- package/src/flags/CompilerOptionSpec.ts +30 -0
- package/src/flags/FLAG_BY_TOKEN.ts +40 -0
- package/src/flags/{schema.ts → FLAG_SCHEMA.ts} +43 -318
- package/src/flags/FlagKind.ts +22 -0
- package/src/flags/FlagLayer.ts +24 -0
- package/src/flags/FlagSpec.ts +118 -0
- package/src/flags/ParseOptions.ts +103 -0
- package/src/flags/ParseResult.ts +44 -0
- package/src/flags/TtscSubcommand.ts +22 -0
- package/src/flags/TtsxSubcommand.ts +13 -0
- package/src/flags/ValueValidator.ts +14 -0
- package/src/flags/buildGoAllowList.ts +43 -0
- package/src/flags/flagsForSubcommand.ts +22 -0
- package/src/flags/getBoolean.ts +27 -0
- package/src/flags/getNumber.ts +24 -0
- package/src/flags/getString.ts +24 -0
- package/src/flags/getStringList.ts +24 -0
- package/src/flags/normalizeCompilerEnumValue.ts +41 -0
- package/src/flags/normalizeFlagToken.ts +38 -0
- package/src/flags/parseFlags.ts +371 -0
- package/src/flags/readCompilerOptionOccurrence.ts +107 -0
- package/src/flags/readCompilerOptionValues.ts +68 -0
- package/src/flags/resolveFlagSpec.ts +29 -0
- package/src/index.ts +9 -3
- package/src/internal/CanonicalTempDirectoryOperations.ts +73 -0
- package/src/internal/CompilerContextSnapshot.ts +139 -0
- package/src/internal/CompilerResultAdapter.ts +320 -0
- package/src/internal/E2ETrace.ts +674 -0
- package/src/internal/IJavaScriptRuntimeCapabilities.ts +50 -0
- package/src/internal/OwnedNativeProcess.ts +417 -0
- package/src/internal/OwnedSynchronousProcess.ts +220 -0
- package/src/internal/RetireLockDirectoryOperations.ts +81 -0
- package/src/internal/SafeCacheCleanupTarget.ts +41 -0
- package/src/internal/SourceNativeRetirement.ts +1109 -0
- package/src/internal/SpawnSyncOutputFiles.ts +29 -0
- package/src/internal/cacheEntryExists.ts +24 -0
- package/src/internal/createCanonicalTempDirectory.ts +35 -18
- package/src/internal/isContendedCandidateRename.ts +35 -0
- package/src/internal/isSpawnSyncFdExhaustion.ts +19 -0
- package/src/internal/javascriptRuntimeCapabilities.ts +166 -0
- package/src/internal/nativeBinary.ts +11 -0
- package/src/internal/parseWindowsDirectoryCaseSensitivity.ts +50 -0
- package/src/internal/pathIdentity/FilesystemPathIdentity.ts +44 -0
- package/src/internal/pathIdentity/FilesystemPathIdentityContext.ts +182 -0
- package/src/internal/pathIdentity/FilesystemPathIdentityOperations.ts +106 -0
- package/src/internal/pathIdentity/ProjectInputPathIdentity.ts +21 -0
- package/src/internal/pathIdentity/ProjectInputPathIdentityContext.ts +21 -0
- package/src/internal/pathIdentity/ProjectInputPathIdentityOperations.ts +22 -0
- package/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts +437 -0
- package/src/internal/pathIdentity/createProjectInputPathIdentityContext.ts +34 -0
- package/src/internal/pathIdentity/isFilesystemPathIdentityWithin.ts +32 -0
- package/src/internal/pathIdentity/isProjectInputPathIdentityWithin.ts +22 -0
- package/src/internal/pathIdentity/resolveFilesystemPath.ts +43 -0
- package/src/internal/pathIdentity/resolvePhysicalPath.ts +31 -0
- package/src/internal/pathIdentity/resolveProjectInputPath.ts +18 -0
- package/src/internal/pluginSource.ts +26 -0
- package/src/internal/projectInputPathIdentity.ts +26 -387
- package/src/internal/resolveNodeBinary.ts +13 -142
- package/src/internal/resolveSafeCacheCleanupTargets.ts +51 -19
- package/src/internal/restoreCompilerError.ts +175 -0
- package/src/internal/retireLockDirectory.ts +166 -0
- package/src/internal/runHoldingLock.ts +55 -0
- package/src/internal/runtimeExecutableIdentity.ts +212 -0
- package/src/internal/serializeCompilerError.ts +145 -0
- package/src/internal/spawnSyncResilient.ts +62 -0
- package/src/internal/spawnSyncWithLowDescriptors.ts +227 -0
- package/src/internal/tsconfig.ts +16 -0
- package/src/launcher/internal/PendingResidentCheckWatchChanges.ts +94 -0
- package/src/launcher/internal/TtscBuildMode.ts +14 -0
- package/src/launcher/internal/TtsxEntryOptions.ts +92 -0
- package/src/launcher/internal/assertNoSolutionBuild.ts +17 -10
- package/src/launcher/internal/assertTtsxNoWatch.ts +49 -0
- package/src/launcher/internal/buildSingleRootProject.ts +303 -0
- package/src/launcher/internal/getCompilerVersionText.ts +20 -5
- package/src/launcher/internal/inlineServedSourceMap.ts +294 -0
- package/src/launcher/internal/linkVirtualEntry.ts +88 -0
- package/src/launcher/internal/{commonJsExportMetadata.ts → parseCommonJsExports.ts} +12 -2
- package/src/launcher/internal/parseTtscBuildArgs.ts +103 -0
- package/src/launcher/internal/parseTtsxCLI.ts +183 -0
- package/src/launcher/internal/prepareExecution.ts +474 -362
- package/src/launcher/internal/prepareTtscBuildMode.ts +64 -0
- package/src/launcher/internal/resolveCacheDir.ts +12 -3
- package/src/launcher/internal/resolveSingleFileOutput.ts +145 -0
- package/src/launcher/internal/resolveTtscserverBinary.ts +20 -5
- package/src/launcher/internal/runTtsc.ts +394 -326
- package/src/launcher/internal/runTtsx.ts +349 -151
- package/src/launcher/internal/runtime/CommonJsRuntimeSource.ts +365 -0
- package/src/launcher/internal/runtime/DependencyBuildAdmission.ts +159 -0
- package/src/launcher/internal/runtime/DependencyBuildGeneration.ts +236 -0
- package/src/launcher/internal/runtime/DependencyBuildLockFence.ts +22 -0
- package/src/launcher/internal/runtime/DependencyBuildLockLease.ts +22 -0
- package/src/launcher/internal/runtime/DependencyBuildLockObservation.ts +49 -0
- package/src/launcher/internal/runtime/DependencyBuildLockProtocol.ts +137 -0
- package/src/launcher/internal/runtime/OwnedProjectSource.ts +140 -0
- package/src/launcher/internal/runtime/OwningModuleOptions.ts +22 -0
- package/src/launcher/internal/runtime/PluginDescriptorInputObservation.ts +112 -0
- package/src/launcher/internal/runtime/ProcessOwnedDirectory.ts +325 -0
- package/src/launcher/internal/runtime/ResolveResult.ts +26 -0
- package/src/launcher/internal/runtime/RuntimeEmitProvenance.ts +58 -0
- package/src/launcher/internal/runtime/RuntimeEntryPreparer.ts +23 -0
- package/src/launcher/internal/runtime/RuntimeFilesystem.ts +64 -0
- package/src/launcher/internal/runtime/RuntimeHookOptions.ts +23 -0
- package/src/launcher/internal/runtime/RuntimeIsolatedEmit.ts +88 -0
- package/src/launcher/internal/runtime/RuntimeLoaderCapabilities.ts +256 -0
- package/src/launcher/internal/runtime/RuntimeManifest.ts +77 -0
- package/src/launcher/internal/runtime/RuntimeManifestRegistry.ts +309 -0
- package/src/launcher/internal/runtime/RuntimeModuleFormat.ts +275 -0
- package/src/launcher/internal/runtime/RuntimeProjectOwnership.ts +139 -0
- package/src/launcher/internal/runtime/TTSX_MINIMUM_NODE_VERSION.ts +11 -0
- package/src/launcher/internal/runtime/acquireDependencyBuildLock.ts +97 -0
- package/src/launcher/internal/runtime/checkNodeRuntimeSupport.ts +94 -0
- package/src/launcher/internal/runtime/claimRuntimeProjectDirectory.ts +54 -0
- package/src/launcher/internal/runtime/commonJsExportNames.ts +57 -0
- package/src/launcher/internal/runtime/commonJsImportFacade.ts +62 -0
- package/src/launcher/internal/runtime/dependencyCacheKey.ts +82 -0
- package/src/launcher/internal/runtime/dependencyCacheRoot.ts +112 -0
- package/src/launcher/internal/runtime/inspectDependencyBuildLock.ts +162 -0
- package/src/launcher/internal/runtime/installRuntimeHooks.ts +2442 -0
- package/src/launcher/internal/runtime/interopProbe.ts +8 -0
- package/src/launcher/internal/runtime/isLocalProcessGone.ts +67 -0
- package/src/launcher/internal/runtime/observeMappedDescriptorResolution.ts +74 -0
- package/src/launcher/internal/runtime/projectModuleOptions.ts +28 -0
- package/src/launcher/internal/runtime/readDependencyCache.ts +89 -0
- package/src/launcher/internal/runtime/realPath.ts +30 -0
- package/src/launcher/internal/runtime/reclaimDependencyBuildLock.ts +27 -0
- package/src/launcher/internal/runtime/releaseDependencyBuildLock.ts +27 -0
- package/src/launcher/internal/runtime/resolveRuntimeCleanTargets.ts +93 -0
- package/src/launcher/internal/runtime/restoreStrippedNodeBuiltinScheme.ts +32 -0
- package/src/launcher/internal/runtime/runtimeRunKey.ts +31 -0
- package/src/launcher/internal/runtime/selectRuntimePluginPolicy.ts +28 -0
- package/src/launcher/internal/runtime/withRuntimeDirectoryLock.ts +92 -0
- package/src/launcher/internal/runtimeCompilerArgs.ts +91 -62
- package/src/launcher/internal/runtimeEmitProfile.ts +70 -0
- package/src/launcher/internal/runtimeHookPreload.ts +3 -3
- package/src/launcher/internal/runtimeOwnerPreload.ts +43 -0
- package/src/launcher/internal/singleRootProjectConfig.ts +38 -0
- package/src/launcher/internal/ttscserver/ILSPPluginSelectionInputs.ts +65 -0
- package/src/launcher/internal/ttscserver/LSPProjectInputDigest.ts +331 -0
- package/src/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.ts +107 -0
- package/src/launcher/internal/ttscserver/fingerprintInitialLSPProjectInputSnapshot.ts +41 -0
- package/src/launcher/internal/ttscserver/initialLSPProjectInputSnapshotIsCurrent.ts +36 -0
- package/src/launcher/internal/ttscserver/materializeLSPPluginManifest.ts +60 -0
- package/src/launcher/internal/ttscserver/needsStdio.ts +32 -0
- package/src/launcher/internal/ttscserver/runTtscserver.ts +592 -0
- package/src/launcher/internal/watch/CompilerDirectoryWatchEventPlan.ts +31 -0
- package/src/launcher/internal/watch/DirectoryWatcher.ts +45 -0
- package/src/launcher/internal/watch/FseventsStreams.ts +303 -0
- package/src/launcher/internal/watch/ProjectInputWatchRules.ts +179 -0
- package/src/launcher/internal/watch/WatchInputChange.ts +31 -0
- package/src/launcher/internal/watch/WatchPaths.ts +156 -0
- package/src/launcher/internal/{watchTopology.ts → watch/WatchTopology.ts} +867 -962
- package/src/launcher/internal/watch/literalGlobRoot.ts +40 -0
- package/src/launcher/internal/watch/planCompilerDirectoryWatchEvent.ts +83 -0
- package/src/launcher/internal/watch/projectInputActiveWatchDirectories.ts +47 -0
- package/src/launcher/internal/watch/projectInputAvailableWatchDirectory.ts +56 -0
- package/src/launcher/internal/watch/projectInputEventShouldNotify.ts +23 -0
- package/src/launcher/internal/watch/projectInputMembershipInvalidatesProgram.ts +63 -0
- package/src/launcher/internal/watch/projectInputReloadEventShouldNotify.ts +127 -0
- package/src/launcher/internal/watch/projectInputReplacementStrandsWatchers.ts +57 -0
- package/src/launcher/internal/watch/projectInputTopologyMayAffect.ts +73 -0
- package/src/launcher/internal/watch/projectInputWatchDirectories.ts +33 -0
- package/src/launcher/internal/watch/reloadInputsForFailedTopologyRefresh.ts +49 -0
- package/src/launcher/internal/watch/syncWatchers.ts +64 -0
- package/src/launcher/internal/watch/watchDirectory.ts +53 -0
- package/src/launcher/internal/watch/watchDirectoryThroughFsWatch.ts +47 -0
- package/src/launcher/ttscserver.ts +1 -1
- package/src/launcher/ttsx.ts +2 -3
- package/src/plugin/CapabilityPluginResolver.ts +549 -0
- package/src/plugin/ITtscCapabilityPlugin.ts +93 -0
- package/src/plugin/internal/CapabilityPluginResult.ts +99 -0
- package/src/plugin/internal/CapabilityResolutionFormat.ts +248 -0
- package/src/plugin/internal/ITtscCapabilityPluginSource.ts +37 -0
- package/src/plugin/internal/ITtscCapabilityResolutionEntry.ts +57 -0
- package/src/plugin/internal/ITtscCapabilityResolutionPlugin.ts +22 -0
- package/src/plugin/internal/capabilityPluginWorker.ts +216 -0
- package/src/plugin/internal/decodeCapabilityCommandReply.ts +27 -0
- package/src/plugin/internal/load/COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE.ts +182 -0
- package/src/plugin/internal/load/PLUGIN_DESCRIPTOR_SHIM_SOURCE.ts +59 -0
- package/src/plugin/internal/load/PluginDescriptorAdmission.ts +75 -0
- package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +432 -0
- package/src/plugin/internal/load/PluginPackageResolution.ts +711 -0
- package/src/plugin/internal/load/ProjectPluginEntries.ts +232 -0
- package/src/plugin/internal/load/RESOLUTION_INPUT_RECORDER_PATH.ts +34 -0
- package/src/plugin/internal/load/collectProjectHostInputs.ts +88 -0
- package/src/plugin/internal/load/composePluginSources.ts +121 -0
- package/src/plugin/internal/load/declaresHostInputReads.ts +52 -0
- package/src/plugin/internal/load/hasProjectPluginEntries.ts +33 -0
- package/src/plugin/internal/load/hashHostInputPaths.ts +44 -0
- package/src/plugin/internal/load/isRelativePluginSpecifier.ts +31 -0
- package/src/plugin/internal/load/loadProjectPlugins.ts +2242 -0
- package/src/plugin/internal/load/moduleResolutionBaseSelects.ts +59 -0
- package/src/plugin/internal/load/observeImportSearchRoots.ts +42 -0
- package/src/plugin/internal/load/pluginLabel.ts +28 -0
- package/src/plugin/internal/load/realpathHostInput.ts +22 -0
- package/src/plugin/internal/load/realpathHostInputPaths.ts +27 -0
- package/src/plugin/internal/load/rejectJsTransformFunctions.ts +23 -0
- package/src/plugin/internal/load/requirePluginSource.ts +34 -0
- package/src/plugin/internal/load/resolveNativeSource.ts +42 -0
- package/src/plugin/internal/load/validatePluginContributors.ts +102 -0
- package/src/plugin/internal/load/validatePluginSource.ts +19 -0
- package/src/plugin/internal/load/visitImportMappedCandidates.ts +63 -0
- package/src/plugin/internal/pluginDescriptorFailureReason.ts +35 -0
- package/src/plugin/internal/pluginDescriptorProcessFailure.ts +48 -0
- package/src/plugin/internal/readCapabilityResolution.ts +193 -0
- package/src/plugin/internal/receiveCapabilityFailure.ts +27 -0
- package/src/plugin/internal/source/CachePrunePolicy.ts +47 -0
- package/src/plugin/internal/source/GoBuildCacheCoordination.ts +588 -0
- package/src/plugin/internal/source/GoSourceInputs.ts +182 -0
- package/src/plugin/internal/source/GoToolResolution.ts +312 -0
- package/src/plugin/internal/source/IGoBuildCachePruneOptions.ts +34 -0
- package/src/plugin/internal/source/IPluginCachePruneOptions.ts +38 -0
- package/src/plugin/internal/source/IPluginModuleReplaceDirectory.ts +30 -0
- package/src/plugin/internal/source/ITtscBuildContributor.ts +19 -0
- package/src/plugin/internal/source/ITtscSourceBuildCachePaths.ts +28 -0
- package/src/plugin/internal/source/NativeSourcePackages.ts +368 -0
- package/src/plugin/internal/source/PluginBinaryUse.ts +159 -0
- package/src/plugin/internal/source/PluginBinaryWaitResult.ts +34 -0
- package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +231 -0
- package/src/plugin/internal/source/PluginBuildEnvironmentWitness.ts +233 -0
- package/src/plugin/internal/source/PluginBuildLockFence.ts +26 -0
- package/src/plugin/internal/source/PluginBuildLockLease.ts +31 -0
- package/src/plugin/internal/source/PluginBuildLockObservation.ts +48 -0
- package/src/plugin/internal/source/PluginBuildLockOwner.ts +225 -0
- package/src/plugin/internal/source/PluginBuildLockProtocol.ts +342 -0
- package/src/plugin/internal/source/SourceBuildCacheLayout.ts +303 -0
- package/src/plugin/internal/source/SourceBuildFilesystemOperations.ts +32 -0
- package/src/plugin/internal/source/SourcePluginAdmission.ts +127 -0
- package/src/plugin/internal/source/SourcePluginWorkspace.ts +446 -0
- package/src/plugin/internal/source/acquirePluginBuildLock.ts +222 -0
- package/src/plugin/internal/source/autoQuoteGoModToken.ts +113 -0
- package/src/plugin/internal/source/buildSourcePlugin.ts +1197 -0
- package/src/plugin/internal/source/collectPluginSourceDirectories.ts +70 -0
- package/src/plugin/internal/source/collectPluginSourceFiles.ts +90 -0
- package/src/plugin/internal/source/computeCacheKey.ts +190 -0
- package/src/plugin/internal/source/copiesPluginSourceEntry.ts +52 -0
- package/src/plugin/internal/source/createExternalSourceSnapshotLayout.ts +66 -0
- package/src/plugin/internal/source/ensureExecutableGoToolchain.ts +87 -0
- package/src/plugin/internal/source/formatDuration.ts +32 -0
- package/src/plugin/internal/source/formatGoWorkPath.ts +42 -0
- package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +803 -0
- package/src/plugin/internal/source/inspectPluginBuildLock.ts +330 -0
- package/src/plugin/internal/source/isPathWithin.ts +24 -0
- package/src/plugin/internal/source/legacyGlobalCacheTargets.ts +71 -0
- package/src/plugin/internal/source/pluginBuildEnvironment.ts +59 -0
- package/src/plugin/internal/source/pluginBuildEnvironmentWorker.ts +30 -0
- package/src/plugin/internal/source/pluginBuildVersions.ts +75 -0
- package/src/plugin/internal/source/pluginModuleReplaceDirectories.ts +96 -0
- package/src/plugin/internal/source/pluginSourceCovers.ts +54 -0
- package/src/plugin/internal/source/pluginSourceDigest.ts +55 -0
- package/src/plugin/internal/source/pluginSourceFilesSignature.ts +54 -0
- package/src/plugin/internal/source/pluginSourceState.ts +69 -0
- package/src/plugin/internal/source/pluginSourceStateHolds.ts +45 -0
- package/src/plugin/internal/source/processPluginBuildEnvironment.ts +40 -0
- package/src/plugin/internal/source/pruneCacheFileRoot.ts +134 -0
- package/src/plugin/internal/source/pruneGoBuildCacheRoot.ts +228 -0
- package/src/plugin/internal/source/prunePluginCacheRoot.ts +507 -0
- package/src/plugin/internal/source/prunesPluginSourceDirectory.ts +25 -0
- package/src/plugin/internal/source/reclaimPluginBuildLock.ts +63 -0
- package/src/plugin/internal/source/recordCacheFileUse.ts +35 -0
- package/src/plugin/internal/source/releasePluginBuildLock.ts +125 -0
- package/src/plugin/internal/source/resolveCleanTargets.ts +84 -0
- package/src/plugin/internal/source/resolveGoCompiler.ts +92 -0
- package/src/plugin/internal/source/resolvePluginCacheRoot.ts +32 -0
- package/src/plugin/internal/source/resolvePluginGoModule.ts +69 -0
- package/src/plugin/internal/source/resolveSourceBuildCachePaths.ts +276 -0
- package/src/plugin/internal/source/selectPluginModuleReplaceDirectories.ts +80 -0
- package/src/plugin/internal/source/spawnGoTool.ts +204 -0
- package/src/plugin/internal/source/touchPluginCacheEntryInUse.ts +44 -0
- package/src/plugin/internal/source/waitForPluginBinary.ts +123 -0
- package/src/plugin/internal/source/windowsGoCommandArgs.ts +19 -0
- package/src/plugin/internal/source/withGoBuildCacheLease.ts +101 -0
- package/src/plugin/internal/writeCapabilityResolution.ts +266 -0
- package/src/plugin/resolveCapabilityPlugins.ts +242 -77
- package/src/register.ts +20 -7
- package/src/structures/ITtscCompilerContext.ts +29 -11
- package/src/structures/ITtscCompilerDiagnostic.ts +24 -7
- package/src/structures/ITtscCompilerResult.ts +75 -25
- package/src/structures/ITtscCompilerTransformation.ts +304 -64
- package/src/structures/ITtscPlugin.ts +24 -8
- package/src/structures/ITtscPluginCapabilities.ts +58 -5
- package/src/structures/ITtscPluginContributor.ts +19 -8
- package/src/structures/ITtscPluginFactoryContext.ts +12 -3
- package/src/structures/ITtscProjectPluginConfig.ts +35 -10
- package/src/structures/TtscPluginStage.ts +9 -0
- package/src/structures/internal/ITtscLoadedNativePlugin.ts +27 -5
- package/src/structures/internal/ITtscParsedProjectConfig.ts +37 -3
- package/src/structures/internal/ITtscProjectIdentity.ts +27 -6
- package/src/structures/internal/ITtscProjectInputSnapshot.ts +31 -8
- package/src/structures/internal/ITtscProjectLocatorOptions.ts +21 -4
- package/src/structures/internal/TtscBuildOptions.ts +38 -14
- package/src/structures/internal/TtscBuildResult.ts +74 -4
- package/src/structures/internal/TtscCommonOptions.ts +59 -14
- package/src/structures/internal/TtscSingleFileEmitOptions.ts +55 -5
- package/tools/gen_shims/main.go +124 -11
- package/tools/gen_shims/package_load_admission_rejects_incomplete_results_test.go +61 -0
- package/tools/gen_shims/private_field_support_preserves_upstream_layout_test.go +104 -0
- package/tools/shim_audit/enum_generation_preserves_existing_family_members_test.go +182 -0
- package/tools/shim_audit/enum_generation_refuses_removed_public_members_test.go +93 -0
- package/tools/shim_audit/main.go +166 -31
- package/tools/shim_audit/main_test.go +35 -0
- package/tools/shim_audit/producer_exemptions_require_rationale_test.go +5 -0
- package/tools/shim_audit/producer_surface_includes_exposed_methods_test.go +5 -0
- package/tools/shim_audit/producer_surface_rejects_unproducible_reference_test.go +5 -0
- package/tools/shim_audit/shim_dir_coverage_rejects_unregistered_shims_test.go +71 -0
- package/utility/command.go +48 -0
- package/utility/flags_gen.go +2 -2
- package/utility/host.go +282 -66
- package/utility/preamble_output.go +245 -0
- package/utility/preamble_output_test.go +90 -0
- package/utility/serve.go +61 -18
- package/cmd/ttscgraph/serve_graph_snapshot_version_matches_typescript_client_test.go +0 -32
- package/cmd/ttscgraph/serve_protocol_version_matches_the_typescript_client_test.go +0 -48
- package/cmd/ttscgraph/serve_session_retries_failed_dump_test.go +0 -103
- package/internal/graph/dump_schema_version_matches_the_typescript_client_test.go +0 -48
- package/internal/graph/edge_kinds_names_every_declared_kind_test.go +0 -49
- package/internal/graph/graph_kind_contracts_match_their_producers_test.go +0 -121
- package/internal/lspserver/lsp_launcher_reload_directory_fingerprint_parity_windows_test.go +0 -94
- package/internal/lspserver/lsp_project_diagnostics_resident_unsupported_falls_back_test.go +0 -123
- package/lib/compiler/internal/paths.d.ts +0 -27
- package/lib/compiler/internal/paths.js +0 -70
- package/lib/compiler/internal/paths.js.map +0 -1
- package/lib/compiler/internal/project/readConfigJson.d.ts +0 -30
- package/lib/compiler/internal/project/readConfigJson.js +0 -208
- package/lib/compiler/internal/project/readConfigJson.js.map +0 -1
- package/lib/compiler/internal/residentCheckProcess.d.ts +0 -44
- package/lib/compiler/internal/residentCheckProcess.js +0 -213
- package/lib/compiler/internal/residentCheckProcess.js.map +0 -1
- package/lib/compiler/internal/residentTransformProcess.d.ts +0 -65
- package/lib/compiler/internal/residentTransformProcess.js +0 -330
- package/lib/compiler/internal/residentTransformProcess.js.map +0 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +0 -25
- package/lib/compiler/internal/resolveEmittedJavaScript.js +0 -165
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +0 -1
- package/lib/compiler/internal/runBuild.d.ts +0 -152
- package/lib/compiler/internal/runBuild.js +0 -1694
- package/lib/compiler/internal/runBuild.js.map +0 -1
- package/lib/compiler/internal/sharedHostHelpers.d.ts +0 -79
- package/lib/compiler/internal/sharedHostHelpers.js +0 -134
- package/lib/compiler/internal/sharedHostHelpers.js.map +0 -1
- package/lib/flags/parser.d.ts +0 -97
- package/lib/flags/parser.js +0 -293
- package/lib/flags/parser.js.map +0 -1
- package/lib/flags/schema.d.ts +0 -191
- package/lib/flags/schema.js.map +0 -1
- package/lib/internal/windowsDirectoryCaseSensitivity.d.ts +0 -10
- package/lib/internal/windowsDirectoryCaseSensitivity.js +0 -34
- package/lib/internal/windowsDirectoryCaseSensitivity.js.map +0 -1
- package/lib/launcher/internal/commonJsExportMetadata.d.ts +0 -7
- package/lib/launcher/internal/commonJsExportMetadata.js.map +0 -1
- package/lib/launcher/internal/registerRuntimeHooks.js +0 -59
- package/lib/launcher/internal/registerRuntimeHooks.js.map +0 -1
- package/lib/launcher/internal/runTtscserver.d.ts +0 -35
- package/lib/launcher/internal/runTtscserver.js +0 -660
- package/lib/launcher/internal/runTtscserver.js.map +0 -1
- package/lib/launcher/internal/runtimeHooks.d.ts +0 -198
- package/lib/launcher/internal/runtimeHooks.js +0 -2579
- package/lib/launcher/internal/runtimeHooks.js.map +0 -1
- package/lib/launcher/internal/servedSourceMap.d.ts +0 -25
- package/lib/launcher/internal/servedSourceMap.js +0 -164
- package/lib/launcher/internal/servedSourceMap.js.map +0 -1
- package/lib/launcher/internal/singleFileOutput.d.ts +0 -16
- package/lib/launcher/internal/singleFileOutput.js +0 -103
- package/lib/launcher/internal/singleFileOutput.js.map +0 -1
- package/lib/launcher/internal/watchTopology.d.ts +0 -329
- package/lib/launcher/internal/watchTopology.js.map +0 -1
- package/lib/plugin/internal/buildSourcePlugin.d.ts +0 -298
- package/lib/plugin/internal/buildSourcePlugin.js +0 -3086
- package/lib/plugin/internal/buildSourcePlugin.js.map +0 -1
- package/lib/plugin/internal/capabilityResolutionCache.d.ts +0 -76
- package/lib/plugin/internal/capabilityResolutionCache.js +0 -224
- package/lib/plugin/internal/capabilityResolutionCache.js.map +0 -1
- package/lib/plugin/internal/descriptorProcessFailure.d.ts +0 -36
- package/lib/plugin/internal/descriptorProcessFailure.js +0 -62
- package/lib/plugin/internal/descriptorProcessFailure.js.map +0 -1
- package/lib/plugin/internal/loadProjectPlugins.d.ts +0 -74
- package/lib/plugin/internal/loadProjectPlugins.js +0 -2379
- package/lib/plugin/internal/loadProjectPlugins.js.map +0 -1
- package/src/compiler/internal/paths.ts +0 -68
- package/src/compiler/internal/project/readConfigJson.ts +0 -209
- package/src/compiler/internal/residentCheckProcess.ts +0 -259
- package/src/compiler/internal/residentTransformProcess.ts +0 -406
- package/src/compiler/internal/resolveEmittedJavaScript.ts +0 -197
- package/src/compiler/internal/runBuild.ts +0 -2345
- package/src/compiler/internal/sharedHostHelpers.ts +0 -154
- package/src/flags/parser.ts +0 -459
- package/src/internal/windowsDirectoryCaseSensitivity.ts +0 -33
- package/src/launcher/internal/registerRuntimeHooks.ts +0 -68
- package/src/launcher/internal/runTtscserver.ts +0 -841
- package/src/launcher/internal/runtimeHooks.ts +0 -3197
- package/src/launcher/internal/servedSourceMap.ts +0 -183
- package/src/launcher/internal/singleFileOutput.ts +0 -133
- package/src/plugin/internal/buildSourcePlugin.ts +0 -3990
- package/src/plugin/internal/capabilityResolutionCache.ts +0 -305
- package/src/plugin/internal/descriptorProcessFailure.ts +0 -69
- package/src/plugin/internal/loadProjectPlugins.ts +0 -3044
- package/tools/shim_audit/shim_dir_coverage_test.go +0 -25
- /package/lib/{launcher/internal/registerRuntimeHooks.d.ts → compiler/internal/transformProjectWorker.d.ts} +0 -0
|
@@ -1,2579 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TTSX_MINIMUM_NODE_VERSION = void 0;
|
|
7
|
-
exports.checkNodeRuntimeSupport = checkNodeRuntimeSupport;
|
|
8
|
-
exports.installRuntimeHooks = installRuntimeHooks;
|
|
9
|
-
exports.entryModuleFormat = entryModuleFormat;
|
|
10
|
-
exports.restoreStrippedNodeBuiltinScheme = restoreStrippedNodeBuiltinScheme;
|
|
11
|
-
exports.projectModuleOptions = projectModuleOptions;
|
|
12
|
-
exports.isWithin = isWithin;
|
|
13
|
-
exports.dependencyCacheKey = dependencyCacheKey;
|
|
14
|
-
exports.readDependencyCache = readDependencyCache;
|
|
15
|
-
exports.dependencyCacheRoot = dependencyCacheRoot;
|
|
16
|
-
exports.acquireDependencyBuildLock = acquireDependencyBuildLock;
|
|
17
|
-
exports.releaseDependencyBuildLock = releaseDependencyBuildLock;
|
|
18
|
-
exports.reclaimDependencyBuildLock = reclaimDependencyBuildLock;
|
|
19
|
-
exports.inspectDependencyBuildLock = inspectDependencyBuildLock;
|
|
20
|
-
exports.realPath = realPath;
|
|
21
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
22
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
23
|
-
const node_module_1 = require("node:module");
|
|
24
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
25
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
26
|
-
const node_url_1 = require("node:url");
|
|
27
|
-
const readProjectConfig_1 = require("../../compiler/internal/project/readProjectConfig");
|
|
28
|
-
const resolveEmittedJavaScript_1 = require("../../compiler/internal/resolveEmittedJavaScript");
|
|
29
|
-
const resolveTsgo_1 = require("../../compiler/internal/resolveTsgo");
|
|
30
|
-
const runBuild_1 = require("../../compiler/internal/runBuild");
|
|
31
|
-
const spawnNative_1 = require("../../compiler/internal/spawnNative");
|
|
32
|
-
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
33
|
-
const projectInputPathIdentity_1 = require("../../internal/projectInputPathIdentity");
|
|
34
|
-
const commonJsExportMetadata_1 = require("./commonJsExportMetadata");
|
|
35
|
-
const runtimeCompilerArgs_1 = require("./runtimeCompilerArgs");
|
|
36
|
-
const servedSourceMap_1 = require("./servedSourceMap");
|
|
37
|
-
/**
|
|
38
|
-
* One emit policy for orphan execution and CommonJS export discovery. The
|
|
39
|
-
* compiler ignores the consumer's config, lowers proposal syntax, and checks no
|
|
40
|
-
* types because the entry build owns diagnostics. Isolation prevents imported
|
|
41
|
-
* const-enum inlining and secondary emits, and keeps const enums as runtime
|
|
42
|
-
* exports that the name scanner must also observe.
|
|
43
|
-
*/
|
|
44
|
-
const ISOLATED_EMIT_ARGS = [
|
|
45
|
-
"--ignoreConfig",
|
|
46
|
-
"--target",
|
|
47
|
-
"es2022",
|
|
48
|
-
"--noCheck",
|
|
49
|
-
"--skipLibCheck",
|
|
50
|
-
"--noResolve",
|
|
51
|
-
"--isolatedModules",
|
|
52
|
-
];
|
|
53
|
-
/**
|
|
54
|
-
* Synchronous Node module hooks installed (via `module.registerHooks`) in the
|
|
55
|
-
* child process `ttsx` spawns to run a TypeScript entry _from source_.
|
|
56
|
-
*
|
|
57
|
-
* They give the runner ts-node-style whole-graph reach without weakening the
|
|
58
|
-
* compile gate. The owning entry project is type-checked and built up front (by
|
|
59
|
-
* `prepareExecution`, with its transform plugins such as typia); these hooks
|
|
60
|
-
* serve that build under the source URLs so `__dirname`/`import.meta.url` keep
|
|
61
|
-
* pointing at the source tree. Three load paths:
|
|
62
|
-
*
|
|
63
|
-
* 1. A `.ts` belonging to the entry project → serve the pre-built emitted JS
|
|
64
|
-
* (transform plugins already applied), mapped by the project's `rootDir`.
|
|
65
|
-
* 2. Any other raw `.ts` dependency (a published or workspace package that ships
|
|
66
|
-
* source) → build its own owning `tsconfig.json` once via `runBuild` and
|
|
67
|
-
* serve the emit. A real build (not a type-strip) is required because Node's
|
|
68
|
-
* type-stripping cannot do cross-file type-only elision — e.g. a
|
|
69
|
-
* value-shaped import of a type+namespace merge survives stripping and
|
|
70
|
-
* dangles at runtime.
|
|
71
|
-
* 3. No owning tsconfig: use an isolated tsgo emit in the runtime module format,
|
|
72
|
-
* lowering standard decorators and CommonJS imports/exports. Type stripping
|
|
73
|
-
* remains recovery when no compiler emit is available.
|
|
74
|
-
*
|
|
75
|
-
* The hooks are synchronous and run on the main thread (not a loader worker):
|
|
76
|
-
* that is what lets a CommonJS `require("./x")` chain reach them and what makes
|
|
77
|
-
* `require.resolve(..., { paths })` inside `runBuild`'s plugin loader behave.
|
|
78
|
-
*/
|
|
79
|
-
/** Source/JS extensions probed when an extensionless relative import fails. */
|
|
80
|
-
const RESOLVABLE_EXTENSIONS = [
|
|
81
|
-
".ts",
|
|
82
|
-
".tsx",
|
|
83
|
-
".mts",
|
|
84
|
-
".cts",
|
|
85
|
-
".js",
|
|
86
|
-
".mjs",
|
|
87
|
-
".cjs",
|
|
88
|
-
];
|
|
89
|
-
/** Union of the ttsx rescue probes and Node's built-in CommonJS probes. */
|
|
90
|
-
const DESCRIPTOR_PROBE_EXTENSIONS = [
|
|
91
|
-
...RESOLVABLE_EXTENSIONS,
|
|
92
|
-
".json",
|
|
93
|
-
".node",
|
|
94
|
-
];
|
|
95
|
-
/** TypeScript source extensions these hooks compile. */
|
|
96
|
-
const TYPESCRIPT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
97
|
-
let environmentManifestCache;
|
|
98
|
-
const registeredManifests = [];
|
|
99
|
-
function environmentManifest() {
|
|
100
|
-
if (environmentManifestCache !== undefined) {
|
|
101
|
-
return environmentManifestCache;
|
|
102
|
-
}
|
|
103
|
-
const file = process.env.TTSX_RUNTIME_MANIFEST;
|
|
104
|
-
if (file === undefined || file.length === 0) {
|
|
105
|
-
environmentManifestCache = null;
|
|
106
|
-
return environmentManifestCache;
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
environmentManifestCache = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
environmentManifestCache = null;
|
|
113
|
-
}
|
|
114
|
-
return environmentManifestCache;
|
|
115
|
-
}
|
|
116
|
-
/** Every checked entry emit available to this runtime, in ownership order. */
|
|
117
|
-
function runtimeManifests() {
|
|
118
|
-
const inherited = environmentManifest();
|
|
119
|
-
return inherited === null
|
|
120
|
-
? registeredManifests
|
|
121
|
-
: [inherited, ...registeredManifests];
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Lowest Node.js the ttsx source runtime supports. The synchronous
|
|
125
|
-
* `module.registerHooks` (Node 22.15.0) is the highest floor among the runtime
|
|
126
|
-
* APIs these hooks depend on — `stripTypeScriptTypes` (22.13.0) and the child's
|
|
127
|
-
* `--disable-warning` flag (20.11.0) are both lower — so it sets the effective
|
|
128
|
-
* minimum. Kept in sync with `packages/ttsc/package.json#engines.node` and the
|
|
129
|
-
* documented requirement in `website/src/content/docs/development/index.mdx`.
|
|
130
|
-
*/
|
|
131
|
-
exports.TTSX_MINIMUM_NODE_VERSION = "22.15.0";
|
|
132
|
-
const TTSX_MINIMUM_NODE_PARTS = [22, 15, 0];
|
|
133
|
-
/**
|
|
134
|
-
* Report why the running (or a candidate) Node.js version cannot execute the
|
|
135
|
-
* ttsx source runtime, or `null` when it can. Returning an actionable message —
|
|
136
|
-
* rather than letting the child die with an internal `TypeError` on the missing
|
|
137
|
-
* `registerHooks`, or Node 18 rejecting `--disable-warning` with exit 9 — is
|
|
138
|
-
* what turns an opaque internal failure into a clear version diagnostic.
|
|
139
|
-
*
|
|
140
|
-
* Exported for direct exercise by the ttsx e2e suite: the built launcher can
|
|
141
|
-
* only be spawned under the Node version running the tests, so the boundary
|
|
142
|
-
* around the floor cannot otherwise be pinned on CI.
|
|
143
|
-
*/
|
|
144
|
-
function checkNodeRuntimeSupport(version) {
|
|
145
|
-
const parts = parseNodeVersion(version);
|
|
146
|
-
if (parts === null) {
|
|
147
|
-
// An unrecognizable version string is not proof of an unsupported runtime;
|
|
148
|
-
// let execution proceed rather than block on a parsing quirk.
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
if (compareVersionParts(parts, TTSX_MINIMUM_NODE_PARTS) >= 0) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
return (`ttsx requires Node.js ${exports.TTSX_MINIMUM_NODE_VERSION} or later, but this ` +
|
|
155
|
-
`process is Node.js ${version}. The source runtime installs synchronous ` +
|
|
156
|
-
`module hooks (module.registerHooks, Node 22.15.0) and strips types with ` +
|
|
157
|
-
`module.stripTypeScriptTypes (Node 22.13.0), neither of which exists on ` +
|
|
158
|
-
`earlier releases. Upgrade Node.js to 22.15.0+ (or the current LTS), or ` +
|
|
159
|
-
`compile the project with \`ttsc\` and run the emitted JavaScript directly.`);
|
|
160
|
-
}
|
|
161
|
-
function parseNodeVersion(version) {
|
|
162
|
-
const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(version.trim());
|
|
163
|
-
if (match === null) {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
167
|
-
}
|
|
168
|
-
function compareVersionParts(a, b) {
|
|
169
|
-
for (let index = 0; index < 3; index += 1) {
|
|
170
|
-
if (a[index] !== b[index]) {
|
|
171
|
-
return a[index] < b[index] ? -1 : 1;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return 0;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Throw an actionable version error when the current Node.js cannot run the
|
|
178
|
-
* ttsx source runtime. Guards the hook-installation boundary directly (a child
|
|
179
|
-
* or grandchild that inherits the runtime preload under an unsupported Node) so
|
|
180
|
-
* the failure is diagnosed here instead of surfacing as a bare `TypeError:
|
|
181
|
-
* registerHooks is not a function`.
|
|
182
|
-
*/
|
|
183
|
-
function assertNodeRuntimeSupport() {
|
|
184
|
-
const message = checkNodeRuntimeSupport(process.versions.node);
|
|
185
|
-
if (message !== null) {
|
|
186
|
-
throw new Error(message);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
let installed = false;
|
|
190
|
-
let prepareRuntimeEntry;
|
|
191
|
-
/**
|
|
192
|
-
* Install the source-loading hooks on the current (main) thread. Idempotent:
|
|
193
|
-
* the bootstrap installs them for the entry process, and `NODE_OPTIONS`
|
|
194
|
-
* re-imports the installer in every child process the program spawns — both may
|
|
195
|
-
* run in the same process.
|
|
196
|
-
*
|
|
197
|
-
* Two hooks are needed, because `module.registerHooks` does not intercept a
|
|
198
|
-
* `require()` made from inside a CommonJS module that was itself reached
|
|
199
|
-
* through an ESM `import` (the interop translator loads it on the raw CJS
|
|
200
|
-
* path). The ESM graph goes through `registerHooks`; the CommonJS `require`
|
|
201
|
-
* graph goes through `Module._extensions` and `Module._resolveFilename` — the
|
|
202
|
-
* canonical loader extension points `ts-node`/`tsx` use for the same reason.
|
|
203
|
-
*
|
|
204
|
-
* Both halves of that second graph are required, and they answer different
|
|
205
|
-
* questions. `_extensions` decides how a file that was _found_ is compiled, and
|
|
206
|
-
* Node reuses its keys when it probes an extensionless request, so
|
|
207
|
-
* `require("./x")` reaches `x.ts` for free. Nothing there resolves a request
|
|
208
|
-
* that already carries an extension: `require("./x.js")` backed only by `x.ts`
|
|
209
|
-
* is a resolution failure before any compiler is consulted, which is why the
|
|
210
|
-
* rescue is installed on `_resolveFilename` as well (samchon/ttsc#1280).
|
|
211
|
-
*/
|
|
212
|
-
function installRuntimeHooks(options = {}) {
|
|
213
|
-
if (options.prepareEntry !== undefined) {
|
|
214
|
-
prepareRuntimeEntry = options.prepareEntry;
|
|
215
|
-
}
|
|
216
|
-
if (installed) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
assertNodeRuntimeSupport();
|
|
220
|
-
installed = true;
|
|
221
|
-
// Map error stacks through the source maps the serve path now inlines, so a
|
|
222
|
-
// thrown frame reports the true `.ts` line:col out of the box (no
|
|
223
|
-
// `--enable-source-maps` needed). Applied before the entry loads; user code
|
|
224
|
-
// that later toggles it wins, since this is a plain runtime switch.
|
|
225
|
-
if (typeof process.setSourceMapsEnabled === "function") {
|
|
226
|
-
process.setSourceMapsEnabled(true);
|
|
227
|
-
}
|
|
228
|
-
(0, node_module_1.registerHooks)({ load, resolve });
|
|
229
|
-
installCommonJsHook();
|
|
230
|
-
installCommonJsResolveHook();
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Register a CommonJS `require` handler for each TypeScript source extension so
|
|
234
|
-
* a `require("./x")` chain compiles `.ts` the same way the ESM `load` hook
|
|
235
|
-
* does.
|
|
236
|
-
*/
|
|
237
|
-
function installCommonJsHook() {
|
|
238
|
-
const extensions = node_module_1.Module._extensions;
|
|
239
|
-
const compile = (module, filename) => {
|
|
240
|
-
const parent = module.parent?.filename;
|
|
241
|
-
module._compile(resolveServedSource(filename, (0, node_url_1.pathToFileURL)(filename).href, typeof parent !== "string" || !isTypeScriptSource(parent)).source, filename);
|
|
242
|
-
};
|
|
243
|
-
for (const extension of [".ts", ".tsx", ".cts"]) {
|
|
244
|
-
extensions[extension] = compile;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Map a JavaScript spelling back to its TypeScript source on the CommonJS
|
|
249
|
-
* resolution path, so `require("./x.js")` finds `x.ts` when nothing emitted
|
|
250
|
-
* `x.js`.
|
|
251
|
-
*
|
|
252
|
-
* TypeScript asks authors to write the emitted `.js` extension in a relative
|
|
253
|
-
* specifier, so this spelling is the documented one rather than a mistake, and
|
|
254
|
-
* the ESM `resolve` hook has always rescued it. The CommonJS graph could not,
|
|
255
|
-
* and on Node 22 that graph is reached by every `require()` inside a CommonJS
|
|
256
|
-
* module the ESM loader evaluated — `module.registerHooks` sees the `import()`
|
|
257
|
-
* of that module and nothing within it. Node 24 routes the same `require`
|
|
258
|
-
* through the hooks, which is why the gap was only ever visible on the oldest
|
|
259
|
-
* runtime ttsx supports (`engines.node` is `>=22.15.0`).
|
|
260
|
-
*
|
|
261
|
-
* The wrapper only ever answers a request Node's own resolver already refused,
|
|
262
|
-
* so a resolution that succeeds is never perturbed, and a request no candidate
|
|
263
|
-
* satisfies rethrows Node's original error with its `MODULE_NOT_FOUND` code and
|
|
264
|
-
* `requireStack` intact. `require.resolve` shares this entry point and is
|
|
265
|
-
* rescued with it, except in its `{ paths }` form, which resolves against the
|
|
266
|
-
* caller's list rather than the parent this reads.
|
|
267
|
-
*/
|
|
268
|
-
function installCommonJsResolveHook() {
|
|
269
|
-
const internals = node_module_1.Module;
|
|
270
|
-
const original = internals._resolveFilename;
|
|
271
|
-
internals._resolveFilename = function resolveFilename(request, parent, isMain, options) {
|
|
272
|
-
try {
|
|
273
|
-
return original.call(this, request, parent, isMain, options);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
const rescued = rescueCommonJsRequest(request, parent, options);
|
|
277
|
-
if (rescued === null) {
|
|
278
|
-
throw error;
|
|
279
|
-
}
|
|
280
|
-
return rescued;
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* The TypeScript source a refused CommonJS request names, or `null`.
|
|
286
|
-
*
|
|
287
|
-
* Only a relative or absolute request can be rescued: a bare specifier is a
|
|
288
|
-
* package lookup, whose own resolver already probed every extension the
|
|
289
|
-
* installed `_extensions` keys declare.
|
|
290
|
-
*
|
|
291
|
-
* Two shapes decline before that. `_resolveFilename` is an internal entry point
|
|
292
|
-
* anything may call, so a non-string request reaches here as readily as a
|
|
293
|
-
* specifier does, and reading it would replace Node's own argument error with a
|
|
294
|
-
* `TypeError` from this file. And `require.resolve(request, { paths })`
|
|
295
|
-
* resolves against the caller's list, which this rescue does not consult, so
|
|
296
|
-
* answering it from the parent's directory would be a different question's
|
|
297
|
-
* answer.
|
|
298
|
-
*/
|
|
299
|
-
function rescueCommonJsRequest(request, parent, options) {
|
|
300
|
-
if (typeof request !== "string") {
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
303
|
-
if (typeof options === "object" &&
|
|
304
|
-
options !== null &&
|
|
305
|
-
Array.isArray(options.paths)) {
|
|
306
|
-
return null;
|
|
307
|
-
}
|
|
308
|
-
let base;
|
|
309
|
-
if (node_path_1.default.isAbsolute(request)) {
|
|
310
|
-
base = request;
|
|
311
|
-
}
|
|
312
|
-
else if (isRelativeSpecifier(request)) {
|
|
313
|
-
const from = parent?.filename;
|
|
314
|
-
if (typeof from !== "string") {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
base = node_path_1.default.resolve(node_path_1.default.dirname(from), request);
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
for (const candidate of typescriptSourcesForJavaScriptSpecifier(base)) {
|
|
323
|
-
if (isFile(candidate)) {
|
|
324
|
-
return candidate;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* The module format of the entry source file, derived from the entry project's
|
|
331
|
-
* compiler options (via the runtime manifest) the same way the served files are
|
|
332
|
-
* classified. The bootstrap uses it to load the entry through a CommonJS
|
|
333
|
-
* `require` or an ESM `import`.
|
|
334
|
-
*/
|
|
335
|
-
function entryModuleFormat(entryFile) {
|
|
336
|
-
const real = realPath(entryFile);
|
|
337
|
-
const owner = findEntryEmit(real)?.manifest;
|
|
338
|
-
return moduleFormat(entryFile, owner === undefined ? null : (owner.moduleOptions ?? {})) === "module"
|
|
339
|
-
? "module"
|
|
340
|
-
: "commonjs";
|
|
341
|
-
}
|
|
342
|
-
/** TypeScript URLs resolved at a JavaScript-to-TypeScript entry boundary. */
|
|
343
|
-
const runtimeEntryUrls = new Set();
|
|
344
|
-
/**
|
|
345
|
-
* Rescue an extensionless or directory relative specifier that Node's resolver
|
|
346
|
-
* rejected. Only runs after `nextResolve` throws, so a successful resolution is
|
|
347
|
-
* never perturbed; a genuinely missing module finds no candidate and the
|
|
348
|
-
* original error is rethrown, preserving `ERR_MODULE_NOT_FOUND`.
|
|
349
|
-
*/
|
|
350
|
-
function resolve(specifier, context, nextResolve) {
|
|
351
|
-
recordPluginDescriptorResolutionCandidates(specifier, context.parentURL);
|
|
352
|
-
try {
|
|
353
|
-
const result = rememberRuntimeEntry(rememberCommonJsNamedInterop(restoreStrippedNodeBuiltinScheme(specifier, nextResolve(specifier, context)), context), context);
|
|
354
|
-
recordPluginDescriptorResolution(specifier, context.parentURL, result.url);
|
|
355
|
-
return result;
|
|
356
|
-
}
|
|
357
|
-
catch (error) {
|
|
358
|
-
const rescued = probeRescuableSpecifier(specifier, context.parentURL);
|
|
359
|
-
if (rescued === null) {
|
|
360
|
-
throw error;
|
|
361
|
-
}
|
|
362
|
-
const result = rememberRuntimeEntry(rememberCommonJsNamedInterop({ shortCircuit: true, url: rescued }, context), context);
|
|
363
|
-
recordPluginDescriptorResolution(specifier, context.parentURL, result.url);
|
|
364
|
-
return result;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Fingerprint every path whose state can redirect one descriptor import.
|
|
369
|
-
*
|
|
370
|
-
* This runs before the real resolver. Reporting candidates only after the
|
|
371
|
-
* descriptor finished would pair an earlier descriptor result with later file
|
|
372
|
-
* state when a higher-priority candidate appeared during evaluation.
|
|
373
|
-
*/
|
|
374
|
-
function recordPluginDescriptorResolutionCandidates(specifier, parentURL) {
|
|
375
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
376
|
-
return;
|
|
377
|
-
if ((0, node_module_1.isBuiltin)(specifier) || specifier.startsWith("node:"))
|
|
378
|
-
return;
|
|
379
|
-
const parent = runtimeFilePath(parentURL);
|
|
380
|
-
if (parent === undefined)
|
|
381
|
-
return;
|
|
382
|
-
const recorded = new Set();
|
|
383
|
-
const record = (candidate) => {
|
|
384
|
-
const resolved = node_path_1.default.resolve(candidate);
|
|
385
|
-
if (recorded.has(resolved))
|
|
386
|
-
return;
|
|
387
|
-
recorded.add(resolved);
|
|
388
|
-
recordPluginDescriptorInput({
|
|
389
|
-
parent,
|
|
390
|
-
resolved,
|
|
391
|
-
});
|
|
392
|
-
};
|
|
393
|
-
const recordManifestTargets = (value, directory, allowBare = false) => {
|
|
394
|
-
if (typeof value === "string") {
|
|
395
|
-
if (value !== "" &&
|
|
396
|
-
(allowBare || value.startsWith("./") || value.startsWith("../"))) {
|
|
397
|
-
recordBase(node_path_1.default.resolve(directory, value));
|
|
398
|
-
}
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
if (Array.isArray(value)) {
|
|
402
|
-
for (const item of value) {
|
|
403
|
-
recordManifestTargets(item, directory, allowBare);
|
|
404
|
-
}
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
if (value !== null && typeof value === "object") {
|
|
408
|
-
for (const item of Object.values(value)) {
|
|
409
|
-
recordManifestTargets(item, directory, allowBare);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
const recordPackageManifests = (file) => {
|
|
414
|
-
for (let directory = node_path_1.default.dirname(file);; directory = node_path_1.default.dirname(directory)) {
|
|
415
|
-
const manifest = node_path_1.default.join(directory, "package.json");
|
|
416
|
-
record(manifest);
|
|
417
|
-
if (isFile(manifest))
|
|
418
|
-
return;
|
|
419
|
-
const parentDirectory = node_path_1.default.dirname(directory);
|
|
420
|
-
if (parentDirectory === directory)
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
const localBases = (value) => {
|
|
425
|
-
if (value.startsWith("file:"))
|
|
426
|
-
return [(0, node_url_1.fileURLToPath)(value)];
|
|
427
|
-
const raw = node_path_1.default.resolve(node_path_1.default.dirname(parent), value);
|
|
428
|
-
const suffixStart = value.search(/[?#]/);
|
|
429
|
-
if (suffixStart === -1)
|
|
430
|
-
return [raw];
|
|
431
|
-
const pathname = value.slice(0, suffixStart);
|
|
432
|
-
return pathname === ""
|
|
433
|
-
? [raw]
|
|
434
|
-
: [...new Set([raw, node_path_1.default.resolve(node_path_1.default.dirname(parent), pathname)])];
|
|
435
|
-
};
|
|
436
|
-
const bases = new Set();
|
|
437
|
-
const recordBase = (base) => {
|
|
438
|
-
const resolvedBase = node_path_1.default.resolve(base);
|
|
439
|
-
if (bases.has(resolvedBase))
|
|
440
|
-
return;
|
|
441
|
-
bases.add(resolvedBase);
|
|
442
|
-
record(resolvedBase);
|
|
443
|
-
for (const candidate of typescriptSourcesForJavaScriptSpecifier(resolvedBase)) {
|
|
444
|
-
record(candidate);
|
|
445
|
-
}
|
|
446
|
-
for (const extension of DESCRIPTOR_PROBE_EXTENSIONS) {
|
|
447
|
-
record(resolvedBase + extension);
|
|
448
|
-
}
|
|
449
|
-
const manifestFile = node_path_1.default.join(resolvedBase, "package.json");
|
|
450
|
-
record(manifestFile);
|
|
451
|
-
for (const extension of DESCRIPTOR_PROBE_EXTENSIONS) {
|
|
452
|
-
record(node_path_1.default.join(resolvedBase, `index${extension}`));
|
|
453
|
-
}
|
|
454
|
-
try {
|
|
455
|
-
const manifest = JSON.parse(node_fs_1.default.readFileSync(manifestFile, "utf8").replace(/^\uFEFF/, ""));
|
|
456
|
-
recordManifestTargets(manifest.exports, resolvedBase);
|
|
457
|
-
recordManifestTargets(manifest.module, resolvedBase, true);
|
|
458
|
-
recordManifestTargets(manifest.main, resolvedBase, true);
|
|
459
|
-
}
|
|
460
|
-
catch {
|
|
461
|
-
// The real resolver owns malformed package diagnostics.
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
if (specifier.startsWith(".") ||
|
|
465
|
-
node_path_1.default.isAbsolute(specifier) ||
|
|
466
|
-
specifier.startsWith("file:")) {
|
|
467
|
-
try {
|
|
468
|
-
for (const base of localBases(specifier)) {
|
|
469
|
-
recordPackageManifests(base);
|
|
470
|
-
if (isFile(base))
|
|
471
|
-
record(base);
|
|
472
|
-
else
|
|
473
|
-
recordBase(base);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
catch {
|
|
477
|
-
// The real resolver owns invalid URL spellings.
|
|
478
|
-
}
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const parts = specifier.split("/");
|
|
482
|
-
const packageParts = parts[0]?.startsWith("@")
|
|
483
|
-
? parts.slice(0, 2)
|
|
484
|
-
: parts.slice(0, 1);
|
|
485
|
-
if (packageParts.some((part) => part === undefined || part === ""))
|
|
486
|
-
return;
|
|
487
|
-
const packageName = packageParts.join("/");
|
|
488
|
-
const subpath = parts.slice(packageParts.length);
|
|
489
|
-
for (const searchPath of (0, node_module_1.createRequire)(parent).resolve.paths(specifier) ??
|
|
490
|
-
[]) {
|
|
491
|
-
const packageDirectory = node_path_1.default.join(searchPath, packageName);
|
|
492
|
-
recordBase(packageDirectory);
|
|
493
|
-
if (subpath.length !== 0) {
|
|
494
|
-
recordBase(node_path_1.default.join(packageDirectory, ...subpath));
|
|
495
|
-
}
|
|
496
|
-
// CommonJS resolution continues past an existing but unusable package
|
|
497
|
-
// directory. Record every search root before the resolver runs so a
|
|
498
|
-
// farther selected package retains evaluation-time hashes for its
|
|
499
|
-
// superseding candidates.
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Report one resolved descriptor edge to the parent loader. The channel is
|
|
504
|
-
* armed by the generated descriptor shim only after ttsx's own bootstrap and
|
|
505
|
-
* imports have loaded, keeping compiler implementation files out of the
|
|
506
|
-
* project's persistent-cache inputs.
|
|
507
|
-
*/
|
|
508
|
-
function recordPluginDescriptorResolution(specifier, parentURL, resolvedURL) {
|
|
509
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
510
|
-
return;
|
|
511
|
-
const out = process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_OUT;
|
|
512
|
-
if (out === undefined || out.length === 0)
|
|
513
|
-
return;
|
|
514
|
-
const resolved = runtimeFilePath(resolvedURL);
|
|
515
|
-
if (resolved === undefined)
|
|
516
|
-
return;
|
|
517
|
-
const parent = runtimeFilePath(parentURL);
|
|
518
|
-
recordPluginDescriptorInput({
|
|
519
|
-
...(parent === undefined ? {} : { parent }),
|
|
520
|
-
resolved,
|
|
521
|
-
specifier,
|
|
522
|
-
});
|
|
523
|
-
for (let directory = node_path_1.default.dirname(resolved);; directory = node_path_1.default.dirname(directory)) {
|
|
524
|
-
const manifest = node_path_1.default.join(directory, "package.json");
|
|
525
|
-
recordPluginDescriptorInput({
|
|
526
|
-
...(parent === undefined ? {} : { parent }),
|
|
527
|
-
resolved: manifest,
|
|
528
|
-
});
|
|
529
|
-
if (isFile(manifest))
|
|
530
|
-
break;
|
|
531
|
-
const parentDirectory = node_path_1.default.dirname(directory);
|
|
532
|
-
if (parentDirectory === directory)
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function recordPluginDescriptorInput(record) {
|
|
537
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
538
|
-
return;
|
|
539
|
-
const out = process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_OUT;
|
|
540
|
-
if (out === undefined || out.length === 0)
|
|
541
|
-
return;
|
|
542
|
-
recordPluginDescriptorInputOnce(record);
|
|
543
|
-
const resolved = node_path_1.default.resolve(record.resolved);
|
|
544
|
-
const parsed = node_path_1.default.parse(resolved);
|
|
545
|
-
let current = parsed.root;
|
|
546
|
-
const relative = node_path_1.default.relative(parsed.root, resolved);
|
|
547
|
-
for (const segment of relative.split(node_path_1.default.sep).slice(0, -1)) {
|
|
548
|
-
if (segment === "")
|
|
549
|
-
continue;
|
|
550
|
-
current = node_path_1.default.join(current, segment);
|
|
551
|
-
try {
|
|
552
|
-
if (node_fs_1.default.lstatSync(current).isSymbolicLink()) {
|
|
553
|
-
recordPluginDescriptorInputOnce({ resolved: current });
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
catch {
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
/** Record one path without recursively revisiting its lexical ancestors. */
|
|
562
|
-
function recordPluginDescriptorInputOnce(record) {
|
|
563
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
564
|
-
return;
|
|
565
|
-
const out = process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_OUT;
|
|
566
|
-
if (out === undefined || out.length === 0)
|
|
567
|
-
return;
|
|
568
|
-
try {
|
|
569
|
-
const beforeSignature = pluginDescriptorInputMetadataSignature(record.resolved);
|
|
570
|
-
const observedHash = pluginDescriptorInputHash(record.resolved);
|
|
571
|
-
const observedRealpath = pluginDescriptorInputRealpath(record.resolved);
|
|
572
|
-
const afterSignature = pluginDescriptorInputMetadataSignature(record.resolved);
|
|
573
|
-
const unstable = record.unstable === true ||
|
|
574
|
-
beforeSignature === undefined ||
|
|
575
|
-
afterSignature === undefined ||
|
|
576
|
-
beforeSignature !== afterSignature ||
|
|
577
|
-
(record.hash !== undefined && record.hash !== observedHash) ||
|
|
578
|
-
(record.realpath !== undefined && record.realpath !== observedRealpath) ||
|
|
579
|
-
(record.signature !== undefined && record.signature !== afterSignature);
|
|
580
|
-
node_fs_1.default.appendFileSync(out, `${JSON.stringify({
|
|
581
|
-
...record,
|
|
582
|
-
hash: observedHash,
|
|
583
|
-
realpath: observedRealpath,
|
|
584
|
-
...(unstable ? { unstable: true } : { signature: afterSignature }),
|
|
585
|
-
})}\n`, "utf8");
|
|
586
|
-
}
|
|
587
|
-
catch {
|
|
588
|
-
// Dependency reporting is advisory to cache reuse; the selected entry is
|
|
589
|
-
// still retained by the parent if this best-effort side channel fails.
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
function pluginDescriptorInputRealpath(file) {
|
|
593
|
-
try {
|
|
594
|
-
return node_fs_1.default.realpathSync.native(file);
|
|
595
|
-
}
|
|
596
|
-
catch {
|
|
597
|
-
return null;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
/** Metadata identity that exposes content-preserving A-B-A replacement. */
|
|
601
|
-
function pluginDescriptorInputMetadataSignature(file) {
|
|
602
|
-
const requested = node_path_1.default.resolve(file);
|
|
603
|
-
let current = requested;
|
|
604
|
-
for (;;) {
|
|
605
|
-
try {
|
|
606
|
-
const link = node_fs_1.default.lstatSync(current, { bigint: true });
|
|
607
|
-
let target = link;
|
|
608
|
-
if (link.isSymbolicLink()) {
|
|
609
|
-
try {
|
|
610
|
-
target = node_fs_1.default.statSync(current, { bigint: true });
|
|
611
|
-
}
|
|
612
|
-
catch {
|
|
613
|
-
// A broken link's own metadata cannot expose its target appearing
|
|
614
|
-
// and disappearing during evaluation. Decline cache proof instead.
|
|
615
|
-
return undefined;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return [
|
|
619
|
-
node_path_1.default.relative(current, requested),
|
|
620
|
-
link.dev,
|
|
621
|
-
link.ino,
|
|
622
|
-
link.mode,
|
|
623
|
-
link.size,
|
|
624
|
-
link.mtimeNs,
|
|
625
|
-
link.ctimeNs,
|
|
626
|
-
target.dev,
|
|
627
|
-
target.ino,
|
|
628
|
-
target.mode,
|
|
629
|
-
target.size,
|
|
630
|
-
target.mtimeNs,
|
|
631
|
-
target.ctimeNs,
|
|
632
|
-
].join(":");
|
|
633
|
-
}
|
|
634
|
-
catch (error) {
|
|
635
|
-
if (!isMissingPathError(error))
|
|
636
|
-
return undefined;
|
|
637
|
-
const parent = node_path_1.default.dirname(current);
|
|
638
|
-
if (parent === current)
|
|
639
|
-
return undefined;
|
|
640
|
-
current = parent;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
function pluginDescriptorInputHash(file) {
|
|
645
|
-
try {
|
|
646
|
-
if (node_fs_1.default.statSync(file).isDirectory()) {
|
|
647
|
-
return pluginDescriptorDirectoryHash();
|
|
648
|
-
}
|
|
649
|
-
return node_crypto_1.default
|
|
650
|
-
.createHash("sha256")
|
|
651
|
-
.update(node_fs_1.default.readFileSync(file))
|
|
652
|
-
.digest("hex");
|
|
653
|
-
}
|
|
654
|
-
catch {
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
/** Stable public fingerprint for an existing directory candidate's kind. */
|
|
659
|
-
function pluginDescriptorDirectoryHash() {
|
|
660
|
-
return node_crypto_1.default
|
|
661
|
-
.createHash("sha256")
|
|
662
|
-
.update("ttsc:host-input:directory\0")
|
|
663
|
-
.digest("hex");
|
|
664
|
-
}
|
|
665
|
-
function runtimeFilePath(value) {
|
|
666
|
-
if (value === undefined)
|
|
667
|
-
return undefined;
|
|
668
|
-
if (value.startsWith("file:")) {
|
|
669
|
-
try {
|
|
670
|
-
return node_path_1.default.resolve((0, node_url_1.fileURLToPath)(value));
|
|
671
|
-
}
|
|
672
|
-
catch {
|
|
673
|
-
return undefined;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
return node_path_1.default.isAbsolute(value) ? node_path_1.default.resolve(value) : undefined;
|
|
677
|
-
}
|
|
678
|
-
/** Remember an ESM root until its synchronous load hook prepares the project. */
|
|
679
|
-
function rememberRuntimeEntry(result, context) {
|
|
680
|
-
if (result.url.startsWith("file:") &&
|
|
681
|
-
isTypeScriptSource((0, node_url_1.fileURLToPath)(result.url)) &&
|
|
682
|
-
(context.parentURL === undefined ||
|
|
683
|
-
!context.parentURL.startsWith("file:") ||
|
|
684
|
-
!isTypeScriptSource((0, node_url_1.fileURLToPath)(context.parentURL)))) {
|
|
685
|
-
runtimeEntryUrls.add(result.url);
|
|
686
|
-
}
|
|
687
|
-
return result;
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Restore a `node:` builtin URL when affected Node releases return the exact
|
|
691
|
-
* prefix-stripped spelling from their synchronous CommonJS resolver.
|
|
692
|
-
*
|
|
693
|
-
* Every other result passes through unchanged. In particular, a user hook that
|
|
694
|
-
* intentionally remaps a `node:` specifier to another URL retains ownership of
|
|
695
|
-
* that mapping, while ordinary and ESM builtin results already carrying the
|
|
696
|
-
* scheme avoid an unnecessary copy.
|
|
697
|
-
*/
|
|
698
|
-
function restoreStrippedNodeBuiltinScheme(specifier, result) {
|
|
699
|
-
return (0, node_module_1.isBuiltin)(specifier) &&
|
|
700
|
-
specifier.startsWith("node:") &&
|
|
701
|
-
result.url === specifier.slice("node:".length)
|
|
702
|
-
? { ...result, url: specifier }
|
|
703
|
-
: result;
|
|
704
|
-
}
|
|
705
|
-
const builtProjects = new Map();
|
|
706
|
-
// A descriptor evaluator's dependency emit must never be reused by another
|
|
707
|
-
// process. PIDs are eventually recycled while the disk cache persists, so PID
|
|
708
|
-
// alone cannot provide that isolation. One cryptographically random process
|
|
709
|
-
// nonce keeps every evaluator generation distinct while `builtProjects` still
|
|
710
|
-
// shares repeated imports inside this process.
|
|
711
|
-
const descriptorProcessCacheNonce = node_crypto_1.default.randomBytes(16).toString("hex");
|
|
712
|
-
/** File URLs whose CommonJS source was reached from an ESM parent import. */
|
|
713
|
-
const commonJsNamedInteropUrls = new Set();
|
|
714
|
-
const commonJsNameScanSources = new Map();
|
|
715
|
-
function load(url, context, nextLoad) {
|
|
716
|
-
if (!url.startsWith("file:")) {
|
|
717
|
-
return nextLoad(url, context);
|
|
718
|
-
}
|
|
719
|
-
const filename = (0, node_url_1.fileURLToPath)(url);
|
|
720
|
-
if (!isTypeScriptSource(filename)) {
|
|
721
|
-
return nextLoad(url, context);
|
|
722
|
-
}
|
|
723
|
-
const { format, source } = resolveRuntimeSource(filename, url, runtimeEntryUrls.delete(url) || isProcessEntry(filename));
|
|
724
|
-
return {
|
|
725
|
-
format,
|
|
726
|
-
shortCircuit: true,
|
|
727
|
-
source,
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
function resolveRuntimeSource(filename, url = (0, node_url_1.pathToFileURL)(filename).href, prepareAsEntry = false) {
|
|
731
|
-
const served = resolveServedSource(filename, url, prepareAsEntry);
|
|
732
|
-
const format = moduleFormat(filename, served.moduleOptions);
|
|
733
|
-
return {
|
|
734
|
-
format,
|
|
735
|
-
source: format === "commonjs" && commonJsNamedInteropUrls.has(url)
|
|
736
|
-
? exposeCommonJsStarExports(served.source, served.emittedFile, served.sourceFile)
|
|
737
|
-
: served.source,
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
/** Whether `filename` is the TypeScript main module named on Node's argv. */
|
|
741
|
-
function isProcessEntry(filename) {
|
|
742
|
-
const entry = process.argv[1];
|
|
743
|
-
return (entry !== undefined &&
|
|
744
|
-
isTypeScriptSource(entry) &&
|
|
745
|
-
realPath(node_path_1.default.resolve(entry)) === realPath(filename));
|
|
746
|
-
}
|
|
747
|
-
function rememberCommonJsNamedInterop(result, context) {
|
|
748
|
-
if (shouldExposeCommonJsNamedExports(result.url, context.parentURL)) {
|
|
749
|
-
commonJsNamedInteropUrls.add(result.url);
|
|
750
|
-
}
|
|
751
|
-
return result;
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Whether a CommonJS-classified TypeScript source reached from an ESM parent
|
|
755
|
-
* needs its nested `export *` names exposed.
|
|
756
|
-
*
|
|
757
|
-
* Only the parent side is decided here. The child's own format is re-checked
|
|
758
|
-
* authoritatively in `resolveRuntimeSource` against the format its served
|
|
759
|
-
* source actually carries, so this predicate deliberately does not repeat that
|
|
760
|
-
* check: doing so would need the child's owning project, which is not known
|
|
761
|
-
* until the source is served, and an answer guessed from the nearest tsconfig
|
|
762
|
-
* silently under-exposes a file that tsconfig does not compile.
|
|
763
|
-
*/
|
|
764
|
-
function shouldExposeCommonJsNamedExports(url, parentURL) {
|
|
765
|
-
if (parentURL === undefined ||
|
|
766
|
-
!url.startsWith("file:") ||
|
|
767
|
-
!parentURL.startsWith("file:")) {
|
|
768
|
-
return false;
|
|
769
|
-
}
|
|
770
|
-
const parentFile = (0, node_url_1.fileURLToPath)(parentURL);
|
|
771
|
-
if (moduleFormat(parentFile, owningModuleOptions(parentFile)) !== "module") {
|
|
772
|
-
return false;
|
|
773
|
-
}
|
|
774
|
-
return isTypeScriptSource((0, node_url_1.fileURLToPath)(url));
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* The emit-deciding compiler options of the project that owns `filename`, or
|
|
778
|
-
* `null` when none does.
|
|
779
|
-
*
|
|
780
|
-
* The entry project owns a file only when it actually emitted it. Testing
|
|
781
|
-
* `isWithin(rootDir)` alone would claim every file under a wide `rootDir` —
|
|
782
|
-
* including the volume-root `rootDir` a config-loader project uses — and hand
|
|
783
|
-
* them the entry project's options even though the dependency or orphan lane is
|
|
784
|
-
* what serves them.
|
|
785
|
-
*/
|
|
786
|
-
function owningModuleOptions(filename) {
|
|
787
|
-
if (!isTypeScriptSource(filename)) {
|
|
788
|
-
return null;
|
|
789
|
-
}
|
|
790
|
-
const real = realPath(filename);
|
|
791
|
-
const owner = findEntryEmit(real)?.manifest;
|
|
792
|
-
if (owner !== undefined) {
|
|
793
|
-
return owner.moduleOptions ?? {};
|
|
794
|
-
}
|
|
795
|
-
const tsconfig = nearestTsconfig(real);
|
|
796
|
-
if (tsconfig === null) {
|
|
797
|
-
return null;
|
|
798
|
-
}
|
|
799
|
-
const cached = moduleOptionsCache.get(tsconfig);
|
|
800
|
-
if (cached !== undefined) {
|
|
801
|
-
return cached;
|
|
802
|
-
}
|
|
803
|
-
let options = {};
|
|
804
|
-
try {
|
|
805
|
-
const project = readPluginDescriptorProjectConfig(tsconfig);
|
|
806
|
-
options = projectModuleOptions(project.compilerOptions);
|
|
807
|
-
}
|
|
808
|
-
catch {
|
|
809
|
-
// The owning project cannot be read, so nothing is known about the format
|
|
810
|
-
// it would have emitted. That is the same state as having no project at
|
|
811
|
-
// all, and it is what the dependency lane will conclude too when its build
|
|
812
|
-
// fails and the file falls through to the isolated orphan emit.
|
|
813
|
-
moduleOptionsCache.set(tsconfig, null);
|
|
814
|
-
return null;
|
|
815
|
-
}
|
|
816
|
-
moduleOptionsCache.set(tsconfig, options);
|
|
817
|
-
return options;
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Read one owning config while its discovered chain stays unchanged.
|
|
821
|
-
*
|
|
822
|
-
* A preliminary read discovers `extends`; an accepted read is bracketed by
|
|
823
|
-
* equal fingerprints over that exact chain. If churn never settles, ttsx can
|
|
824
|
-
* still execute the last project but reports every observed config as unstable,
|
|
825
|
-
* preventing a later snapshot from certifying the torn result.
|
|
826
|
-
*/
|
|
827
|
-
function readPluginDescriptorProjectConfig(tsconfig) {
|
|
828
|
-
const read = () => (0, readProjectConfig_1.readProjectConfig)({ cwd: node_path_1.default.dirname(tsconfig), tsconfig });
|
|
829
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
830
|
-
return read();
|
|
831
|
-
const observed = new Set([node_path_1.default.resolve(tsconfig)]);
|
|
832
|
-
let project;
|
|
833
|
-
try {
|
|
834
|
-
project = read();
|
|
835
|
-
}
|
|
836
|
-
catch (error) {
|
|
837
|
-
recordPluginDescriptorProjectInputs(observed, true);
|
|
838
|
-
throw error;
|
|
839
|
-
}
|
|
840
|
-
let inputs = normalizedProjectConfigPaths(project, tsconfig);
|
|
841
|
-
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
842
|
-
for (const input of inputs)
|
|
843
|
-
observed.add(input);
|
|
844
|
-
const before = pluginDescriptorInputHashes(inputs);
|
|
845
|
-
const beforeRealpaths = pluginDescriptorInputRealpaths(inputs);
|
|
846
|
-
const beforeSignatures = pluginDescriptorInputMetadataSignatures(inputs);
|
|
847
|
-
let candidate;
|
|
848
|
-
try {
|
|
849
|
-
candidate = read();
|
|
850
|
-
}
|
|
851
|
-
catch (error) {
|
|
852
|
-
recordPluginDescriptorProjectInputs(observed, true);
|
|
853
|
-
throw error;
|
|
854
|
-
}
|
|
855
|
-
const candidateInputs = normalizedProjectConfigPaths(candidate, tsconfig);
|
|
856
|
-
for (const input of candidateInputs)
|
|
857
|
-
observed.add(input);
|
|
858
|
-
const after = pluginDescriptorInputHashes(candidateInputs);
|
|
859
|
-
const afterRealpaths = pluginDescriptorInputRealpaths(candidateInputs);
|
|
860
|
-
const afterSignatures = pluginDescriptorInputMetadataSignatures(candidateInputs);
|
|
861
|
-
if (equalPluginDescriptorInputLists(inputs, candidateInputs) &&
|
|
862
|
-
equalPluginDescriptorInputHashes(before, after) &&
|
|
863
|
-
equalPluginDescriptorInputHashes(beforeRealpaths, afterRealpaths) &&
|
|
864
|
-
beforeSignatures !== undefined &&
|
|
865
|
-
afterSignatures !== undefined &&
|
|
866
|
-
equalPluginDescriptorInputHashes(beforeSignatures, afterSignatures)) {
|
|
867
|
-
for (const input of candidateInputs) {
|
|
868
|
-
recordPluginDescriptorInput({
|
|
869
|
-
hash: after[input],
|
|
870
|
-
realpath: afterRealpaths[input],
|
|
871
|
-
resolved: input,
|
|
872
|
-
signature: afterSignatures[input],
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
return candidate;
|
|
876
|
-
}
|
|
877
|
-
project = candidate;
|
|
878
|
-
inputs = candidateInputs;
|
|
879
|
-
}
|
|
880
|
-
recordPluginDescriptorProjectInputs(observed, true);
|
|
881
|
-
return project;
|
|
882
|
-
}
|
|
883
|
-
function normalizedProjectConfigPaths(project, requestedConfig) {
|
|
884
|
-
return [
|
|
885
|
-
...new Set([requestedConfig, ...project.configPaths].map((file) => node_path_1.default.resolve(file))),
|
|
886
|
-
].sort();
|
|
887
|
-
}
|
|
888
|
-
function pluginDescriptorInputHashes(inputs) {
|
|
889
|
-
return Object.fromEntries(inputs.map((input) => [input, pluginDescriptorInputHash(input)]));
|
|
890
|
-
}
|
|
891
|
-
function pluginDescriptorInputRealpaths(inputs) {
|
|
892
|
-
return Object.fromEntries(inputs.map((input) => [input, pluginDescriptorInputRealpath(input)]));
|
|
893
|
-
}
|
|
894
|
-
function pluginDescriptorInputMetadataSignatures(inputs) {
|
|
895
|
-
const output = {};
|
|
896
|
-
for (const input of inputs) {
|
|
897
|
-
const signature = pluginDescriptorInputMetadataSignature(input);
|
|
898
|
-
if (signature === undefined)
|
|
899
|
-
return undefined;
|
|
900
|
-
output[node_path_1.default.resolve(input)] = signature;
|
|
901
|
-
}
|
|
902
|
-
return output;
|
|
903
|
-
}
|
|
904
|
-
function equalPluginDescriptorInputLists(first, second) {
|
|
905
|
-
return (first.length === second.length &&
|
|
906
|
-
first.every((input, index) => input === second[index]));
|
|
907
|
-
}
|
|
908
|
-
function equalPluginDescriptorInputHashes(first, second) {
|
|
909
|
-
return (Object.keys(first).length === Object.keys(second).length &&
|
|
910
|
-
Object.entries(first).every(([input, hash]) => second[input] === hash));
|
|
911
|
-
}
|
|
912
|
-
function recordPluginDescriptorProjectInputs(inputs, unstable) {
|
|
913
|
-
for (const input of inputs) {
|
|
914
|
-
const resolved = node_path_1.default.resolve(input);
|
|
915
|
-
recordPluginDescriptorInput({
|
|
916
|
-
resolved,
|
|
917
|
-
...(unstable ? { unstable: true } : {}),
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
/** Narrow a resolved project's compiler options to the emit-format pair. */
|
|
922
|
-
function projectModuleOptions(compilerOptions) {
|
|
923
|
-
return {
|
|
924
|
-
...(typeof compilerOptions.module === "string"
|
|
925
|
-
? { module: compilerOptions.module }
|
|
926
|
-
: {}),
|
|
927
|
-
...(typeof compilerOptions.target === "string"
|
|
928
|
-
? { target: compilerOptions.target }
|
|
929
|
-
: {}),
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Resolve the JavaScript to run for a TypeScript source file, in priority
|
|
934
|
-
* order: the entry project's pre-built emit (transform plugins applied), a
|
|
935
|
-
* built raw `.ts` dependency, or an isolated emit when no tsconfig owns it.
|
|
936
|
-
* Shared by the ESM `load` hook and the CommonJS `require` handler.
|
|
937
|
-
*/
|
|
938
|
-
function resolveServedSource(filename, url = (0, node_url_1.pathToFileURL)(filename).href, prepareAsEntry = false) {
|
|
939
|
-
const real = realPath(filename);
|
|
940
|
-
// Only the public preload can prepare a newly discovered root. Direct ttsx
|
|
941
|
-
// has one pre-built manifest and historically relies on trailing-stem
|
|
942
|
-
// recovery when Windows presents the same source through its short and long
|
|
943
|
-
// temp-path spellings (the lint TypeScript-config loader is one such case).
|
|
944
|
-
// Treating that boundary as prepare-only would discard the existing emit and
|
|
945
|
-
// feed ESM source into CommonJS interop, producing ERR_REQUIRE_CYCLE_MODULE.
|
|
946
|
-
const prepareEntry = prepareAsEntry ? prepareRuntimeEntry : undefined;
|
|
947
|
-
// A JavaScript-to-TypeScript boundary is a new checked root unless an
|
|
948
|
-
// existing manifest proves exact ownership. Trailing-stem recovery is not
|
|
949
|
-
// ownership evidence: two out-of-include `index.ts` roots can otherwise map
|
|
950
|
-
// to the first manifest's `index.js`, skipping the second root's diagnostics.
|
|
951
|
-
let served = serveEntryEmit(real, prepareEntry === undefined);
|
|
952
|
-
if (served !== null) {
|
|
953
|
-
return withInlineSourceMap(served);
|
|
954
|
-
}
|
|
955
|
-
if (prepareEntry !== undefined) {
|
|
956
|
-
registeredManifests.push(prepareEntry(real));
|
|
957
|
-
served = serveEntryEmit(real);
|
|
958
|
-
if (served === null) {
|
|
959
|
-
throw new Error(`ttsx: prepared entry emit not found for ${filename}`);
|
|
960
|
-
}
|
|
961
|
-
return withInlineSourceMap(served);
|
|
962
|
-
}
|
|
963
|
-
const built = serveDependencyEmit(real);
|
|
964
|
-
if (built !== null) {
|
|
965
|
-
return withInlineSourceMap(built);
|
|
966
|
-
}
|
|
967
|
-
return {
|
|
968
|
-
moduleOptions: null,
|
|
969
|
-
sourceFile: filename,
|
|
970
|
-
source: transformOrphanSource(filename, url),
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Inline a served emit's external source map into its text and absolutize the
|
|
975
|
-
* map's `sources`, so the JavaScript executed under the `.ts` source URL stays
|
|
976
|
-
* self-describing after the per-run emit directory is deleted. Applied to both
|
|
977
|
-
* the entry lane (`serveEntryEmit`) and the dependency lane
|
|
978
|
-
* (`serveBuiltDependency`); the orphan lane inlines its own map before
|
|
979
|
-
* caching.
|
|
980
|
-
*/
|
|
981
|
-
function withInlineSourceMap(served) {
|
|
982
|
-
const source = (0, servedSourceMap_1.inlineServedSourceMap)(served.source, served.emittedFile, served.sourceFile);
|
|
983
|
-
return source === served.source ? served : { ...served, source };
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Transform a TypeScript source file that no tsconfig owns (a published or
|
|
987
|
-
* vendored package that ships raw `.ts`/`.cts`/`.mts` straight under
|
|
988
|
-
* `node_modules`), choosing the lowering by the format the file resolves to.
|
|
989
|
-
*
|
|
990
|
-
* Both module formats need the compiler: Node's type stripping neither lowers
|
|
991
|
-
* standard decorators nor rewrites ESM exports for CommonJS. Use the existing
|
|
992
|
-
* single-file emit with the file's own module format and a standard target.
|
|
993
|
-
* Retain stripping as recovery when no compiler emit is available.
|
|
994
|
-
*/
|
|
995
|
-
function transformOrphanSource(filename, url) {
|
|
996
|
-
const format = moduleFormat(filename, null) === "commonjs" ? "commonjs" : "module";
|
|
997
|
-
const lowered = emitOrphanSource(filename, format);
|
|
998
|
-
if (lowered !== null) {
|
|
999
|
-
return lowered;
|
|
1000
|
-
}
|
|
1001
|
-
return (0, node_module_1.stripTypeScriptTypes)(node_fs_1.default.readFileSync(filename, "utf8"), {
|
|
1002
|
-
mode: "transform",
|
|
1003
|
-
sourceUrl: url,
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Lower a single source file to its runtime module format. Emit-only, no
|
|
1008
|
-
* diagnostic gate (the entry project's up-front check is the type gate),
|
|
1009
|
-
* matching `buildDependency`. Returns `null` when tsgo is unavailable or
|
|
1010
|
-
* produced no output, so the caller can fall back to the in-process strip.
|
|
1011
|
-
*/
|
|
1012
|
-
function emitOrphanSource(filename, format) {
|
|
1013
|
-
let tsgo;
|
|
1014
|
-
try {
|
|
1015
|
-
tsgo = (0, resolveTsgo_1.resolveTsgo)({ cwd: node_path_1.default.dirname(filename) }).binary;
|
|
1016
|
-
}
|
|
1017
|
-
catch {
|
|
1018
|
-
return null;
|
|
1019
|
-
}
|
|
1020
|
-
// Content-hash cache: an orphan's tsgo single-file emit is lowered
|
|
1021
|
-
// once and reused by every other process in the run, and across runs. Without
|
|
1022
|
-
// it a program that fans out into many processes (the automated test corpus
|
|
1023
|
-
// imports the same vendored `.ts` deps from thousands of generated files) would
|
|
1024
|
-
// re-spawn tsgo per file per process and crawl.
|
|
1025
|
-
const cacheFile = orphanCacheFile(filename, tsgo, format);
|
|
1026
|
-
if (cacheFile !== null) {
|
|
1027
|
-
const hit = readFileOrNull(cacheFile);
|
|
1028
|
-
if (hit !== null) {
|
|
1029
|
-
return hit;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
const outDir = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsx-orphan-");
|
|
1033
|
-
try {
|
|
1034
|
-
const res = (0, spawnNative_1.spawnNative)(tsgo, [
|
|
1035
|
-
filename,
|
|
1036
|
-
"--module",
|
|
1037
|
-
format === "commonjs" ? "commonjs" : "esnext",
|
|
1038
|
-
...ISOLATED_EMIT_ARGS,
|
|
1039
|
-
"--sourceMap",
|
|
1040
|
-
"--inlineSources",
|
|
1041
|
-
"--outDir",
|
|
1042
|
-
outDir,
|
|
1043
|
-
"--listEmittedFiles",
|
|
1044
|
-
], { cwd: node_path_1.default.dirname(filename), encoding: "utf8" });
|
|
1045
|
-
const emitted = pickEmittedJavaScript(filename, parseEmittedFiles((0, spawnNative_1.outputText)(res.stdout)));
|
|
1046
|
-
const source = emitted === null ? null : readFileOrNull(emitted);
|
|
1047
|
-
const lowered = source === null
|
|
1048
|
-
? null
|
|
1049
|
-
: (0, servedSourceMap_1.inlineServedSourceMap)(source, emitted, filename);
|
|
1050
|
-
if (lowered !== null && cacheFile !== null) {
|
|
1051
|
-
writeOrphanCache(cacheFile, lowered);
|
|
1052
|
-
}
|
|
1053
|
-
return lowered;
|
|
1054
|
-
}
|
|
1055
|
-
catch {
|
|
1056
|
-
return null;
|
|
1057
|
-
}
|
|
1058
|
-
finally {
|
|
1059
|
-
node_fs_1.default.rmSync(outDir, { force: true, recursive: true });
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Read actual owned output for CommonJS export-name discovery, falling back to
|
|
1064
|
-
* isolated emission only when no project emitted this source. Project
|
|
1065
|
-
* transforms and const-enum settings decide which names exist at runtime. An
|
|
1066
|
-
* ESM emit is lowered as JavaScript solely to scan its CommonJS names.
|
|
1067
|
-
*
|
|
1068
|
-
* This intentionally does not read or write the runtime orphan cache. Name
|
|
1069
|
-
* discovery may inspect a source dependency without executing it, so sharing
|
|
1070
|
-
* that output with the runtime fallback would let a speculative scan affect a
|
|
1071
|
-
* later load path.
|
|
1072
|
-
*/
|
|
1073
|
-
function emitCommonJsForNameScan(filename) {
|
|
1074
|
-
const real = realPath(filename);
|
|
1075
|
-
const cached = commonJsNameScanSources.get(real);
|
|
1076
|
-
if (cached !== undefined) {
|
|
1077
|
-
return cached;
|
|
1078
|
-
}
|
|
1079
|
-
const served = serveEntryEmit(real) ?? serveDependencyEmit(real);
|
|
1080
|
-
if (served !== null &&
|
|
1081
|
-
moduleFormat(real, served.moduleOptions) === "commonjs") {
|
|
1082
|
-
commonJsNameScanSources.set(real, served.source);
|
|
1083
|
-
return served.source;
|
|
1084
|
-
}
|
|
1085
|
-
let tsgo;
|
|
1086
|
-
try {
|
|
1087
|
-
tsgo = (0, resolveTsgo_1.resolveTsgo)({ cwd: node_path_1.default.dirname(real) }).binary;
|
|
1088
|
-
}
|
|
1089
|
-
catch {
|
|
1090
|
-
commonJsNameScanSources.set(real, null);
|
|
1091
|
-
return null;
|
|
1092
|
-
}
|
|
1093
|
-
const outDir = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsx-export-scan-");
|
|
1094
|
-
try {
|
|
1095
|
-
// Compile the owned JavaScript, not the original TypeScript whose project
|
|
1096
|
-
// may already have erased or transformed declarations. No source executes.
|
|
1097
|
-
const input = served === null ? real : node_path_1.default.join(outDir, "source.cts");
|
|
1098
|
-
if (served !== null)
|
|
1099
|
-
node_fs_1.default.writeFileSync(input, served.source);
|
|
1100
|
-
const res = (0, spawnNative_1.spawnNative)(tsgo, [
|
|
1101
|
-
input,
|
|
1102
|
-
"--module",
|
|
1103
|
-
"commonjs",
|
|
1104
|
-
...ISOLATED_EMIT_ARGS,
|
|
1105
|
-
"--outDir",
|
|
1106
|
-
outDir,
|
|
1107
|
-
"--listEmittedFiles",
|
|
1108
|
-
], { cwd: node_path_1.default.dirname(real), encoding: "utf8" });
|
|
1109
|
-
const emitted = pickEmittedJavaScript(input, parseEmittedFiles((0, spawnNative_1.outputText)(res.stdout)));
|
|
1110
|
-
const lowered = emitted === null ? null : readFileOrNull(emitted);
|
|
1111
|
-
commonJsNameScanSources.set(real, lowered);
|
|
1112
|
-
return lowered;
|
|
1113
|
-
}
|
|
1114
|
-
catch {
|
|
1115
|
-
commonJsNameScanSources.set(real, null);
|
|
1116
|
-
return null;
|
|
1117
|
-
}
|
|
1118
|
-
finally {
|
|
1119
|
-
node_fs_1.default.rmSync(outDir, { force: true, recursive: true });
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Cache root for lowered orphan sources, shared per run (and across runs when
|
|
1124
|
-
* `TTSC_CACHE_DIR` points at a persisted directory).
|
|
1125
|
-
*/
|
|
1126
|
-
function orphanCacheRoot() {
|
|
1127
|
-
const base = process.env.TTSC_CACHE_DIR && process.env.TTSC_CACHE_DIR.length !== 0
|
|
1128
|
-
? process.env.TTSC_CACHE_DIR
|
|
1129
|
-
: node_path_1.default.join(node_os_1.default.tmpdir(), "ttsc-orphan");
|
|
1130
|
-
return node_path_1.default.join(base, "ttsx-orphan");
|
|
1131
|
-
}
|
|
1132
|
-
/**
|
|
1133
|
-
* Content-addressed cache path for isolated orphan lowering, including the
|
|
1134
|
-
* source path because the inlined map identifies that path. `null` when the
|
|
1135
|
-
* source cannot be read.
|
|
1136
|
-
*/
|
|
1137
|
-
function orphanCacheFile(filename, tsgo, format) {
|
|
1138
|
-
let source;
|
|
1139
|
-
try {
|
|
1140
|
-
source = node_fs_1.default.readFileSync(filename);
|
|
1141
|
-
}
|
|
1142
|
-
catch {
|
|
1143
|
-
return null;
|
|
1144
|
-
}
|
|
1145
|
-
const key = node_crypto_1.default
|
|
1146
|
-
.createHash("sha256")
|
|
1147
|
-
.update(tsgo)
|
|
1148
|
-
.update("\0isolated-source-map-v1\0")
|
|
1149
|
-
.update(filename)
|
|
1150
|
-
.update("\0" + format)
|
|
1151
|
-
.update("\0")
|
|
1152
|
-
.update(source)
|
|
1153
|
-
.digest("hex")
|
|
1154
|
-
.slice(0, 32);
|
|
1155
|
-
return node_path_1.default.join(orphanCacheRoot(), `${key}.js`);
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Write the lowered source to its cache path atomically (temp + rename), so a
|
|
1159
|
-
* concurrent reader never sees a half-written file. Best-effort: a failure just
|
|
1160
|
-
* means the next process re-lowers.
|
|
1161
|
-
*/
|
|
1162
|
-
function writeOrphanCache(cacheFile, lowered) {
|
|
1163
|
-
try {
|
|
1164
|
-
node_fs_1.default.mkdirSync(node_path_1.default.dirname(cacheFile), { recursive: true });
|
|
1165
|
-
const tmp = `${cacheFile}.${process.pid}.${Date.now()}.tmp`;
|
|
1166
|
-
node_fs_1.default.writeFileSync(tmp, lowered);
|
|
1167
|
-
node_fs_1.default.renameSync(tmp, cacheFile);
|
|
1168
|
-
}
|
|
1169
|
-
catch {
|
|
1170
|
-
// ignore — caching is an optimization, correctness does not depend on it
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
/** `TSFILE:` paths tsgo printed under `--listEmittedFiles`. */
|
|
1174
|
-
function parseEmittedFiles(stdout) {
|
|
1175
|
-
const files = [];
|
|
1176
|
-
for (const line of stdout.split(/\r?\n/)) {
|
|
1177
|
-
const match = line.match(/^TSFILE:\s*(.+)$/);
|
|
1178
|
-
if (match?.[1]) {
|
|
1179
|
-
files.push(match[1].trim());
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
return files;
|
|
1183
|
-
}
|
|
1184
|
-
/** Pick the emitted JavaScript corresponding to the source file requested. */
|
|
1185
|
-
function pickEmittedJavaScript(filename, emittedFiles) {
|
|
1186
|
-
const stem = node_path_1.default
|
|
1187
|
-
.basename(filename)
|
|
1188
|
-
.replace(/\.[cm]?tsx?$/i, "")
|
|
1189
|
-
.toLowerCase();
|
|
1190
|
-
const candidates = emittedFiles.filter((file) => {
|
|
1191
|
-
const parsed = node_path_1.default.parse(file);
|
|
1192
|
-
return (parsed.name.toLowerCase() === stem && /\.(?:[cm]?js)$/i.test(parsed.base));
|
|
1193
|
-
});
|
|
1194
|
-
if (candidates.length === 1) {
|
|
1195
|
-
return candidates[0];
|
|
1196
|
-
}
|
|
1197
|
-
return emittedFiles.find((file) => /\.(?:[cm]?js)$/i.test(file)) ?? null;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* Make TypeScript-Go's CommonJS `export *` output visible to Node's
|
|
1201
|
-
* ESM-from-CJS named export scanner.
|
|
1202
|
-
*
|
|
1203
|
-
* Tsgo lowers star re-exports to `__exportStar(require("./x"), exports)`.
|
|
1204
|
-
* Runtime CommonJS consumers see the getters that helper installs, but Node's
|
|
1205
|
-
* ESM linker only exposes named imports it can statically identify from
|
|
1206
|
-
* `exports.name = ...` assignments. For relative star re-exports whose emitted
|
|
1207
|
-
* target is available, advertise its names through inert assignments that
|
|
1208
|
-
* Node's static lexer recognizes. The original helper still owns every runtime
|
|
1209
|
-
* binding, including values static discovery cannot enumerate.
|
|
1210
|
-
*/
|
|
1211
|
-
function exposeCommonJsStarExports(source, emittedFile, sourceFile) {
|
|
1212
|
-
const parsed = (0, commonJsExportMetadata_1.parseCommonJsExports)(source);
|
|
1213
|
-
const reserved = new Set(parsed.exports);
|
|
1214
|
-
const names = new Set();
|
|
1215
|
-
for (const specifier of parsed.reexports) {
|
|
1216
|
-
for (const name of collectStarExportNames(emittedFile, sourceFile, specifier)) {
|
|
1217
|
-
if (name !== "default" && name !== "__esModule" && !reserved.has(name)) {
|
|
1218
|
-
names.add(name);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
if (names.size === 0)
|
|
1223
|
-
return source;
|
|
1224
|
-
// Node's lexer reads these assignments statically. Nothing executes, and no
|
|
1225
|
-
// existing statement, source position, control-flow body or runtime export
|
|
1226
|
-
// is changed. Keep all specifier/literal parsing in the same lexer Node uses.
|
|
1227
|
-
const hints = [...names]
|
|
1228
|
-
.map((name) => `exports[${JSON.stringify(name)}] = void 0;`)
|
|
1229
|
-
.join(" ");
|
|
1230
|
-
return source + `\nif (false) { ${hints} }\n`;
|
|
1231
|
-
}
|
|
1232
|
-
function collectStarExportNames(emittedFile, sourceFile, specifier) {
|
|
1233
|
-
if (emittedFile !== undefined) {
|
|
1234
|
-
const emittedTarget = resolveEmittedRequire(emittedFile, specifier);
|
|
1235
|
-
if (emittedTarget !== null) {
|
|
1236
|
-
return collectCommonJsExportNames(emittedTarget, new Set());
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
if (sourceFile !== undefined) {
|
|
1240
|
-
const sourceTarget = resolveSourceSpecifier(sourceFile, specifier);
|
|
1241
|
-
if (sourceTarget !== null) {
|
|
1242
|
-
return collectSourceCommonJsExportNames(sourceTarget, new Set());
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
return new Set();
|
|
1246
|
-
}
|
|
1247
|
-
function collectCommonJsExportNames(emittedFile, seen) {
|
|
1248
|
-
const real = realPath(emittedFile);
|
|
1249
|
-
if (seen.has(real)) {
|
|
1250
|
-
return new Set();
|
|
1251
|
-
}
|
|
1252
|
-
seen.add(real);
|
|
1253
|
-
const source = readFileOrNull(real);
|
|
1254
|
-
if (source === null) {
|
|
1255
|
-
return new Set();
|
|
1256
|
-
}
|
|
1257
|
-
const parsed = (0, commonJsExportMetadata_1.parseCommonJsExports)(source);
|
|
1258
|
-
const names = new Set(parsed.exports);
|
|
1259
|
-
for (const specifier of parsed.reexports) {
|
|
1260
|
-
const target = resolveEmittedRequire(real, specifier);
|
|
1261
|
-
if (target === null) {
|
|
1262
|
-
continue;
|
|
1263
|
-
}
|
|
1264
|
-
for (const name of collectCommonJsExportNames(target, seen)) {
|
|
1265
|
-
if (name !== "default" && name !== "__esModule" && !names.has(name)) {
|
|
1266
|
-
names.add(name);
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
return names;
|
|
1271
|
-
}
|
|
1272
|
-
function collectSourceCommonJsExportNames(sourceFile, seen) {
|
|
1273
|
-
const real = realPath(sourceFile);
|
|
1274
|
-
if (seen.has(real)) {
|
|
1275
|
-
return new Set();
|
|
1276
|
-
}
|
|
1277
|
-
seen.add(real);
|
|
1278
|
-
const source = emitCommonJsForNameScan(real);
|
|
1279
|
-
if (source === null) {
|
|
1280
|
-
return new Set();
|
|
1281
|
-
}
|
|
1282
|
-
const parsed = (0, commonJsExportMetadata_1.parseCommonJsExports)(source);
|
|
1283
|
-
const names = new Set(parsed.exports);
|
|
1284
|
-
for (const specifier of parsed.reexports) {
|
|
1285
|
-
const target = resolveSourceSpecifier(real, specifier);
|
|
1286
|
-
if (target === null) {
|
|
1287
|
-
continue;
|
|
1288
|
-
}
|
|
1289
|
-
for (const name of collectSourceCommonJsExportNames(target, seen)) {
|
|
1290
|
-
if (name !== "default" && name !== "__esModule" && !names.has(name)) {
|
|
1291
|
-
names.add(name);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
return names;
|
|
1296
|
-
}
|
|
1297
|
-
function resolveEmittedRequire(emittedFile, specifier) {
|
|
1298
|
-
if (!isRelativeSpecifier(specifier)) {
|
|
1299
|
-
return null;
|
|
1300
|
-
}
|
|
1301
|
-
const base = node_path_1.default.resolve(node_path_1.default.dirname(emittedFile), specifier);
|
|
1302
|
-
if (node_path_1.default.extname(base).length !== 0) {
|
|
1303
|
-
return isFile(base) ? base : null;
|
|
1304
|
-
}
|
|
1305
|
-
for (const extension of [".js", ".cjs", ".mjs"]) {
|
|
1306
|
-
const candidate = base + extension;
|
|
1307
|
-
if (isFile(candidate)) {
|
|
1308
|
-
return candidate;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
for (const extension of [".js", ".cjs", ".mjs"]) {
|
|
1312
|
-
const candidate = node_path_1.default.join(base, `index${extension}`);
|
|
1313
|
-
if (isFile(candidate)) {
|
|
1314
|
-
return candidate;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
return null;
|
|
1318
|
-
}
|
|
1319
|
-
function resolveSourceSpecifier(sourceFile, specifier) {
|
|
1320
|
-
if (!isRelativeSpecifier(specifier)) {
|
|
1321
|
-
return null;
|
|
1322
|
-
}
|
|
1323
|
-
const base = node_path_1.default.resolve(node_path_1.default.dirname(sourceFile), specifier);
|
|
1324
|
-
if (node_path_1.default.extname(base).length !== 0) {
|
|
1325
|
-
if (isFile(base))
|
|
1326
|
-
return base;
|
|
1327
|
-
return typescriptSourcesForJavaScriptSpecifier(base).find(isFile) ?? null;
|
|
1328
|
-
}
|
|
1329
|
-
for (const extension of TYPESCRIPT_EXTENSIONS) {
|
|
1330
|
-
const candidate = base + extension;
|
|
1331
|
-
if (isFile(candidate)) {
|
|
1332
|
-
return candidate;
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
for (const extension of TYPESCRIPT_EXTENSIONS) {
|
|
1336
|
-
const candidate = node_path_1.default.join(base, `index${extension}`);
|
|
1337
|
-
if (isFile(candidate)) {
|
|
1338
|
-
return candidate;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
return null;
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Serve the entry project's pre-built JavaScript for a source file the build
|
|
1345
|
-
* emitted, or `null` when the file is outside the build or its emit is
|
|
1346
|
-
* missing.
|
|
1347
|
-
*
|
|
1348
|
-
* The bound is the project's `rootDir` (the source root the emit mirrors), not
|
|
1349
|
-
* its tsconfig directory: a project can pull in a file from elsewhere via
|
|
1350
|
-
* `files` with a wider `rootDir` (e.g. the lint config loader compiles a
|
|
1351
|
-
* `*.config.ts` from any directory under `rootDir: "/"`). Anything outside
|
|
1352
|
-
* `rootDir` cannot have a mirrored emit, so it falls through to the dependency
|
|
1353
|
-
* paths.
|
|
1354
|
-
*/
|
|
1355
|
-
function serveEntryEmit(real, allowStemFallback = true) {
|
|
1356
|
-
const owner = findEntryEmit(real, allowStemFallback);
|
|
1357
|
-
if (owner === null) {
|
|
1358
|
-
return null;
|
|
1359
|
-
}
|
|
1360
|
-
const source = readFileOrNull(owner.emittedFile);
|
|
1361
|
-
return source === null
|
|
1362
|
-
? null
|
|
1363
|
-
: {
|
|
1364
|
-
emittedFile: owner.emittedFile,
|
|
1365
|
-
moduleOptions: owner.manifest.moduleOptions ?? {},
|
|
1366
|
-
source,
|
|
1367
|
-
sourceFile: real,
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
/**
|
|
1371
|
-
* Find the manifest that owns `real`. Explicit prepared roots win, followed by
|
|
1372
|
-
* exact mirrored paths across every manifest. Only then may legacy stem
|
|
1373
|
-
* recovery run, so one manifest's approximate match cannot shadow another's
|
|
1374
|
-
* exact emit.
|
|
1375
|
-
*/
|
|
1376
|
-
function findEntryEmit(real, allowStemFallback = true) {
|
|
1377
|
-
const manifests = runtimeManifests();
|
|
1378
|
-
for (const candidate of manifests) {
|
|
1379
|
-
if (candidate.entrySource !== undefined &&
|
|
1380
|
-
candidate.entryFile !== undefined &&
|
|
1381
|
-
realPath(candidate.entrySource) === real &&
|
|
1382
|
-
node_fs_1.default.existsSync(candidate.entryFile)) {
|
|
1383
|
-
return { emittedFile: candidate.entryFile, manifest: candidate };
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
for (const candidate of manifests) {
|
|
1387
|
-
const emitted = entryEmitPath(candidate, real, false);
|
|
1388
|
-
if (emitted !== null) {
|
|
1389
|
-
return { emittedFile: emitted, manifest: candidate };
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
if (!allowStemFallback) {
|
|
1393
|
-
return null;
|
|
1394
|
-
}
|
|
1395
|
-
for (const candidate of manifests) {
|
|
1396
|
-
const emitted = entryEmitPath(candidate, real, true);
|
|
1397
|
-
if (emitted !== null) {
|
|
1398
|
-
return { emittedFile: emitted, manifest: candidate };
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
return null;
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* The entry project's emitted JavaScript for `real`, or `null` when that
|
|
1405
|
-
* project did not emit it. Shared with `owningModuleOptions` so "the entry
|
|
1406
|
-
* project owns this file" means exactly one thing in both places.
|
|
1407
|
-
*/
|
|
1408
|
-
function entryEmitPath(m, real, allowStemFallback = true) {
|
|
1409
|
-
const cache = allowStemFallback
|
|
1410
|
-
? entryEmitPathCache
|
|
1411
|
-
: exactEntryEmitPathCache;
|
|
1412
|
-
let manifestCache = cache.get(m);
|
|
1413
|
-
if (manifestCache === undefined) {
|
|
1414
|
-
manifestCache = new Map();
|
|
1415
|
-
cache.set(m, manifestCache);
|
|
1416
|
-
}
|
|
1417
|
-
if (manifestCache.has(real)) {
|
|
1418
|
-
return manifestCache.get(real) ?? null;
|
|
1419
|
-
}
|
|
1420
|
-
const resolved = isWithin(real, m.rootDir)
|
|
1421
|
-
? (0, resolveEmittedJavaScript_1.resolveEmittedJavaScript)({
|
|
1422
|
-
allowStemFallback,
|
|
1423
|
-
emittedFiles: m.emittedFiles,
|
|
1424
|
-
outDir: m.emitDir,
|
|
1425
|
-
projectRoot: m.rootDir,
|
|
1426
|
-
sourceFile: real,
|
|
1427
|
-
})
|
|
1428
|
-
: null;
|
|
1429
|
-
manifestCache.set(real, resolved);
|
|
1430
|
-
return resolved;
|
|
1431
|
-
}
|
|
1432
|
-
/**
|
|
1433
|
-
* Memo for `entryEmitPath`, because it is now on the `resolve` hook's path
|
|
1434
|
-
* through `owningModuleOptions` — once per import specifier — and a miss inside
|
|
1435
|
-
* `resolveEmittedJavaScript` walks the whole emit tree. The entry emit is
|
|
1436
|
-
* written once before the run starts and never changes under it. Registration
|
|
1437
|
-
* can add several independent entry emits, so the manifest is part of the cache
|
|
1438
|
-
* identity as well as the source path.
|
|
1439
|
-
*/
|
|
1440
|
-
const entryEmitPathCache = new WeakMap();
|
|
1441
|
-
const exactEntryEmitPathCache = new WeakMap();
|
|
1442
|
-
/**
|
|
1443
|
-
* True when `real` is `directory` itself or sits beneath it. Handles a root
|
|
1444
|
-
* `directory` (`/`, `C:\`): naively appending a separator would yield `//`,
|
|
1445
|
-
* which no path starts with, so a root `rootDir` project would serve nothing.
|
|
1446
|
-
* Both sides are normalized to native separators first: a manifest `rootDir`
|
|
1447
|
-
* arrives slash-normalized from the synthesized tsconfig (`C:/` on Windows)
|
|
1448
|
-
* while `real` paths are native, and a raw prefix comparison across the two
|
|
1449
|
-
* forms silently never matches. Filesystem identity preserves ordinary Windows
|
|
1450
|
-
* aliases while keeping case-distinct paths under an opted-in directory
|
|
1451
|
-
* separate. Exported for direct exercise by the ttsx e2e suite — spawned runs
|
|
1452
|
-
* cannot pin both Windows case-semantics branches on CI.
|
|
1453
|
-
*/
|
|
1454
|
-
function isWithin(real, directory, identities = (0, projectInputPathIdentity_1.createFilesystemPathIdentityContext)({ throwOnRealpathError: false })) {
|
|
1455
|
-
return identities.isWithin(directory, real);
|
|
1456
|
-
}
|
|
1457
|
-
/**
|
|
1458
|
-
* Build the project that owns `real` (nearest `tsconfig.json` above its real
|
|
1459
|
-
* path) and return its emitted JavaScript, or `null` when no tsconfig owns it
|
|
1460
|
-
* or the project does not emit it. The build honours the dependency's own
|
|
1461
|
-
* tsconfig (transform plugins included), so a source-shipping package that
|
|
1462
|
-
* needs a transform behaves correctly at runtime.
|
|
1463
|
-
*/
|
|
1464
|
-
function serveDependencyEmit(real) {
|
|
1465
|
-
const tsconfig = nearestTsconfig(real);
|
|
1466
|
-
if (tsconfig === null) {
|
|
1467
|
-
return null;
|
|
1468
|
-
}
|
|
1469
|
-
let built;
|
|
1470
|
-
try {
|
|
1471
|
-
built = ensureProjectBuilt(tsconfig);
|
|
1472
|
-
}
|
|
1473
|
-
catch {
|
|
1474
|
-
// The owning project produced no emit at all; fall back to isolated emit of
|
|
1475
|
-
// this single file rather than failing the whole run.
|
|
1476
|
-
return null;
|
|
1477
|
-
}
|
|
1478
|
-
const served = serveBuiltDependency(built, real);
|
|
1479
|
-
if (served !== null) {
|
|
1480
|
-
return served;
|
|
1481
|
-
}
|
|
1482
|
-
return null;
|
|
1483
|
-
}
|
|
1484
|
-
function serveBuiltDependency(built, real) {
|
|
1485
|
-
const emitted = (0, resolveEmittedJavaScript_1.resolveEmittedJavaScript)({
|
|
1486
|
-
emittedFiles: built.emittedFiles,
|
|
1487
|
-
outDir: built.emitDir,
|
|
1488
|
-
projectRoot: built.rootDir,
|
|
1489
|
-
sourceFile: real,
|
|
1490
|
-
});
|
|
1491
|
-
if (emitted === null) {
|
|
1492
|
-
return null;
|
|
1493
|
-
}
|
|
1494
|
-
const source = readFileOrNull(emitted);
|
|
1495
|
-
return source === null
|
|
1496
|
-
? null
|
|
1497
|
-
: {
|
|
1498
|
-
emittedFile: emitted,
|
|
1499
|
-
moduleOptions: built.moduleOptions,
|
|
1500
|
-
source,
|
|
1501
|
-
sourceFile: real,
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1504
|
-
/**
|
|
1505
|
-
* Build the project that owns a dependency once per run and share the result
|
|
1506
|
-
* across every process the program spawns.
|
|
1507
|
-
*
|
|
1508
|
-
* A program (a benchmark, a worker pool) can fan out into many child processes,
|
|
1509
|
-
* each of which inherits the runtime manifest and would otherwise rebuild every
|
|
1510
|
-
* dependency from scratch — and worse, several at once into the same directory,
|
|
1511
|
-
* corrupting each other. So the build output is content-keyed under the shared
|
|
1512
|
-
* per-run cache: a finished build leaves a meta marker that any later process
|
|
1513
|
-
* (or a second import in this one) reuses, and concurrent first-builders are
|
|
1514
|
-
* serialised by an atomic lock directory.
|
|
1515
|
-
*/
|
|
1516
|
-
function ensureProjectBuilt(tsconfig) {
|
|
1517
|
-
const cached = builtProjects.get(tsconfig);
|
|
1518
|
-
if (cached !== undefined) {
|
|
1519
|
-
return cached;
|
|
1520
|
-
}
|
|
1521
|
-
const { cacheDir, lockDir, metaPath, root } = dependencyCachePaths(tsconfig);
|
|
1522
|
-
const reuse = readDependencyCache(cacheDir, metaPath);
|
|
1523
|
-
if (reuse !== null) {
|
|
1524
|
-
builtProjects.set(tsconfig, reuse);
|
|
1525
|
-
return reuse;
|
|
1526
|
-
}
|
|
1527
|
-
node_fs_1.default.mkdirSync(root, { recursive: true });
|
|
1528
|
-
const built = withBuildLock(cacheDir, metaPath, lockDir, () => buildDependency(tsconfig, cacheDir, metaPath));
|
|
1529
|
-
builtProjects.set(tsconfig, built);
|
|
1530
|
-
return built;
|
|
1531
|
-
}
|
|
1532
|
-
function dependencyCachePaths(tsconfig) {
|
|
1533
|
-
const key = dependencyCacheKey(tsconfig);
|
|
1534
|
-
const root = dependencyCacheRoot();
|
|
1535
|
-
return {
|
|
1536
|
-
cacheDir: node_path_1.default.join(root, key),
|
|
1537
|
-
lockDir: node_path_1.default.join(root, `${key}.lock`),
|
|
1538
|
-
metaPath: node_path_1.default.join(root, `${key}.json`),
|
|
1539
|
-
root,
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
/** Derive one dependency cache key; exported for isolation regressions. */
|
|
1543
|
-
function dependencyCacheKey(tsconfig, options = {}) {
|
|
1544
|
-
const descriptorLoad = options.descriptorLoad ?? process.env.TTSC_PLUGIN_DESCRIPTOR_LOAD === "1";
|
|
1545
|
-
return (node_crypto_1.default
|
|
1546
|
-
.createHash("sha256")
|
|
1547
|
-
.update(tsconfig)
|
|
1548
|
-
.update("\0runtime-es2025")
|
|
1549
|
-
// Descriptor evaluation promises a result bound to this process's exact
|
|
1550
|
-
// input observations. Reusing an emit another evaluator built can pair
|
|
1551
|
-
// that process's old source/config bytes with this process's later hashes.
|
|
1552
|
-
// Keep ordinary ttsx worker sharing, but isolate descriptor builds with a
|
|
1553
|
-
// non-reusable process nonce; the in-process `builtProjects` map still
|
|
1554
|
-
// compiles each owning project once.
|
|
1555
|
-
.update(descriptorLoad
|
|
1556
|
-
? `\0descriptor-process:${options.descriptorNonce ?? descriptorProcessCacheNonce}`
|
|
1557
|
-
: "")
|
|
1558
|
-
.digest("hex")
|
|
1559
|
-
.slice(0, 16));
|
|
1560
|
-
}
|
|
1561
|
-
/** The immutable emit directory of one build generation under `cacheDir`. */
|
|
1562
|
-
function dependencyGenerationDir(cacheDir, generation) {
|
|
1563
|
-
return node_path_1.default.join(cacheDir, `gen-${generation}`);
|
|
1564
|
-
}
|
|
1565
|
-
/** A fresh 128-bit build-generation identifier. */
|
|
1566
|
-
function newDependencyGeneration() {
|
|
1567
|
-
return node_crypto_1.default.randomBytes(16).toString("hex");
|
|
1568
|
-
}
|
|
1569
|
-
/** True for a well-formed 128-bit hex build generation. */
|
|
1570
|
-
function isDependencyGeneration(value) {
|
|
1571
|
-
return typeof value === "string" && /^[0-9a-f]{32}$/.test(value);
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Reuse a dependency another process (or an earlier import) already built.
|
|
1575
|
-
*
|
|
1576
|
-
* The completion marker names the exact emit generation, so this reads metadata
|
|
1577
|
-
* and emit as one unit: it returns a hit only when the marker parses to a valid
|
|
1578
|
-
* generation AND that generation's directory holds emitted JavaScript. A reader
|
|
1579
|
-
* that runs while a replacement build is populating a DIFFERENT generation
|
|
1580
|
-
* directory keeps returning the previous complete generation until the atomic
|
|
1581
|
-
* marker swap points at the new one — never a mix of old metadata and a partial
|
|
1582
|
-
* new emit.
|
|
1583
|
-
*
|
|
1584
|
-
* Exported for the ttsx dependency-cache regressions.
|
|
1585
|
-
*/
|
|
1586
|
-
function readDependencyCache(cacheDir, metaPath) {
|
|
1587
|
-
let meta;
|
|
1588
|
-
try {
|
|
1589
|
-
meta = JSON.parse(node_fs_1.default.readFileSync(metaPath, "utf8"));
|
|
1590
|
-
}
|
|
1591
|
-
catch {
|
|
1592
|
-
return null;
|
|
1593
|
-
}
|
|
1594
|
-
if (!isDependencyGeneration(meta.generation) ||
|
|
1595
|
-
typeof meta.rootDir !== "string" ||
|
|
1596
|
-
// A marker with no `moduleOptions` object predates this field and cannot
|
|
1597
|
-
// say which format its emit carries. Treating the absence as "no options"
|
|
1598
|
-
// would classify a CommonJS emit as an ES module, so the generation is
|
|
1599
|
-
// rejected and rebuilt instead. Every marker this version writes carries
|
|
1600
|
-
// the object, empty or not.
|
|
1601
|
-
typeof meta.moduleOptions !== "object" ||
|
|
1602
|
-
meta.moduleOptions === null ||
|
|
1603
|
-
Array.isArray(meta.moduleOptions)) {
|
|
1604
|
-
return null;
|
|
1605
|
-
}
|
|
1606
|
-
const emitDir = dependencyGenerationDir(cacheDir, meta.generation);
|
|
1607
|
-
if (!emittedAnything(emitDir)) {
|
|
1608
|
-
return null;
|
|
1609
|
-
}
|
|
1610
|
-
return {
|
|
1611
|
-
emitDir,
|
|
1612
|
-
emittedFiles: undefined,
|
|
1613
|
-
moduleOptions: projectModuleOptions(meta.moduleOptions),
|
|
1614
|
-
// Resolved on the way out, not trusted as written. `rootDir` never gated
|
|
1615
|
-
// reuse — the marker's generation, module options, and a non-empty emit do
|
|
1616
|
-
// — so a marker carrying an unresolved spelling was already being reused,
|
|
1617
|
-
// and then served every file of that dependency through the whole-tree stem
|
|
1618
|
-
// rescan. The pass is idempotent and runs only on a hit, which
|
|
1619
|
-
// `ensureProjectBuilt` memoizes per tsconfig. A marker from an earlier ttsc
|
|
1620
|
-
// survives only under the shared `os.tmpdir()/ttsx-dep` fallback root; the
|
|
1621
|
-
// manifest's own `depCacheDir` is per-process and removed with the run.
|
|
1622
|
-
rootDir: resolvePhysicalPath(meta.rootDir),
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
/**
|
|
1626
|
-
* Run `build` while holding the fenced lock for this dependency, re-checking
|
|
1627
|
-
* the cache once the lock is held (a concurrent builder may have just
|
|
1628
|
-
* finished). A loser polls for the winner's completion marker and, only when
|
|
1629
|
-
* the holding generation is provably abandoned (dead owner or the steal budget
|
|
1630
|
-
* elapsed), retires precisely that generation before retrying — never a
|
|
1631
|
-
* successor's.
|
|
1632
|
-
*/
|
|
1633
|
-
function withBuildLock(cacheDir, metaPath, lockDir, build) {
|
|
1634
|
-
for (;;) {
|
|
1635
|
-
const reuse = readDependencyCache(cacheDir, metaPath);
|
|
1636
|
-
if (reuse !== null) {
|
|
1637
|
-
return reuse;
|
|
1638
|
-
}
|
|
1639
|
-
let lease;
|
|
1640
|
-
try {
|
|
1641
|
-
lease = acquireDependencyBuildLock(lockDir);
|
|
1642
|
-
}
|
|
1643
|
-
catch {
|
|
1644
|
-
// An unusable coordination directory must not silently skip the build.
|
|
1645
|
-
// Generation-stamped emit and the atomic marker swap still keep every
|
|
1646
|
-
// reader's view of publication consistent without the lock.
|
|
1647
|
-
return build();
|
|
1648
|
-
}
|
|
1649
|
-
if (lease === null) {
|
|
1650
|
-
const waited = waitForDependencyBuild(cacheDir, metaPath, lockDir, DEP_BUILD_LOCK_STEAL_MS);
|
|
1651
|
-
if (waited.outcome === "built") {
|
|
1652
|
-
return waited.built;
|
|
1653
|
-
}
|
|
1654
|
-
if (waited.outcome === "abandoned") {
|
|
1655
|
-
// Retire only the generation this observation named. Losing the rename
|
|
1656
|
-
// race means the holder's own release (or another waiter) already made
|
|
1657
|
-
// progress, so a stale result never removes a live successor.
|
|
1658
|
-
reclaimDependencyBuildLock(lockDir, waited.fence);
|
|
1659
|
-
}
|
|
1660
|
-
// "released" needs no repair: the holder freed the lock normally, so
|
|
1661
|
-
// retry the ordinary acquisition.
|
|
1662
|
-
continue;
|
|
1663
|
-
}
|
|
1664
|
-
try {
|
|
1665
|
-
const reuseUnderLock = readDependencyCache(cacheDir, metaPath);
|
|
1666
|
-
return reuseUnderLock ?? build();
|
|
1667
|
-
}
|
|
1668
|
-
finally {
|
|
1669
|
-
releaseDependencyBuildLock(lockDir, lease);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
/** Block the current (synchronous) thread for `ms` without busy-spinning. */
|
|
1674
|
-
function sleepSync(ms) {
|
|
1675
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
1676
|
-
}
|
|
1677
|
-
/**
|
|
1678
|
-
* Compile a dependency project into a fresh generation directory and publish
|
|
1679
|
-
* its completion marker atomically.
|
|
1680
|
-
*
|
|
1681
|
-
* The emit lands in `<cacheDir>/gen-<generation>`, a directory no other
|
|
1682
|
-
* generation or process shares, so it is never mutated in place while a reader
|
|
1683
|
-
* looks at it. Only after the emit is proven non-empty is the marker written by
|
|
1684
|
-
* temp-and-rename, binding metadata to that exact generation. A build that
|
|
1685
|
-
* produced no output drops its partial directory so a failed generation can
|
|
1686
|
-
* never be reused.
|
|
1687
|
-
*/
|
|
1688
|
-
function buildDependency(tsconfig, cacheDir, metaPath) {
|
|
1689
|
-
const project = readPluginDescriptorProjectConfig(tsconfig);
|
|
1690
|
-
const generation = newDependencyGeneration();
|
|
1691
|
-
const emitDir = dependencyGenerationDir(cacheDir, generation);
|
|
1692
|
-
node_fs_1.default.rmSync(emitDir, { force: true, recursive: true });
|
|
1693
|
-
node_fs_1.default.mkdirSync(emitDir, { recursive: true });
|
|
1694
|
-
const result = (0, runBuild_1.runBuild)({
|
|
1695
|
-
cwd: project.root,
|
|
1696
|
-
passthrough: (0, runtimeCompilerArgs_1.runtimeCompilerArgs)(project),
|
|
1697
|
-
emit: true,
|
|
1698
|
-
forceListEmittedFiles: true,
|
|
1699
|
-
outDir: emitDir,
|
|
1700
|
-
// The generation directory is an `outDir` this lane injected, not one the
|
|
1701
|
-
// dependency declared, and tsgo demands an explicit `rootDir` (TS5011) as
|
|
1702
|
-
// soon as any `outDir` is in play. Pinning the root tsgo would infer keeps
|
|
1703
|
-
// a source-shipping dependency that declares no output buildable, and it is
|
|
1704
|
-
// the same root `resolveDependencySourceRoot` publishes for it below —
|
|
1705
|
-
// without it that dependency falls back to type-stripping (issue #1172).
|
|
1706
|
-
pinInferredRootDir: true,
|
|
1707
|
-
// Emit a source map on the transient dependency emit (it never reaches the
|
|
1708
|
-
// dependency's published `lib/`) so the serve path can inline it under the
|
|
1709
|
-
// source URL, but only when the dependency configures none itself. Routed
|
|
1710
|
-
// as a dedicated build option, not a forwarded tsgo flag, so it never
|
|
1711
|
-
// reaches a native plugin host's argument parser (issue #353).
|
|
1712
|
-
forceRuntimeSourceMap: project.compilerOptions.sourceMap !== true &&
|
|
1713
|
-
project.compilerOptions.inlineSourceMap !== true,
|
|
1714
|
-
// Honour the dependency's own transform plugins: a source-shipping package
|
|
1715
|
-
// can itself depend on a transform (e.g. a fixture whose values are built
|
|
1716
|
-
// with `typia.createRandom`), and its runtime behaviour is wrong without it.
|
|
1717
|
-
// `runBuild` runs on this main thread, so its plugin resolution works the
|
|
1718
|
-
// same as the entry build's. The exception is loading a plugin descriptor
|
|
1719
|
-
// (`TTSC_PLUGIN_DESCRIPTOR_LOAD`): there the descriptor's own — possibly
|
|
1720
|
-
// self-hosting — transform must NOT run, or it re-enters plugin loading and
|
|
1721
|
-
// deadlocks, so every dependency in that graph builds with plugins off.
|
|
1722
|
-
plugins: process.env.TTSC_PLUGIN_DESCRIPTOR_LOAD === "1" ? false : undefined,
|
|
1723
|
-
quiet: true,
|
|
1724
|
-
resolvedProject: project,
|
|
1725
|
-
// Emit only: the entry project's up-front check is the type gate. A
|
|
1726
|
-
// dependency build pulls its own transitive sources into the program and
|
|
1727
|
-
// would otherwise fail on type diagnostics that belong to those packages
|
|
1728
|
-
// under their own (laxer) config — e.g. unused-type-parameter warnings in a
|
|
1729
|
-
// transitively imported library. We still want the type-aware emit (for
|
|
1730
|
-
// type-only elision), just not the error gate.
|
|
1731
|
-
skipDiagnosticsCheck: true,
|
|
1732
|
-
tsconfig,
|
|
1733
|
-
});
|
|
1734
|
-
// Success is "the project wrote JavaScript", not "the build reported a file
|
|
1735
|
-
// list": a native transform host (typia, @ttsc/banner, …) emits without
|
|
1736
|
-
// printing the `--listEmittedFiles` lines, so `result.emittedFiles` is empty
|
|
1737
|
-
// even on a clean build. A genuinely empty output directory is the real
|
|
1738
|
-
// failure; the caller then falls back to isolated emit of the one file.
|
|
1739
|
-
if (!emittedAnything(emitDir)) {
|
|
1740
|
-
// Drop the failed generation so its partial directory can never be mistaken
|
|
1741
|
-
// for a reusable build.
|
|
1742
|
-
node_fs_1.default.rmSync(emitDir, { force: true, recursive: true });
|
|
1743
|
-
throw new Error([
|
|
1744
|
-
`ttsx: dependency build produced no output for ${tsconfig}`,
|
|
1745
|
-
result.stderr || result.stdout,
|
|
1746
|
-
]
|
|
1747
|
-
.filter((line) => line.trim().length !== 0)
|
|
1748
|
-
.join("\n"));
|
|
1749
|
-
}
|
|
1750
|
-
const rootDir = resolveDependencySourceRoot(project);
|
|
1751
|
-
const moduleOptions = projectModuleOptions(project.compilerOptions);
|
|
1752
|
-
publishDependencyMeta(metaPath, { generation, moduleOptions, rootDir });
|
|
1753
|
-
return { emitDir, emittedFiles: undefined, moduleOptions, rootDir };
|
|
1754
|
-
}
|
|
1755
|
-
/**
|
|
1756
|
-
* Publish the completion marker atomically: write it to a private temp name in
|
|
1757
|
-
* the same directory, then rename onto `metaPath`. Node's rename replaces an
|
|
1758
|
-
* existing file atomically on POSIX and Windows alike, so a concurrent reader
|
|
1759
|
-
* sees either the whole previous marker or the whole new one, never a
|
|
1760
|
-
* half-written file. The marker is the LAST artifact a build writes, after its
|
|
1761
|
-
* generation's emit is complete, so observing the new marker guarantees the new
|
|
1762
|
-
* generation is complete.
|
|
1763
|
-
*/
|
|
1764
|
-
function publishDependencyMeta(metaPath, meta) {
|
|
1765
|
-
const tmp = `${metaPath}.${process.pid}.${Date.now()}.${node_crypto_1.default
|
|
1766
|
-
.randomBytes(6)
|
|
1767
|
-
.toString("hex")}.tmp`;
|
|
1768
|
-
node_fs_1.default.writeFileSync(tmp, JSON.stringify(meta), "utf8");
|
|
1769
|
-
try {
|
|
1770
|
-
node_fs_1.default.renameSync(tmp, metaPath);
|
|
1771
|
-
}
|
|
1772
|
-
catch (error) {
|
|
1773
|
-
node_fs_1.default.rmSync(tmp, { force: true });
|
|
1774
|
-
throw error;
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
function dependencyCacheRoot(env = process.env) {
|
|
1778
|
-
// Descriptor evaluators are disposable and must not leave one isolated emit
|
|
1779
|
-
// generation in the shared temp cache per load. Their result file already
|
|
1780
|
-
// lives in the evaluator-owned directory that the parent removes in
|
|
1781
|
-
// `finally`; put dependency emits beside it so that cleanup owns both.
|
|
1782
|
-
if (env.TTSC_PLUGIN_DESCRIPTOR_LOAD === "1" &&
|
|
1783
|
-
typeof env.TTSC_PLUGIN_DESCRIPTOR_OUT === "string" &&
|
|
1784
|
-
node_path_1.default.isAbsolute(env.TTSC_PLUGIN_DESCRIPTOR_OUT)) {
|
|
1785
|
-
return node_path_1.default.join(node_path_1.default.dirname(env.TTSC_PLUGIN_DESCRIPTOR_OUT), "dependency-cache");
|
|
1786
|
-
}
|
|
1787
|
-
const owner = runtimeManifests().find((candidate) => candidate.depCacheDir.length !== 0);
|
|
1788
|
-
return owner !== undefined
|
|
1789
|
-
? owner.depCacheDir
|
|
1790
|
-
: node_path_1.default.join(node_os_1.default.tmpdir(), "ttsx-dep");
|
|
1791
|
-
}
|
|
1792
|
-
// -----------------------------------------------------------------------------
|
|
1793
|
-
// Fenced dependency-build lock.
|
|
1794
|
-
//
|
|
1795
|
-
// The lock serialises concurrent first-builders of one dependency so the
|
|
1796
|
-
// expensive `runBuild` runs once per key while the rest wait and reuse the
|
|
1797
|
-
// published generation. It is generation-fenced so a stale observer or a former
|
|
1798
|
-
// owner can never release a successor's lock:
|
|
1799
|
-
//
|
|
1800
|
-
// * `<lockDir>/current` is the held generation — a directory carrying a
|
|
1801
|
-
// `generation` id and an `owner.json` (pid + hostname). A contender writes a
|
|
1802
|
-
// private candidate and atomically renames it onto `current`; a directory
|
|
1803
|
-
// rename cannot replace a non-empty `current`, so exactly one contender wins
|
|
1804
|
-
// with no empty-owner publication window.
|
|
1805
|
-
// * Release and reclaim both retire a generation by renaming `current` to its
|
|
1806
|
-
// deterministic tombstone `<lockDir>/retired/<generation>`. The only way to
|
|
1807
|
-
// free `current` is to create that tombstone, so a successor can acquire only
|
|
1808
|
-
// after its predecessor's tombstone exists. A late or duplicate retire of an
|
|
1809
|
-
// already-retired generation therefore finds the tombstone occupied and
|
|
1810
|
-
// fails atomically, and a reclaim that named an old generation can never move
|
|
1811
|
-
// a different successor into that old tombstone.
|
|
1812
|
-
//
|
|
1813
|
-
// This mirrors the source-plugin v2 protocol (`buildSourcePlugin.ts`) proven by
|
|
1814
|
-
// issue #452 / PR #460, minus the legacy-compatibility layer: the ttsx
|
|
1815
|
-
// dependency cache lives under a per-run directory with no shipped on-disk
|
|
1816
|
-
// format to stay compatible with.
|
|
1817
|
-
// -----------------------------------------------------------------------------
|
|
1818
|
-
const DEP_BUILD_LOCK_STEAL_MS = 600_000;
|
|
1819
|
-
const DEP_BUILD_LOCK_POLL_MS = 50;
|
|
1820
|
-
const DEP_BUILD_LOCK_STALE_MS = 30_000;
|
|
1821
|
-
const DEP_BUILD_LOCK_CURRENT_DIR = "current";
|
|
1822
|
-
const DEP_BUILD_LOCK_RETIRED_DIR = "retired";
|
|
1823
|
-
const DEP_BUILD_LOCK_GENERATION_FILE = "generation";
|
|
1824
|
-
const DEP_BUILD_LOCK_OWNER_FILE = "owner.json";
|
|
1825
|
-
/**
|
|
1826
|
-
* Atomically acquire the current generation of a dependency build lock, or
|
|
1827
|
-
* `null` when another process already holds it. Exported for the deterministic
|
|
1828
|
-
* multi-process cache regressions.
|
|
1829
|
-
*/
|
|
1830
|
-
function acquireDependencyBuildLock(lockDir) {
|
|
1831
|
-
ensureDependencyLockRoot(lockDir);
|
|
1832
|
-
const generation = newDependencyGeneration();
|
|
1833
|
-
const candidateDir = node_path_1.default.join(lockDir, `candidate-${generation}`);
|
|
1834
|
-
node_fs_1.default.mkdirSync(candidateDir);
|
|
1835
|
-
try {
|
|
1836
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(candidateDir, DEP_BUILD_LOCK_GENERATION_FILE), `${generation}\n`, { encoding: "utf8", flag: "wx" });
|
|
1837
|
-
writeDependencyLockOwner(candidateDir, generation);
|
|
1838
|
-
const currentDir = node_path_1.default.join(lockDir, DEP_BUILD_LOCK_CURRENT_DIR);
|
|
1839
|
-
try {
|
|
1840
|
-
node_fs_1.default.renameSync(candidateDir, currentDir);
|
|
1841
|
-
}
|
|
1842
|
-
catch (error) {
|
|
1843
|
-
if (isMissingPathError(error) ||
|
|
1844
|
-
isRenameDestinationOccupied(error, currentDir)) {
|
|
1845
|
-
return null;
|
|
1846
|
-
}
|
|
1847
|
-
throw error;
|
|
1848
|
-
}
|
|
1849
|
-
return { generation };
|
|
1850
|
-
}
|
|
1851
|
-
finally {
|
|
1852
|
-
// The candidate name carries this process's random generation and can never
|
|
1853
|
-
// alias `current` or another contender's candidate.
|
|
1854
|
-
node_fs_1.default.rmSync(candidateDir, { force: true, recursive: true });
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
/** Retire a held generation during the holder's `finally`. */
|
|
1858
|
-
function releaseDependencyBuildLock(lockDir, lease) {
|
|
1859
|
-
return retireDependencyBuildLock(lockDir, lease.generation);
|
|
1860
|
-
}
|
|
1861
|
-
/**
|
|
1862
|
-
* Retire exactly the generation carried by an abandoned observation. Exported
|
|
1863
|
-
* for the deterministic multi-process cache regressions.
|
|
1864
|
-
*/
|
|
1865
|
-
function reclaimDependencyBuildLock(lockDir, fence) {
|
|
1866
|
-
return retireDependencyBuildLock(lockDir, fence.generation);
|
|
1867
|
-
}
|
|
1868
|
-
function retireDependencyBuildLock(lockDir, generation) {
|
|
1869
|
-
if (!isDependencyGeneration(generation)) {
|
|
1870
|
-
return false;
|
|
1871
|
-
}
|
|
1872
|
-
const retiredDir = node_path_1.default.join(lockDir, DEP_BUILD_LOCK_RETIRED_DIR);
|
|
1873
|
-
try {
|
|
1874
|
-
node_fs_1.default.mkdirSync(retiredDir);
|
|
1875
|
-
}
|
|
1876
|
-
catch (error) {
|
|
1877
|
-
if (error.code !== "EEXIST") {
|
|
1878
|
-
if (isMissingPathError(error)) {
|
|
1879
|
-
return false;
|
|
1880
|
-
}
|
|
1881
|
-
throw error;
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
const destination = node_path_1.default.join(retiredDir, generation);
|
|
1885
|
-
try {
|
|
1886
|
-
node_fs_1.default.renameSync(node_path_1.default.join(lockDir, DEP_BUILD_LOCK_CURRENT_DIR), destination);
|
|
1887
|
-
return true;
|
|
1888
|
-
}
|
|
1889
|
-
catch (error) {
|
|
1890
|
-
if (isMissingPathError(error) ||
|
|
1891
|
-
isRenameDestinationOccupied(error, destination)) {
|
|
1892
|
-
return false;
|
|
1893
|
-
}
|
|
1894
|
-
throw error;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
/**
|
|
1898
|
-
* Classify the current state of a dependency build lock directory. Exported for
|
|
1899
|
-
* the deterministic multi-process cache regressions.
|
|
1900
|
-
*/
|
|
1901
|
-
function inspectDependencyBuildLock(lockDir, now) {
|
|
1902
|
-
const currentDir = node_path_1.default.join(lockDir, DEP_BUILD_LOCK_CURRENT_DIR);
|
|
1903
|
-
const generation = readDependencyLockGeneration(currentDir);
|
|
1904
|
-
if (generation === null) {
|
|
1905
|
-
if (dependencyLockAgeMs(currentDir, now) === null) {
|
|
1906
|
-
return { state: "released" };
|
|
1907
|
-
}
|
|
1908
|
-
// `current` exists without a readable generation id. Acquisition writes the
|
|
1909
|
-
// id into the candidate BEFORE the atomic rename, so this is a transient or
|
|
1910
|
-
// corrupt state; keep waiting rather than steal on ambiguous evidence.
|
|
1911
|
-
return {
|
|
1912
|
-
state: "active",
|
|
1913
|
-
owner: "lock generation without a readable id",
|
|
1914
|
-
fence: { generation: "" },
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
const fence = { generation };
|
|
1918
|
-
const owner = readDependencyLockOwner(currentDir);
|
|
1919
|
-
if (owner !== null) {
|
|
1920
|
-
const label = describeDependencyLockOwner(owner);
|
|
1921
|
-
if (isLocalHostName(owner.hostname) && !isProcessAlive(owner.pid)) {
|
|
1922
|
-
return {
|
|
1923
|
-
state: "abandoned",
|
|
1924
|
-
reason: `${label} is no longer running`,
|
|
1925
|
-
fence,
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
return { state: "active", owner: label, fence };
|
|
1929
|
-
}
|
|
1930
|
-
const ageMs = dependencyLockAgeMs(currentDir, now);
|
|
1931
|
-
if (ageMs === null) {
|
|
1932
|
-
return { state: "released" };
|
|
1933
|
-
}
|
|
1934
|
-
if (ageMs > DEP_BUILD_LOCK_STALE_MS) {
|
|
1935
|
-
return {
|
|
1936
|
-
state: "abandoned",
|
|
1937
|
-
reason: `lock generation has no ${DEP_BUILD_LOCK_OWNER_FILE} and is ${formatDuration(ageMs)} old`,
|
|
1938
|
-
fence,
|
|
1939
|
-
};
|
|
1940
|
-
}
|
|
1941
|
-
return {
|
|
1942
|
-
state: "active",
|
|
1943
|
-
owner: `lock generation with no ${DEP_BUILD_LOCK_OWNER_FILE}`,
|
|
1944
|
-
fence,
|
|
1945
|
-
};
|
|
1946
|
-
}
|
|
1947
|
-
/** Poll for the locked builder to publish, up to `timeoutMs`. */
|
|
1948
|
-
function waitForDependencyBuild(cacheDir, metaPath, lockDir, timeoutMs) {
|
|
1949
|
-
const startedAt = Date.now();
|
|
1950
|
-
for (;;) {
|
|
1951
|
-
const reuse = readDependencyCache(cacheDir, metaPath);
|
|
1952
|
-
if (reuse !== null) {
|
|
1953
|
-
return { outcome: "built", built: reuse };
|
|
1954
|
-
}
|
|
1955
|
-
const now = Date.now();
|
|
1956
|
-
const lock = inspectDependencyBuildLock(lockDir, now);
|
|
1957
|
-
if (lock.state === "released") {
|
|
1958
|
-
// The holder retired its generation between the cache check above and this
|
|
1959
|
-
// observation: prefer the marker if it landed in that window, otherwise
|
|
1960
|
-
// hand the free lock back to the caller to re-acquire.
|
|
1961
|
-
const built = readDependencyCache(cacheDir, metaPath);
|
|
1962
|
-
return built !== null
|
|
1963
|
-
? { outcome: "built", built }
|
|
1964
|
-
: { outcome: "released" };
|
|
1965
|
-
}
|
|
1966
|
-
if (lock.state === "abandoned") {
|
|
1967
|
-
return { outcome: "abandoned", reason: lock.reason, fence: lock.fence };
|
|
1968
|
-
}
|
|
1969
|
-
if (now - startedAt > timeoutMs) {
|
|
1970
|
-
return {
|
|
1971
|
-
outcome: "abandoned",
|
|
1972
|
-
reason: `timed out after ${formatDuration(now - startedAt)}`,
|
|
1973
|
-
fence: lock.fence,
|
|
1974
|
-
};
|
|
1975
|
-
}
|
|
1976
|
-
sleepSync(DEP_BUILD_LOCK_POLL_MS);
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
function ensureDependencyLockRoot(lockDir) {
|
|
1980
|
-
node_fs_1.default.mkdirSync(node_path_1.default.join(lockDir, DEP_BUILD_LOCK_RETIRED_DIR), {
|
|
1981
|
-
recursive: true,
|
|
1982
|
-
});
|
|
1983
|
-
}
|
|
1984
|
-
function writeDependencyLockOwner(generationDir, generation) {
|
|
1985
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(generationDir, DEP_BUILD_LOCK_OWNER_FILE), `${JSON.stringify({
|
|
1986
|
-
generation,
|
|
1987
|
-
hostname: node_os_1.default.hostname(),
|
|
1988
|
-
pid: process.pid,
|
|
1989
|
-
startedAt: new Date().toISOString(),
|
|
1990
|
-
})}\n`, "utf8");
|
|
1991
|
-
}
|
|
1992
|
-
function readDependencyLockOwner(generationDir) {
|
|
1993
|
-
try {
|
|
1994
|
-
const parsed = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(generationDir, DEP_BUILD_LOCK_OWNER_FILE), "utf8"));
|
|
1995
|
-
if (typeof parsed.hostname !== "string" ||
|
|
1996
|
-
typeof parsed.pid !== "number" ||
|
|
1997
|
-
!Number.isInteger(parsed.pid) ||
|
|
1998
|
-
parsed.pid <= 0) {
|
|
1999
|
-
return null;
|
|
2000
|
-
}
|
|
2001
|
-
return {
|
|
2002
|
-
hostname: parsed.hostname,
|
|
2003
|
-
pid: parsed.pid,
|
|
2004
|
-
startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : undefined,
|
|
2005
|
-
};
|
|
2006
|
-
}
|
|
2007
|
-
catch {
|
|
2008
|
-
return null;
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
function readDependencyLockGeneration(generationDir) {
|
|
2012
|
-
try {
|
|
2013
|
-
const generation = node_fs_1.default
|
|
2014
|
-
.readFileSync(node_path_1.default.join(generationDir, DEP_BUILD_LOCK_GENERATION_FILE), "utf8")
|
|
2015
|
-
.trim();
|
|
2016
|
-
return isDependencyGeneration(generation) ? generation : null;
|
|
2017
|
-
}
|
|
2018
|
-
catch {
|
|
2019
|
-
return null;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
/** Age of an observed lock directory, or `null` when it no longer exists. */
|
|
2023
|
-
function dependencyLockAgeMs(generationDir, now) {
|
|
2024
|
-
try {
|
|
2025
|
-
return Math.max(0, now - node_fs_1.default.statSync(generationDir).mtimeMs);
|
|
2026
|
-
}
|
|
2027
|
-
catch (error) {
|
|
2028
|
-
return isMissingPathError(error) ? null : 0;
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
function describeDependencyLockOwner(owner) {
|
|
2032
|
-
const started = owner.startedAt === undefined ? "" : ` started at ${owner.startedAt}`;
|
|
2033
|
-
return `pid ${owner.pid} on ${owner.hostname}${started}`;
|
|
2034
|
-
}
|
|
2035
|
-
function isLocalHostName(hostname) {
|
|
2036
|
-
return hostname.toLowerCase() === node_os_1.default.hostname().toLowerCase();
|
|
2037
|
-
}
|
|
2038
|
-
function isProcessAlive(pid) {
|
|
2039
|
-
try {
|
|
2040
|
-
process.kill(pid, 0);
|
|
2041
|
-
return true;
|
|
2042
|
-
}
|
|
2043
|
-
catch (error) {
|
|
2044
|
-
return error.code === "EPERM";
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
function isMissingPathError(error) {
|
|
2048
|
-
const code = error.code;
|
|
2049
|
-
return code === "ENOENT" || code === "ENOTDIR";
|
|
2050
|
-
}
|
|
2051
|
-
function isRenameDestinationOccupied(error, destination) {
|
|
2052
|
-
const code = error.code;
|
|
2053
|
-
if (code === "EEXIST" || code === "ENOTEMPTY") {
|
|
2054
|
-
return true;
|
|
2055
|
-
}
|
|
2056
|
-
return (code === "EACCES" || code === "EPERM") && node_fs_1.default.existsSync(destination);
|
|
2057
|
-
}
|
|
2058
|
-
/** Render a millisecond duration for lock diagnostics (`137ms`, `42s`, `9m 3s`). */
|
|
2059
|
-
function formatDuration(ms) {
|
|
2060
|
-
if (!Number.isFinite(ms)) {
|
|
2061
|
-
return "an unknown time";
|
|
2062
|
-
}
|
|
2063
|
-
if (ms < 1_000) {
|
|
2064
|
-
return `${Math.max(0, Math.round(ms))}ms`;
|
|
2065
|
-
}
|
|
2066
|
-
const seconds = Math.floor(ms / 1_000);
|
|
2067
|
-
const minutes = Math.floor(seconds / 60);
|
|
2068
|
-
const remainder = seconds % 60;
|
|
2069
|
-
return minutes === 0 ? `${seconds}s` : `${minutes}m ${remainder}s`;
|
|
2070
|
-
}
|
|
2071
|
-
const tsconfigCache = new Map();
|
|
2072
|
-
const moduleOptionsCache = new Map();
|
|
2073
|
-
/**
|
|
2074
|
-
* The nearest `tsconfig.json` at or above `file`'s directory, or `null`. The
|
|
2075
|
-
* walk stops at a `node_modules` boundary: a tsconfig above `node_modules`
|
|
2076
|
-
* belongs to the consumer, not to the published dependency inside it, so a
|
|
2077
|
-
* dependency that ships no tsconfig of its own has no owning project and is
|
|
2078
|
-
* compiled in isolation instead. A pnpm-symlinked workspace package is
|
|
2079
|
-
* unaffected because `file` is already its real path (outside `node_modules`).
|
|
2080
|
-
*
|
|
2081
|
-
* The walk is memoised per directory (the whole walked chain shares one
|
|
2082
|
-
* answer), so the thousands of files a fanned-out test corpus imports from the
|
|
2083
|
-
* same handful of projects do not each re-stat the same parent directories.
|
|
2084
|
-
*/
|
|
2085
|
-
function nearestTsconfig(file) {
|
|
2086
|
-
let directory = node_path_1.default.dirname(file);
|
|
2087
|
-
const chain = [];
|
|
2088
|
-
for (;;) {
|
|
2089
|
-
const cached = tsconfigCache.get(directory);
|
|
2090
|
-
if (cached !== undefined) {
|
|
2091
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1") {
|
|
2092
|
-
return rememberTsconfig(chain, cached.result, cached.candidates);
|
|
2093
|
-
}
|
|
2094
|
-
// Bracket the cached selection with the same candidate observations the
|
|
2095
|
-
// parent later reconciles. A nearer config created between a liveness
|
|
2096
|
-
// check and reporting must conflict, not be paired with the cached
|
|
2097
|
-
// farther result and certified as current.
|
|
2098
|
-
recordPluginDescriptorTsconfigCandidates(cached.candidates);
|
|
2099
|
-
const current = nearestExistingTsconfig(cached.candidates);
|
|
2100
|
-
recordPluginDescriptorTsconfigCandidates(cached.candidates);
|
|
2101
|
-
if (current === cached.result) {
|
|
2102
|
-
return rememberTsconfig(chain, cached.result, cached.candidates);
|
|
2103
|
-
}
|
|
2104
|
-
// Descriptor factories can deliberately create a config before a lazy
|
|
2105
|
-
// import. A lookup cached while an earlier import ran must not keep
|
|
2106
|
-
// serving the orphan lane after the nearest candidate changed.
|
|
2107
|
-
tsconfigCache.delete(directory);
|
|
2108
|
-
}
|
|
2109
|
-
if (node_path_1.default.basename(directory) === "node_modules") {
|
|
2110
|
-
return rememberTsconfig(chain, null);
|
|
2111
|
-
}
|
|
2112
|
-
chain.push(directory);
|
|
2113
|
-
const candidate = node_path_1.default.join(directory, "tsconfig.json");
|
|
2114
|
-
recordPluginDescriptorTsconfigCandidates([candidate]);
|
|
2115
|
-
if (isFile(candidate)) {
|
|
2116
|
-
return rememberTsconfig(chain, candidate);
|
|
2117
|
-
}
|
|
2118
|
-
const parent = node_path_1.default.dirname(directory);
|
|
2119
|
-
if (parent === directory) {
|
|
2120
|
-
return rememberTsconfig(chain, null);
|
|
2121
|
-
}
|
|
2122
|
-
directory = parent;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
function nearestExistingTsconfig(candidates) {
|
|
2126
|
-
for (const candidate of candidates) {
|
|
2127
|
-
if (isFile(candidate))
|
|
2128
|
-
return node_path_1.default.resolve(candidate);
|
|
2129
|
-
}
|
|
2130
|
-
return null;
|
|
2131
|
-
}
|
|
2132
|
-
function rememberTsconfig(directories, result, tailCandidates = []) {
|
|
2133
|
-
let candidates = [...tailCandidates];
|
|
2134
|
-
for (let index = directories.length - 1; index >= 0; index -= 1) {
|
|
2135
|
-
const directory = directories[index];
|
|
2136
|
-
candidates = [node_path_1.default.join(directory, "tsconfig.json"), ...candidates];
|
|
2137
|
-
tsconfigCache.set(directory, { candidates, result });
|
|
2138
|
-
}
|
|
2139
|
-
return result;
|
|
2140
|
-
}
|
|
2141
|
-
/** Report every owning-config candidate observed by the nearest-config walk. */
|
|
2142
|
-
function recordPluginDescriptorTsconfigCandidates(candidates) {
|
|
2143
|
-
if (process.env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE !== "1")
|
|
2144
|
-
return;
|
|
2145
|
-
for (const candidate of candidates) {
|
|
2146
|
-
const resolved = node_path_1.default.resolve(candidate);
|
|
2147
|
-
recordPluginDescriptorInput({
|
|
2148
|
-
resolved,
|
|
2149
|
-
});
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
function readFileOrNull(file) {
|
|
2153
|
-
if (file === null) {
|
|
2154
|
-
return null;
|
|
2155
|
-
}
|
|
2156
|
-
try {
|
|
2157
|
-
return node_fs_1.default.readFileSync(file, "utf8");
|
|
2158
|
-
}
|
|
2159
|
-
catch {
|
|
2160
|
-
return null;
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
/**
|
|
2164
|
-
* The physical path, in the same spelling the launcher decided on.
|
|
2165
|
-
*
|
|
2166
|
-
* `realpathSync.native` first, because the plain implementation resolves
|
|
2167
|
-
* reparse points but leaves a Windows 8.3 component alone — and `TEMP` is
|
|
2168
|
-
* `C:\Users\RUNNER~1\...` on a GitHub Windows runner. The launcher resolves the
|
|
2169
|
-
* entry through `fs.realpathSync.native`, so answering here with the short name
|
|
2170
|
-
* would put a `..` in `path.relative(rootDir, real)`, drop the exact-mirror
|
|
2171
|
-
* lane, and leave the entry to whatever the trailing-stem matcher picks.
|
|
2172
|
-
*/
|
|
2173
|
-
function realPath(target) {
|
|
2174
|
-
try {
|
|
2175
|
-
return node_fs_1.default.realpathSync.native?.(target) ?? node_fs_1.default.realpathSync(target);
|
|
2176
|
-
}
|
|
2177
|
-
catch {
|
|
2178
|
-
return target;
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* The physical spelling of a path, produced the way the served sources it will
|
|
2183
|
-
* be compared against are produced.
|
|
2184
|
-
*
|
|
2185
|
-
* `createFilesystemPathIdentityContext` is the same resolver the entry lane
|
|
2186
|
-
* uses (`prepareExecution.ts::resolveRuntimeSourceRoot`). For a path that
|
|
2187
|
-
* exists it is one `realpathSync.native`. For one that does not it resolves as
|
|
2188
|
-
* far as the filesystem goes and folds the missing tail by the case semantics
|
|
2189
|
-
* of the surviving ancestor, which costs a directory read and, on Windows, can
|
|
2190
|
-
* cost an `fsutil` query — worth knowing, but off the path a real dependency
|
|
2191
|
-
* root takes.
|
|
2192
|
-
*
|
|
2193
|
-
* Total on purpose. `throwOnRealpathError: false` silences a failed realpath,
|
|
2194
|
-
* but the case-sensitivity probe can still fail on its own (an unreadable
|
|
2195
|
-
* ancestor, a denied alternate-case `lstat`), and neither caller has anywhere
|
|
2196
|
-
* to put that: `readDependencyCache` is contracted to answer `null` rather than
|
|
2197
|
-
* throw, and `buildDependency` has already produced its emit. The unresolved
|
|
2198
|
-
* spelling is exactly what both had before this pass, so it is the fallback.
|
|
2199
|
-
*/
|
|
2200
|
-
function resolvePhysicalPath(location) {
|
|
2201
|
-
try {
|
|
2202
|
-
return (0, projectInputPathIdentity_1.createFilesystemPathIdentityContext)({
|
|
2203
|
-
throwOnRealpathError: false,
|
|
2204
|
-
}).resolve(location).path;
|
|
2205
|
-
}
|
|
2206
|
-
catch {
|
|
2207
|
-
return location;
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
/**
|
|
2211
|
-
* The source-tree root a dependency's emit mirrors, in the spelling
|
|
2212
|
-
* `resolveEmittedJavaScript` compares a served source against.
|
|
2213
|
-
*
|
|
2214
|
-
* Both branches need the pass, for different reasons. A declared `rootDir`
|
|
2215
|
-
* arrives from `readProjectConfig` joined against the config that declared it
|
|
2216
|
-
* but never resolved, so a `rootDir` that is itself a symlinked directory stays
|
|
2217
|
-
* unresolved. `project.root` arrives through plain `fs.realpathSync`, which
|
|
2218
|
-
* follows reparse points but leaves a Windows 8.3 component alone — and
|
|
2219
|
-
* {@link realPath} uses `fs.realpathSync.native`, which expands it. Either way
|
|
2220
|
-
* `path.relative` puts a `..` in front of an in-project source,
|
|
2221
|
-
* `resolveExactEmittedFiles` returns nothing, and every served file of that
|
|
2222
|
-
* dependency falls to the trailing-stem matcher, which rescans the whole emit
|
|
2223
|
-
* tree per file because a dependency build publishes no emitted-file list.
|
|
2224
|
-
*
|
|
2225
|
-
* This is the pass the entry lane settled on for the same mixed pair; the two
|
|
2226
|
-
* lanes now read alike, `path.isAbsolute` guard included. `readProjectConfig`
|
|
2227
|
-
* absolutizes every path option against the config that declared it, so that
|
|
2228
|
-
* guard is a mirror of the entry lane rather than a live branch.
|
|
2229
|
-
*/
|
|
2230
|
-
function resolveDependencySourceRoot(project) {
|
|
2231
|
-
const rootDir = project.compilerOptions.rootDir;
|
|
2232
|
-
return resolvePhysicalPath(typeof rootDir !== "string"
|
|
2233
|
-
? project.root
|
|
2234
|
-
: node_path_1.default.isAbsolute(rootDir)
|
|
2235
|
-
? rootDir
|
|
2236
|
-
: node_path_1.default.resolve(project.root, rootDir));
|
|
2237
|
-
}
|
|
2238
|
-
/**
|
|
2239
|
-
* Map the JavaScript extension a relative `specifier` carries to the TypeScript
|
|
2240
|
-
* source extensions tsgo would have emitted it from. Running from source, a
|
|
2241
|
-
* `"./x.js"` import (whether authored or rewritten from `"./x.ts"` by
|
|
2242
|
-
* `--rewriteRelativeImportExtensions`) has no `.js` on disk — only `./x.ts`.
|
|
2243
|
-
*/
|
|
2244
|
-
const JS_TO_TS_EXTENSIONS = new Map([
|
|
2245
|
-
[".js", [".ts", ".tsx"]],
|
|
2246
|
-
[".jsx", [".tsx"]],
|
|
2247
|
-
[".mjs", [".mts"]],
|
|
2248
|
-
[".cjs", [".cts"]],
|
|
2249
|
-
]);
|
|
2250
|
-
/** Candidate sources that can satisfy one missing JavaScript spelling. */
|
|
2251
|
-
function typescriptSourcesForJavaScriptSpecifier(file) {
|
|
2252
|
-
const extension = node_path_1.default.extname(file).toLowerCase();
|
|
2253
|
-
const substitutions = JS_TO_TS_EXTENSIONS.get(extension);
|
|
2254
|
-
if (substitutions === undefined)
|
|
2255
|
-
return [];
|
|
2256
|
-
const stem = file.slice(0, file.length - extension.length);
|
|
2257
|
-
return substitutions.map((candidate) => stem + candidate);
|
|
2258
|
-
}
|
|
2259
|
-
/**
|
|
2260
|
-
* Rescue a `specifier` that Node's resolver rejected: map a JavaScript
|
|
2261
|
-
* extension back to its TypeScript source, or probe candidate extensions /
|
|
2262
|
-
* directory indexes for an extensionless form. Returns a `file:` URL for the
|
|
2263
|
-
* first match, or `null` when nothing matches.
|
|
2264
|
-
*
|
|
2265
|
-
* Handles two shapes:
|
|
2266
|
-
*
|
|
2267
|
-
* - A relative specifier (`./x`) resolved against a `file:` parent — a normal
|
|
2268
|
-
* `import`/`require` inside a served module;
|
|
2269
|
-
* - An already-absolute specifier with no parent — the main entry of a
|
|
2270
|
-
* `child_process.fork(__dirname + "/servant.js")`. fork's main module reaches
|
|
2271
|
-
* the resolve hook as an absolute `.js` path with `parentURL` undefined, and
|
|
2272
|
-
* run-from-source ships only the `.ts`, so without this the child dies with
|
|
2273
|
-
* `Cannot find module servant.js` and a tgrid master waits on it forever.
|
|
2274
|
-
*/
|
|
2275
|
-
function probeRescuableSpecifier(specifier, parentURL) {
|
|
2276
|
-
// A `?query` / `#hash` suffix is part of module identity, not the path; strip
|
|
2277
|
-
// it before resolving and re-attach it to the resolved URL so a loader keying
|
|
2278
|
-
// on the suffix (and `import.meta.url`) sees it preserved.
|
|
2279
|
-
const suffixStart = specifier.search(/[?#]/);
|
|
2280
|
-
const suffix = suffixStart === -1 ? "" : specifier.slice(suffixStart);
|
|
2281
|
-
const pathname = suffixStart === -1 ? specifier : specifier.slice(0, suffixStart);
|
|
2282
|
-
let base;
|
|
2283
|
-
if (isRelativeSpecifier(specifier)) {
|
|
2284
|
-
if (parentURL === undefined || !parentURL.startsWith("file:")) {
|
|
2285
|
-
return null;
|
|
2286
|
-
}
|
|
2287
|
-
const parentDir = node_path_1.default.dirname((0, node_url_1.fileURLToPath)(parentURL));
|
|
2288
|
-
base = node_path_1.default.resolve(parentDir, pathname);
|
|
2289
|
-
}
|
|
2290
|
-
else if (node_path_1.default.isAbsolute(pathname)) {
|
|
2291
|
-
base = pathname;
|
|
2292
|
-
}
|
|
2293
|
-
else {
|
|
2294
|
-
return null;
|
|
2295
|
-
}
|
|
2296
|
-
const withSuffix = (candidate) => (0, node_url_1.pathToFileURL)(candidate).href + suffix;
|
|
2297
|
-
const jsExtension = node_path_1.default.extname(base).toLowerCase();
|
|
2298
|
-
const tsExtensions = JS_TO_TS_EXTENSIONS.get(jsExtension);
|
|
2299
|
-
if (tsExtensions !== undefined) {
|
|
2300
|
-
const stem = base.slice(0, base.length - jsExtension.length);
|
|
2301
|
-
for (const extension of tsExtensions) {
|
|
2302
|
-
const candidate = stem + extension;
|
|
2303
|
-
if (isFile(candidate)) {
|
|
2304
|
-
return withSuffix(candidate);
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
return null;
|
|
2308
|
-
}
|
|
2309
|
-
if (hasConcreteExtension(pathname)) {
|
|
2310
|
-
return null;
|
|
2311
|
-
}
|
|
2312
|
-
for (const extension of RESOLVABLE_EXTENSIONS) {
|
|
2313
|
-
const candidate = base + extension;
|
|
2314
|
-
if (isFile(candidate)) {
|
|
2315
|
-
return withSuffix(candidate);
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
for (const extension of RESOLVABLE_EXTENSIONS) {
|
|
2319
|
-
const candidate = node_path_1.default.join(base, `index${extension}`);
|
|
2320
|
-
if (isFile(candidate)) {
|
|
2321
|
-
return withSuffix(candidate);
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
return null;
|
|
2325
|
-
}
|
|
2326
|
-
/**
|
|
2327
|
-
* Decide the module format the way Node and tsgo do — from configuration, never
|
|
2328
|
-
* by sniffing the emitted text.
|
|
2329
|
-
*
|
|
2330
|
-
* The file extension is authoritative first (`.mts`/`.mjs` → module,
|
|
2331
|
-
* `.cts`/`.cjs` → commonjs), exactly as tsgo's
|
|
2332
|
-
* `getImpliedNodeFormatForEmitWorker` checks it ahead of everything else.
|
|
2333
|
-
*
|
|
2334
|
-
* After that the decision belongs to the project that emitted the file, so
|
|
2335
|
-
* `options` is the whole compiler-option pair tsgo consults, not just `module`:
|
|
2336
|
-
* an absent `module` is NOT "ask Node", it is "derive the kind from `target`"
|
|
2337
|
-
* (tsgo's `getEmitModuleKind`), and TypeScript 7 defaults `target` to the
|
|
2338
|
-
* latest standard, which means ES modules. Only the `node*` family defers to
|
|
2339
|
-
* the nearest `package.json` `type`, because only that family makes tsgo
|
|
2340
|
-
* consult it.
|
|
2341
|
-
*
|
|
2342
|
-
* `options` is `null` for a file no tsconfig owns at all — a raw `.ts` shipped
|
|
2343
|
-
* under `node_modules`. Nothing emitted it, so Node's own rule is the only rule
|
|
2344
|
-
* there is, and the package `type` decides.
|
|
2345
|
-
*/
|
|
2346
|
-
function moduleFormat(filename, options) {
|
|
2347
|
-
if (filename.endsWith(".mts") || filename.endsWith(".mjs")) {
|
|
2348
|
-
return "module";
|
|
2349
|
-
}
|
|
2350
|
-
if (filename.endsWith(".cts") || filename.endsWith(".cjs")) {
|
|
2351
|
-
return "commonjs";
|
|
2352
|
-
}
|
|
2353
|
-
if (options === null) {
|
|
2354
|
-
return nearestPackageType(filename);
|
|
2355
|
-
}
|
|
2356
|
-
// A package that states its `type` outright decides for the files inside it
|
|
2357
|
-
// whatever the module kind is. This is where a source-shipping dependency's
|
|
2358
|
-
// own declaration overrides the compiling project's `module`; see
|
|
2359
|
-
// `declaredNodeModulesPackageType` for why `node_modules` bounds it.
|
|
2360
|
-
const declared = declaredNodeModulesPackageType(filename);
|
|
2361
|
-
if (declared !== null) {
|
|
2362
|
-
return declared;
|
|
2363
|
-
}
|
|
2364
|
-
const kind = effectiveModuleKind(options);
|
|
2365
|
-
if (kind === "node16" ||
|
|
2366
|
-
kind === "node18" ||
|
|
2367
|
-
kind === "node20" ||
|
|
2368
|
-
kind === "nodenext") {
|
|
2369
|
-
return nearestPackageType(filename);
|
|
2370
|
-
}
|
|
2371
|
-
if (kind === "commonjs") {
|
|
2372
|
-
return "commonjs";
|
|
2373
|
-
}
|
|
2374
|
-
// Everything that remains (es2015 … esnext, and `preserve`, which keeps the
|
|
2375
|
-
// authored ESM syntax verbatim whatever the package `type` says) is emitted
|
|
2376
|
-
// as ECMAScript modules. `amd`, `umd`, and `system` are not among them:
|
|
2377
|
-
// TypeScript 7 removed all three, so a project declaring one cannot build,
|
|
2378
|
-
// and a file it would have owned reaches the run through the orphan lane
|
|
2379
|
-
// instead.
|
|
2380
|
-
return "module";
|
|
2381
|
-
}
|
|
2382
|
-
/**
|
|
2383
|
-
* The `"type"` a `node_modules` package states for `filename`, or `null`.
|
|
2384
|
-
*
|
|
2385
|
-
* Tsgo's `GetImpliedNodeFormatForEmitWorker` consults a file's
|
|
2386
|
-
* `packageJsonType` for **every** module kind, not just the `node*` family. So
|
|
2387
|
-
* a source-shipping dependency that declares `"type": "commonjs"` is emitted as
|
|
2388
|
-
* CommonJS even while the compiling project asks for `esnext`, and the mirror
|
|
2389
|
-
* has to honour the same override or Node is handed the wrong format.
|
|
2390
|
-
*
|
|
2391
|
-
* Outside `node_modules` that field is empty for every module kind this
|
|
2392
|
-
* override can change. `loadSourceFileMetaData` does fill it elsewhere — for a
|
|
2393
|
-
* file whose extension does not itself state the format (anything but `.mts`,
|
|
2394
|
-
* `.cts`, `.mjs`, `.cjs`) whose project sets `moduleResolution` to the
|
|
2395
|
-
* `node16`…`nodenext` family — but `program.go` rejects that resolution unless
|
|
2396
|
-
* `module` is in the same family, and for a `node*` `module` the package `type`
|
|
2397
|
-
* is already the whole answer, which the caller's own `node*` branch produces.
|
|
2398
|
-
* So answering from a manifest outside `node_modules` could only override the
|
|
2399
|
-
* project's own `module` option, the very confusion this classifier exists to
|
|
2400
|
-
* end.
|
|
2401
|
-
*/
|
|
2402
|
-
function declaredNodeModulesPackageType(filename) {
|
|
2403
|
-
if (!pathHasNodeModulesSegment(filename)) {
|
|
2404
|
-
return null;
|
|
2405
|
-
}
|
|
2406
|
-
return declaredPackageType(filename);
|
|
2407
|
-
}
|
|
2408
|
-
/**
|
|
2409
|
-
* Whether any path segment of `filename` is literally `node_modules`.
|
|
2410
|
-
*
|
|
2411
|
-
* Case-sensitive on every platform, because the upstream test this mirrors is a
|
|
2412
|
-
* case-sensitive substring search and Node's own resolver recognises only the
|
|
2413
|
-
* exact spelling. A directory named `Node_Modules` is a package store to
|
|
2414
|
-
* neither of them, and must not become one here.
|
|
2415
|
-
*/
|
|
2416
|
-
function pathHasNodeModulesSegment(filename) {
|
|
2417
|
-
return filename.split(/[\\/]/).includes("node_modules");
|
|
2418
|
-
}
|
|
2419
|
-
/**
|
|
2420
|
-
* The `module` kind tsgo actually emits with, mirroring `getEmitModuleKind`:
|
|
2421
|
-
* the declared `module` when there is one, and otherwise the kind implied by
|
|
2422
|
-
* `target`. `"none"` is the spelling of an unset `module`, so it derives the
|
|
2423
|
-
* same way.
|
|
2424
|
-
*/
|
|
2425
|
-
function effectiveModuleKind(options) {
|
|
2426
|
-
const declared = (options.module ?? "").toLowerCase();
|
|
2427
|
-
if (declared !== "" && declared !== "none") {
|
|
2428
|
-
return declared;
|
|
2429
|
-
}
|
|
2430
|
-
const target = (options.target ?? "").toLowerCase();
|
|
2431
|
-
if (target === "esnext") {
|
|
2432
|
-
return "esnext";
|
|
2433
|
-
}
|
|
2434
|
-
const year = scriptTargetYear(target);
|
|
2435
|
-
if (year === null) {
|
|
2436
|
-
// An unset `target` is `ScriptTargetLatestStandard` upstream, well above the
|
|
2437
|
-
// ES2022 boundary. Every other spelling lands here too: TypeScript 7 removed
|
|
2438
|
-
// `ES5` and dropped `ES3` entirely, and its only remaining targets are
|
|
2439
|
-
// year-numbered ones, so nothing that reaches emit derives CommonJS.
|
|
2440
|
-
return "es2022";
|
|
2441
|
-
}
|
|
2442
|
-
if (year >= 2022)
|
|
2443
|
-
return "es2022";
|
|
2444
|
-
if (year >= 2020)
|
|
2445
|
-
return "es2020";
|
|
2446
|
-
return "es2015";
|
|
2447
|
-
}
|
|
2448
|
-
/**
|
|
2449
|
-
* Year of an `ES<year>` script target, with `es6` normalized to its `es2015`
|
|
2450
|
-
* synonym. Returns `null` when the spelling is not a year-numbered target,
|
|
2451
|
-
* which the caller resolves to the modern default.
|
|
2452
|
-
*/
|
|
2453
|
-
function scriptTargetYear(target) {
|
|
2454
|
-
if (target === "es6") {
|
|
2455
|
-
return 2015;
|
|
2456
|
-
}
|
|
2457
|
-
const match = /^es(\d{4})$/.exec(target);
|
|
2458
|
-
return match === null ? null : Number(match[1]);
|
|
2459
|
-
}
|
|
2460
|
-
/** Package-type cache keyed by directory, mirroring Node's own lookup walk. */
|
|
2461
|
-
const packageTypeCache = new Map();
|
|
2462
|
-
function nearestPackageType(filename) {
|
|
2463
|
-
let directory = node_path_1.default.dirname(filename);
|
|
2464
|
-
const chain = [];
|
|
2465
|
-
while (true) {
|
|
2466
|
-
const cached = packageTypeCache.get(directory);
|
|
2467
|
-
if (cached !== undefined) {
|
|
2468
|
-
return rememberPackageType(chain, cached);
|
|
2469
|
-
}
|
|
2470
|
-
chain.push(directory);
|
|
2471
|
-
const type = readPackageType(directory);
|
|
2472
|
-
if (type !== null) {
|
|
2473
|
-
return rememberPackageType(chain, type);
|
|
2474
|
-
}
|
|
2475
|
-
const parent = node_path_1.default.dirname(directory);
|
|
2476
|
-
if (parent === directory) {
|
|
2477
|
-
return rememberPackageType(chain, "commonjs");
|
|
2478
|
-
}
|
|
2479
|
-
directory = parent;
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
function rememberPackageType(directories, type) {
|
|
2483
|
-
for (const directory of directories) {
|
|
2484
|
-
packageTypeCache.set(directory, type);
|
|
2485
|
-
}
|
|
2486
|
-
return type;
|
|
2487
|
-
}
|
|
2488
|
-
/** Read a directory's `package.json` `type`, or `null` when absent/invalid. */
|
|
2489
|
-
function readPackageType(directory) {
|
|
2490
|
-
const manifestPath = node_path_1.default.join(directory, "package.json");
|
|
2491
|
-
if (!isFile(manifestPath)) {
|
|
2492
|
-
return null;
|
|
2493
|
-
}
|
|
2494
|
-
try {
|
|
2495
|
-
const parsed = JSON.parse(node_fs_1.default.readFileSync(manifestPath, "utf8"));
|
|
2496
|
-
return parsed.type === "module" ? "module" : "commonjs";
|
|
2497
|
-
}
|
|
2498
|
-
catch {
|
|
2499
|
-
return "commonjs";
|
|
2500
|
-
}
|
|
2501
|
-
}
|
|
2502
|
-
/**
|
|
2503
|
-
* The `"type"` the nearest `package.json` states outright, or `null` when the
|
|
2504
|
-
* nearest manifest omits it (or there is none).
|
|
2505
|
-
*
|
|
2506
|
-
* `nearestPackageType` answers "what format would Node use", which defaults a
|
|
2507
|
-
* silent manifest to CommonJS. This answers the narrower question "did a
|
|
2508
|
-
* package actually say", which is what an override has to be built on: a
|
|
2509
|
-
* manifest that says nothing must not out-vote the compiling project's own
|
|
2510
|
-
* `module` option.
|
|
2511
|
-
*/
|
|
2512
|
-
function declaredPackageType(filename) {
|
|
2513
|
-
let directory = node_path_1.default.dirname(filename);
|
|
2514
|
-
while (true) {
|
|
2515
|
-
const manifestPath = node_path_1.default.join(directory, "package.json");
|
|
2516
|
-
if (isFile(manifestPath)) {
|
|
2517
|
-
try {
|
|
2518
|
-
const parsed = JSON.parse(node_fs_1.default.readFileSync(manifestPath, "utf8"));
|
|
2519
|
-
// The walk stops at the first manifest either way, exactly as Node's
|
|
2520
|
-
// package-scope lookup does; only the answer differs.
|
|
2521
|
-
return parsed.type === "module" || parsed.type === "commonjs"
|
|
2522
|
-
? parsed.type
|
|
2523
|
-
: null;
|
|
2524
|
-
}
|
|
2525
|
-
catch {
|
|
2526
|
-
return null;
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
const parent = node_path_1.default.dirname(directory);
|
|
2530
|
-
if (parent === directory) {
|
|
2531
|
-
return null;
|
|
2532
|
-
}
|
|
2533
|
-
directory = parent;
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
function isRelativeSpecifier(specifier) {
|
|
2537
|
-
return (specifier === "." ||
|
|
2538
|
-
specifier === ".." ||
|
|
2539
|
-
specifier.startsWith("./") ||
|
|
2540
|
-
specifier.startsWith("../"));
|
|
2541
|
-
}
|
|
2542
|
-
/** True when `specifier` already carries an extension Node can load directly. */
|
|
2543
|
-
function hasConcreteExtension(specifier) {
|
|
2544
|
-
return /\.(?:[cm]?jsx?|json|node|[cm]?tsx?)$/i.test(specifier);
|
|
2545
|
-
}
|
|
2546
|
-
function isTypeScriptSource(filename) {
|
|
2547
|
-
return TYPESCRIPT_EXTENSIONS.some((extension) => filename.endsWith(extension));
|
|
2548
|
-
}
|
|
2549
|
-
function isFile(candidate) {
|
|
2550
|
-
try {
|
|
2551
|
-
return node_fs_1.default.statSync(candidate).isFile();
|
|
2552
|
-
}
|
|
2553
|
-
catch {
|
|
2554
|
-
return false;
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
/** True when `directory` holds at least one emitted JavaScript file (any depth). */
|
|
2558
|
-
function emittedAnything(directory) {
|
|
2559
|
-
let entries;
|
|
2560
|
-
try {
|
|
2561
|
-
entries = node_fs_1.default.readdirSync(directory, { withFileTypes: true });
|
|
2562
|
-
}
|
|
2563
|
-
catch {
|
|
2564
|
-
return false;
|
|
2565
|
-
}
|
|
2566
|
-
for (const entry of entries) {
|
|
2567
|
-
const full = node_path_1.default.join(directory, entry.name);
|
|
2568
|
-
if (entry.isDirectory()) {
|
|
2569
|
-
if (emittedAnything(full)) {
|
|
2570
|
-
return true;
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
else if (entry.isFile() && /\.(?:[cm]?js)$/i.test(entry.name)) {
|
|
2574
|
-
return true;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
return false;
|
|
2578
|
-
}
|
|
2579
|
-
//# sourceMappingURL=runtimeHooks.js.map
|