ttsc 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/cmd/ttsc/api_compile.go +3 -2
- package/cmd/ttsc/api_transform.go +1 -1
- package/cmd/ttsc/build.go +5 -4
- package/cmd/ttsc-cache/account.go +16 -0
- package/cmd/ttsc-cache/account_test.go +91 -0
- package/cmd/ttsc-cache/main.go +1 -1
- package/cmd/ttsc-cache/protocol_test.go +2 -2
- package/cmd/ttsc-cache/publisher_seal_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_failure_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_test.go +2 -2
- package/cmd/ttsc-cache/store.go +5 -0
- package/cmd/ttsc-cache/tuple.go +6 -2
- package/cmd/ttsc-cache/tuple_test.go +1 -1
- package/cmd/ttscgraph/main.go +6 -1
- package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +6 -1
- package/cmd/ttscgraph/serve.go +22 -20
- package/cmd/ttscgraph/serve_alternative_members_and_reads_refresh_test.go +95 -0
- package/cmd/ttscgraph/serve_shards.go +26 -15
- package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +1 -1
- package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +5 -5
- package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +8 -8
- package/cmd/ttscgraph/serve_source_encoding_test.go +2 -2
- package/driver/build_information_uses_selected_output_identity_test.go +5 -4
- package/driver/check_observations.go +1 -1
- package/driver/config_discovery.go +5 -1
- package/driver/declaration_shape.go +15 -21
- package/driver/diagnostics_preamble.go +2 -2
- package/driver/emit_containment.go +11 -14
- package/driver/emit_plugin.go +51 -43
- package/driver/emit_plugin_output.go +6 -5
- package/driver/emit_provenance.go +12 -15
- package/driver/graph.go +8 -8
- package/driver/host.go +15 -5
- package/driver/input_observation.go +22 -21
- package/driver/input_observation_test.go +11 -10
- package/driver/overlay.go +11 -11
- package/driver/program.go +102 -51
- package/driver/resolution_candidates.go +50 -32
- package/driver/resolution_candidates_test.go +18 -5
- package/driver/rewrite.go +11 -13
- package/driver/session.go +13 -7
- package/driver/target_ts70.go +85 -0
- package/driver/target_ts71.go +97 -0
- package/driver/transform_dependencies.go +1 -1
- package/driver/transform_source_map.go +21 -20
- package/go.mod +3 -3
- package/go.sum +4 -4
- package/internal/graph/alternative_member_declarations_resolve_uses_test.go +145 -0
- package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/build.go +75 -33
- package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +4 -4
- package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +1 -1
- package/internal/graph/declaration_members.go +143 -0
- package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +3 -3
- package/internal/graph/doc_tags.go +2 -2
- package/internal/graph/dump_paths.go +6 -5
- package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +1 -1
- package/internal/graph/edges.go +151 -68
- package/internal/graph/edges_cover_class_level_references_test.go +5 -5
- package/internal/graph/enum_initializer_calls_are_edges_test.go +2 -2
- package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +6 -6
- package/internal/graph/exports.go +6 -6
- package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +2 -2
- package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +1 -1
- package/internal/graph/function_locals_do_not_collide_test.go +3 -3
- package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +5 -5
- package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +2 -2
- package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +3 -3
- package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +3 -3
- package/internal/graph/literals.go +3 -3
- package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +2 -2
- package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +4 -4
- package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +2 -2
- package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +1 -1
- package/internal/graph/literals_resolve_through_alias_indirection_test.go +3 -3
- package/internal/graph/member_relation_edges_follow_checker_validity_test.go +7 -7
- package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +19 -19
- package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +11 -11
- package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +2 -2
- package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +7 -7
- package/internal/graph/namespace_private_declarations_keep_lexical_identity_test.go +85 -0
- package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +2 -2
- package/internal/graph/object_literal_declarations_resolve_calls_test.go +9 -9
- package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +1 -1
- package/internal/graph/overload_implementation_replaces_signature_test.go +2 -2
- package/internal/graph/property_member_edges_remain_owner_visible_test.go +6 -6
- package/internal/graph/resolve.go +37 -12
- package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +6 -6
- package/internal/graph/source.go +1 -1
- package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +7 -7
- package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +2 -2
- package/internal/graph/value_access_edges_cover_properties_test.go +5 -5
- package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +3 -3
- package/internal/graph/value_call_edges_cover_jsx_components_test.go +2 -2
- package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +3 -3
- package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +2 -2
- package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +4 -4
- package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +3 -3
- package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +2 -2
- package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +4 -4
- package/internal/graph/value_reads_cover_expression_positions_test.go +88 -0
- package/lib/compiler/internal/buildNativeCompiler.d.ts +5 -2
- package/lib/compiler/internal/buildNativeCompiler.js +12 -4
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -1
- package/lib/flags/COMPILER_OPTIONS.js +1079 -149
- package/lib/flags/COMPILER_OPTIONS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -1
- package/lib/flags/CompilerOptionSpec.d.ts +9 -2
- package/lib/internal/pluginSource.d.ts +1 -0
- package/lib/internal/pluginSource.js +1 -0
- package/lib/internal/pluginSource.js.map +1 -1
- package/lib/launcher/internal/TypeScriptSyncApi.d.ts +140 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js +99 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootInMemory.d.ts +80 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js +253 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootProject.d.ts +22 -18
- package/lib/launcher/internal/buildSingleRootProject.js +27 -18
- package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
- package/lib/launcher/internal/compilerArgsAsConfigOptions.d.ts +39 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js +115 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js.map +1 -0
- package/lib/plugin/CapabilityPluginResolver.js +3 -0
- package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +6 -2
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/source/CompilerTarget.d.ts +127 -0
- package/lib/plugin/internal/source/CompilerTarget.js +231 -0
- package/lib/plugin/internal/source/CompilerTarget.js.map +1 -0
- package/lib/plugin/internal/source/NativeSourcePackages.js +6 -5
- package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +18 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.js +24 -2
- package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +6 -3
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +31 -13
- package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js +3 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +9 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
- package/package.json +14 -9
- package/shim/ast/enums_gen.go +1 -0
- package/shim/ast/go.mod +2 -2
- package/shim/ast/go.sum +4 -4
- package/shim/ast/neutral.go +141 -0
- package/shim/astnav/go.mod +2 -2
- package/shim/astnav/go.sum +4 -4
- package/shim/bundled/go.mod +2 -2
- package/shim/bundled/go.sum +4 -4
- package/shim/checker/go.mod +2 -2
- package/shim/checker/go.sum +4 -4
- package/shim/compiler/go.mod +2 -2
- package/shim/compiler/go.sum +4 -4
- package/shim/compiler/neutral.go +213 -0
- package/shim/core/go.mod +2 -2
- package/shim/core/go.sum +4 -4
- package/shim/diagnosticwriter/go.mod +2 -2
- package/shim/diagnosticwriter/go.sum +4 -4
- package/shim/lsp/go.mod +2 -2
- package/shim/lsp/go.sum +4 -4
- package/shim/parser/go.mod +2 -2
- package/shim/parser/go.sum +4 -4
- package/shim/printer/go.mod +2 -2
- package/shim/printer/go.sum +4 -4
- package/shim/scanner/go.mod +2 -2
- package/shim/scanner/go.sum +4 -4
- package/shim/stringutil/go.mod +1 -1
- package/shim/stringutil/go.sum +2 -2
- package/shim/stringutil/shim.go +15 -0
- package/shim/transformers/go.mod +2 -2
- package/shim/transformers/go.sum +4 -4
- package/shim/tsoptions/go.mod +2 -2
- package/shim/tsoptions/go.sum +4 -4
- package/shim/tsoptions/neutral.go +56 -0
- package/shim/tspath/go.mod +1 -1
- package/shim/tspath/go.sum +2 -2
- package/shim/tspath/neutral.go +150 -0
- package/shim/tspath/typed_paths.go +266 -0
- package/shim/vfs/cachedvfs/go.mod +2 -2
- package/shim/vfs/cachedvfs/go.sum +4 -4
- package/shim/vfs/go.mod +2 -2
- package/shim/vfs/go.sum +4 -4
- package/shim/vfs/neutral.go +20 -0
- package/shim/vfs/osvfs/go.mod +2 -2
- package/shim/vfs/osvfs/go.sum +4 -4
- package/src/compiler/internal/buildNativeCompiler.ts +13 -4
- package/src/flags/COMPILER_ENUM_WHITESPACE.ts +1 -1
- package/src/flags/COMPILER_OPTIONS.ts +1080 -150
- package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +1 -1
- package/src/flags/COMPILER_OPTION_KINDS.ts +1 -1
- package/src/flags/CompilerOptionSpec.ts +11 -2
- package/src/internal/pluginSource.ts +1 -0
- package/src/launcher/internal/TypeScriptSyncApi.ts +186 -0
- package/src/launcher/internal/buildSingleRootInMemory.ts +319 -0
- package/src/launcher/internal/buildSingleRootProject.ts +26 -18
- package/src/launcher/internal/compilerArgsAsConfigOptions.ts +112 -0
- package/src/plugin/CapabilityPluginResolver.ts +4 -1
- package/src/plugin/internal/load/loadProjectPlugins.ts +12 -2
- package/src/plugin/internal/source/CompilerTarget.ts +249 -0
- package/src/plugin/internal/source/NativeSourcePackages.ts +10 -4
- package/src/plugin/internal/source/SourcePluginAdmission.ts +28 -2
- package/src/plugin/internal/source/SourcePluginWorkspace.ts +45 -19
- package/src/plugin/internal/source/buildSourcePlugin.ts +3 -1
- package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +9 -1
- package/targets/7.1/bridge/ast/enums_gen.go +174 -0
- package/targets/7.1/bridge/ast/extra-shim.json +4 -0
- package/targets/7.1/bridge/ast/go.mod +14 -0
- package/targets/7.1/bridge/ast/go.sum +20 -0
- package/targets/7.1/bridge/ast/lint.go +1412 -0
- package/targets/7.1/bridge/ast/neutral.go +141 -0
- package/targets/7.1/bridge/ast/parent.go +60 -0
- package/targets/7.1/bridge/ast/safe_text.go +108 -0
- package/targets/7.1/bridge/ast/shim.go +1656 -0
- package/targets/7.1/bridge/ast/surface.go +686 -0
- package/targets/7.1/bridge/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_multi_hop_qualified_name_test.go +47 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_one_hop_qualified_name_test.go +35 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_empty_for_nil_test.go +31 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_identifier_text_test.go +34 -0
- package/targets/7.1/bridge/ast/test/node_text_skips_empty_qualified_left_test.go +60 -0
- package/targets/7.1/bridge/astnav/go.mod +14 -0
- package/targets/7.1/bridge/astnav/go.sum +22 -0
- package/targets/7.1/bridge/astnav/shim.go +24 -0
- package/targets/7.1/bridge/bundled/extra-shim.json +1 -0
- package/targets/7.1/bridge/bundled/go.mod +10 -0
- package/targets/7.1/bridge/bundled/go.sum +10 -0
- package/targets/7.1/bridge/bundled/shim.go +24 -0
- package/targets/7.1/bridge/checker/enums_gen.go +150 -0
- package/targets/7.1/bridge/checker/extra-shim.json +37 -0
- package/targets/7.1/bridge/checker/go.mod +15 -0
- package/targets/7.1/bridge/checker/go.sum +24 -0
- package/targets/7.1/bridge/checker/node_builder_fields_gen.go +19 -0
- package/targets/7.1/bridge/checker/shim.go +1390 -0
- package/targets/7.1/bridge/compiler/contentmapper_process.go +70 -0
- package/targets/7.1/bridge/compiler/emit_sourcemap.go +296 -0
- package/targets/7.1/bridge/compiler/emitassemble.go +81 -0
- package/targets/7.1/bridge/compiler/emithook.go +44 -0
- package/targets/7.1/bridge/compiler/extra-shim.json +4 -0
- package/targets/7.1/bridge/compiler/go.mod +15 -0
- package/targets/7.1/bridge/compiler/go.sum +24 -0
- package/targets/7.1/bridge/compiler/incremental.go +185 -0
- package/targets/7.1/bridge/compiler/neutral.go +256 -0
- package/targets/7.1/bridge/compiler/resolution.go +571 -0
- package/targets/7.1/bridge/compiler/shim.go +70 -0
- package/targets/7.1/bridge/core/enums_gen.go +15 -0
- package/targets/7.1/bridge/core/extra-shim.json +4 -0
- package/targets/7.1/bridge/core/go.mod +7 -0
- package/targets/7.1/bridge/core/go.sum +8 -0
- package/targets/7.1/bridge/core/modulekind.go +19 -0
- package/targets/7.1/bridge/core/shim.go +272 -0
- package/targets/7.1/bridge/diagnosticwriter/go.mod +14 -0
- package/targets/7.1/bridge/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/bridge/diagnosticwriter/lint.go +411 -0
- package/targets/7.1/bridge/diagnosticwriter/shim.go +56 -0
- package/targets/7.1/bridge/lsp/extra-shim.json +4 -0
- package/targets/7.1/bridge/lsp/go.mod +16 -0
- package/targets/7.1/bridge/lsp/go.sum +26 -0
- package/targets/7.1/bridge/lsp/shim.go +112 -0
- package/targets/7.1/bridge/parser/extra-shim.json +4 -0
- package/targets/7.1/bridge/parser/go.mod +14 -0
- package/targets/7.1/bridge/parser/go.sum +24 -0
- package/targets/7.1/bridge/parser/shim.go +61 -0
- package/targets/7.1/bridge/printer/emithost.go +69 -0
- package/targets/7.1/bridge/printer/go.mod +15 -0
- package/targets/7.1/bridge/printer/go.sum +24 -0
- package/targets/7.1/bridge/printer/shim.go +168 -0
- package/targets/7.1/bridge/printer/sourcemap.go +49 -0
- package/targets/7.1/bridge/scanner/extra-shim.json +4 -0
- package/targets/7.1/bridge/scanner/go.mod +14 -0
- package/targets/7.1/bridge/scanner/go.sum +20 -0
- package/targets/7.1/bridge/scanner/regexp.go +42 -0
- package/targets/7.1/bridge/scanner/shim.go +137 -0
- package/targets/7.1/bridge/stringutil/extra-shim.json +1 -0
- package/targets/7.1/bridge/stringutil/go.mod +5 -0
- package/targets/7.1/bridge/stringutil/go.sum +2 -0
- package/targets/7.1/bridge/stringutil/shim.go +131 -0
- package/targets/7.1/bridge/transformers/go.mod +15 -0
- package/targets/7.1/bridge/transformers/go.sum +24 -0
- package/targets/7.1/bridge/transformers/shim.go +24 -0
- package/targets/7.1/bridge/tsoptions/command_line_raw.go +44 -0
- package/targets/7.1/bridge/tsoptions/extra-shim.json +4 -0
- package/targets/7.1/bridge/tsoptions/go.mod +15 -0
- package/targets/7.1/bridge/tsoptions/go.sum +24 -0
- package/targets/7.1/bridge/tsoptions/neutral.go +47 -0
- package/targets/7.1/bridge/tsoptions/shim.go +193 -0
- package/targets/7.1/bridge/tspath/extra-shim.json +4 -0
- package/targets/7.1/bridge/tspath/go.mod +5 -0
- package/targets/7.1/bridge/tspath/go.sum +6 -0
- package/targets/7.1/bridge/tspath/neutral.go +142 -0
- package/targets/7.1/bridge/tspath/shim.go +382 -0
- package/targets/7.1/bridge/vfs/cachedvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.mod +5 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/cachedvfs/shim.go +12 -0
- package/targets/7.1/bridge/vfs/decode.go +26 -0
- package/targets/7.1/bridge/vfs/decode_test.go +42 -0
- package/targets/7.1/bridge/vfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/neutral.go +23 -0
- package/targets/7.1/bridge/vfs/osvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/osvfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/osvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/osvfs/shim.go +14 -0
- package/targets/7.1/bridge/vfs/shim.go +27 -0
- package/targets/7.1/facade/ast/facade_gen.go +2691 -0
- package/targets/7.1/facade/ast/go.mod +20 -0
- package/targets/7.1/facade/ast/go.sum +20 -0
- package/targets/7.1/facade/astnav/facade_gen.go +15 -0
- package/targets/7.1/facade/astnav/go.mod +22 -0
- package/targets/7.1/facade/astnav/go.sum +22 -0
- package/targets/7.1/facade/bundled/facade_gen.go +32 -0
- package/targets/7.1/facade/bundled/go.mod +21 -0
- package/targets/7.1/facade/bundled/go.sum +10 -0
- package/targets/7.1/facade/checker/facade_gen.go +563 -0
- package/targets/7.1/facade/checker/go.mod +26 -0
- package/targets/7.1/facade/checker/go.sum +24 -0
- package/targets/7.1/facade/compiler/facade_gen.go +198 -0
- package/targets/7.1/facade/compiler/go.mod +41 -0
- package/targets/7.1/facade/compiler/go.sum +24 -0
- package/targets/7.1/facade/core/facade_gen.go +130 -0
- package/targets/7.1/facade/core/go.mod +12 -0
- package/targets/7.1/facade/core/go.sum +8 -0
- package/targets/7.1/facade/diagnosticwriter/facade_gen.go +36 -0
- package/targets/7.1/facade/diagnosticwriter/go.mod +22 -0
- package/targets/7.1/facade/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/facade/lsp/facade_gen.go +31 -0
- package/targets/7.1/facade/lsp/go.mod +19 -0
- package/targets/7.1/facade/lsp/go.sum +26 -0
- package/targets/7.1/facade/parser/facade_gen.go +102 -0
- package/targets/7.1/facade/parser/go.mod +25 -0
- package/targets/7.1/facade/parser/go.sum +24 -0
- package/targets/7.1/facade/printer/facade_gen.go +74 -0
- package/targets/7.1/facade/printer/go.mod +26 -0
- package/targets/7.1/facade/printer/go.sum +24 -0
- package/targets/7.1/facade/scanner/facade_gen.go +191 -0
- package/targets/7.1/facade/scanner/go.mod +25 -0
- package/targets/7.1/facade/scanner/go.sum +20 -0
- package/targets/7.1/facade/stringutil/facade_gen.go +176 -0
- package/targets/7.1/facade/stringutil/go.mod +9 -0
- package/targets/7.1/facade/stringutil/go.sum +2 -0
- package/targets/7.1/facade/transformers/facade_gen.go +12 -0
- package/targets/7.1/facade/transformers/go.mod +18 -0
- package/targets/7.1/facade/transformers/go.sum +24 -0
- package/targets/7.1/facade/tsoptions/facade_gen.go +274 -0
- package/targets/7.1/facade/tsoptions/go.mod +32 -0
- package/targets/7.1/facade/tsoptions/go.sum +24 -0
- package/targets/7.1/facade/tspath/facade_gen.go +550 -0
- package/targets/7.1/facade/tspath/go.mod +9 -0
- package/targets/7.1/facade/tspath/go.sum +6 -0
- package/targets/7.1/facade/vfs/cachedvfs/facade_gen.go +17 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/facade_gen.go +47 -0
- package/targets/7.1/facade/vfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/osvfs/facade_gen.go +20 -0
- package/targets/7.1/facade/vfs/osvfs/go.mod +21 -0
- package/targets/7.1/facade/vfs/osvfs/go.sum +10 -0
- package/tools/gen_facade/committed_facades_match_their_bridges_test.go +57 -0
- package/tools/gen_facade/facade_manifest_points_into_the_bridge_root_test.go +75 -0
- package/tools/gen_facade/facade_spells_internal_types_through_bridge_aliases_test.go +75 -0
- package/tools/gen_facade/facade_types_are_their_bridge_types_test.go +99 -0
- package/tools/gen_facade/go.mod +10 -0
- package/tools/gen_facade/go.sum +8 -0
- package/tools/gen_facade/main.go +734 -0
- package/tools/gen_shims/go.mod +4 -4
- package/tools/gen_shims/go.sum +6 -6
- package/tools/gen_shims/main.go +124 -66
- package/tools/gen_shims/mirror_structs_terminate_on_unexported_cycles_test.go +101 -0
- package/tools/shim_audit/baseline-7.1.json +720 -0
- package/tools/shim_audit/baseline.json +5 -4
- package/tools/shim_audit/go.mod +4 -4
- package/tools/shim_audit/go.sum +6 -6
- package/tools/shim_audit/linkname_signatures.go +178 -0
- package/tools/shim_audit/linkname_signatures_match_their_targets_test.go +64 -0
- package/tools/shim_audit/linkname_targets_follow_the_audited_compiler_test.go +38 -0
- package/tools/shim_audit/main.go +29 -4
- package/tools/shim_audit/neutral_api.go +160 -0
- package/tools/shim_audit/neutral_api_must_match_across_targets_test.go +74 -0
- package/utility/host.go +5 -4
- package/utility/preamble_output.go +15 -15
- package/utility/serve.go +1 -1
package/driver/overlay.go
CHANGED
|
@@ -22,8 +22,8 @@ import (
|
|
|
22
22
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
23
23
|
type OverlayFS struct {
|
|
24
24
|
vfs.FS
|
|
25
|
-
|
|
26
|
-
overrides
|
|
25
|
+
caseSensitivity shimtspath.CaseSensitivity
|
|
26
|
+
overrides map[string]string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// NewOverlayFS returns an overlay over inner with no overrides set.
|
|
@@ -32,15 +32,15 @@ type OverlayFS struct {
|
|
|
32
32
|
// @evidence contracts/common.md#clear-and-simple-design Construction initializes one map and captures the inner VFS in one owner.
|
|
33
33
|
// @evidence contracts/common.md#prohibited-implementation-shortcuts Construction does not alter the inner object or inject sample file contents.
|
|
34
34
|
// @evidence contracts/common.md#meaningful-documentation Native prose states the initially empty overlay following the documentation skill.
|
|
35
|
-
// @evidence contracts/portability.md#os-neutral-implementation Construction captures inner.
|
|
35
|
+
// @evidence contracts/portability.md#os-neutral-implementation Construction captures inner.CaseSensitivity as its canonicalization policy; it performs no independent per-directory capability or physical-alias probe.
|
|
36
36
|
// @evidence contracts/performance.md#bound-retention-and-release-resources The returned overlay keeps inner reachable and owns a fresh override map. Later distinct keys and content bytes have no configured cap or eviction; callers remove entries with Unset or release the overlay. Inner handles and caches remain owned by the supplied filesystem.
|
|
37
37
|
// @evidence contracts/performance.md#efficient-algorithms Construction allocates one empty map and wrapper and queries the inner case policy once, without scanning source files or override populations. Any work performed by that supplied policy query belongs to this delegated call, not a universal constant-time guarantee.
|
|
38
38
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work Each construction intentionally creates independent mutable override state; the function owns no cross-overlay sharing coordinator or cached constructor result.
|
|
39
39
|
func NewOverlayFS(inner vfs.FS) *OverlayFS {
|
|
40
40
|
return &OverlayFS{
|
|
41
|
-
FS:
|
|
42
|
-
|
|
43
|
-
overrides:
|
|
41
|
+
FS: inner,
|
|
42
|
+
caseSensitivity: vfs.CaseSensitivityOf(inner),
|
|
43
|
+
overrides: map[string]string{},
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ func NewOverlayFS(inner vfs.FS) *OverlayFS {
|
|
|
48
48
|
// It does not anchor relative paths to the compiler cwd or resolve physical
|
|
49
49
|
// aliases; callers must use compatible spellings when registering and reading.
|
|
50
50
|
func (o *OverlayFS) key(path string) string {
|
|
51
|
-
return shimtspath.
|
|
51
|
+
return shimtspath.Canonicalize(o.caseSensitivity, shimtspath.NormalizePath(path))
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// Set records an in-memory override for path.
|
|
@@ -106,8 +106,8 @@ func (o *OverlayFS) Unset(path string) {
|
|
|
106
106
|
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The wrapper adds no read cache or native handle ownership. Override strings remain owned by the overlay and caller; fallback temporary resources and retained read state belong to the supplied inner filesystem, not this adapter's release policy.
|
|
107
107
|
// @evidence contracts/performance.md#efficient-algorithms Lookup processes path normalization/case/hash bytes before testing the override map. A hit returns stored text without scanning it; a miss adds the inner read's actual path, input-byte and decoding/cache costs, which are not universally fixed steps.
|
|
108
108
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The wrapper adds no completed/in-flight read coordinator or independent disk-content cache; inner reuse remains the supplied filesystem's policy.
|
|
109
|
-
func (o *OverlayFS) ReadFile(path
|
|
110
|
-
if content, ok := o.overrides[o.key(path)]; ok {
|
|
109
|
+
func (o *OverlayFS) ReadFile(path shimtspath.RootedFilePath) (string, bool) {
|
|
110
|
+
if content, ok := o.overrides[o.key(string(path))]; ok {
|
|
111
111
|
return content, true
|
|
112
112
|
}
|
|
113
113
|
return o.FS.ReadFile(path)
|
|
@@ -123,8 +123,8 @@ func (o *OverlayFS) ReadFile(path string) (string, bool) {
|
|
|
123
123
|
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The wrapper retains no new entries or native handles during the query. Existing overrides remain overlay-owned; any temporary handles or metadata caches populated by fallback belong to the supplied inner filesystem.
|
|
124
124
|
// @evidence contracts/performance.md#efficient-algorithms Key normalization/case conversion and hashing process path bytes before one override lookup. Hits require no native query; misses add the supplied filesystem's existence-probe or metadata-cache work rather than a universal fixed cost.
|
|
125
125
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work This wrapper owns no existence-query sharing coordinator or separate metadata cache; it reads current overrides and delegates inner reuse policy.
|
|
126
|
-
func (o *OverlayFS) FileExists(path
|
|
127
|
-
if _, ok := o.overrides[o.key(path)]; ok {
|
|
126
|
+
func (o *OverlayFS) FileExists(path shimtspath.RootedFilePath) bool {
|
|
127
|
+
if _, ok := o.overrides[o.key(string(path))]; ok {
|
|
128
128
|
return true
|
|
129
129
|
}
|
|
130
130
|
return o.FS.FileExists(path)
|
package/driver/program.go
CHANGED
|
@@ -150,7 +150,7 @@ func NewLintDiagnostic(
|
|
|
150
150
|
}
|
|
151
151
|
if file != nil {
|
|
152
152
|
pos = lint.Pos()
|
|
153
|
-
d.File = file.FileName()
|
|
153
|
+
d.File = string(file.FileName())
|
|
154
154
|
length := lint.Len()
|
|
155
155
|
d.Start = &pos
|
|
156
156
|
d.Length = &length
|
|
@@ -186,7 +186,10 @@ func (p *Program) SourceFile(filename string) *ast.SourceFile {
|
|
|
186
186
|
// for an apply failure, and growing one would ripple through every caller.
|
|
187
187
|
// `Diagnostics` reports it, and the emit path checks the error directly.
|
|
188
188
|
_ = p.ApplyLinkedPlugins()
|
|
189
|
-
|
|
189
|
+
if filename == "" {
|
|
190
|
+
return nil
|
|
191
|
+
}
|
|
192
|
+
return p.TSProgram.GetSourceFile(tspath.ToRootedFilePath(filename, p.TSProgram.GetCurrentDirectory()))
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
// String returns message alone without File, file/message without a positive
|
|
@@ -318,6 +321,9 @@ type Program struct {
|
|
|
318
321
|
|
|
319
322
|
// Host is the compiler host for this generation.
|
|
320
323
|
Host shimcompiler.CompilerHost
|
|
324
|
+
// hosts builds every generation's Host and owns the content-mapper processes
|
|
325
|
+
// those hosts share; Close releases it.
|
|
326
|
+
hosts *shimcompiler.ProjectHosts
|
|
321
327
|
|
|
322
328
|
// FS is the input-observing filesystem, including any source preamble layer.
|
|
323
329
|
FS vfs.FS
|
|
@@ -390,22 +396,26 @@ type LoadProgramOptions struct {
|
|
|
390
396
|
FS vfs.FS
|
|
391
397
|
}
|
|
392
398
|
|
|
393
|
-
// Close releases the checker pool lease acquired by LoadProgram
|
|
399
|
+
// Close releases the checker pool lease acquired by LoadProgram and, on the
|
|
400
|
+
// TypeScript 7.1 target, stops the project's content-mapper processes. Its
|
|
401
|
+
// error is the content mappers' close error.
|
|
394
402
|
//
|
|
395
|
-
// @evidence contracts/common.md#principled-implementation The recorded release callback returns the checker lease once and is cleared after release.
|
|
396
|
-
// @evidence contracts/common.md#clear-and-simple-design Checker ownership
|
|
397
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts Cleanup invokes the owned
|
|
398
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose names the lease
|
|
399
|
-
// @
|
|
400
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms Releasing
|
|
401
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work
|
|
402
|
-
// @evidence contracts/performance.md#bound-retention-and-release-resources Program owns one checker lease
|
|
403
|
+
// @evidence contracts/common.md#principled-implementation The recorded release callback returns the checker lease once and is cleared after release; the project hosts then close the mapper project and processes the Program's hosts shared.
|
|
404
|
+
// @evidence contracts/common.md#clear-and-simple-design Checker and content-mapper ownership share one cleanup operation instead of independent releases by each consumer.
|
|
405
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts Cleanup invokes the owned callbacks rather than patching the checker pool, and returns the mapper close error instead of fabricating success.
|
|
406
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the lease and the mapper processes released and the error returned, following the documentation skill.
|
|
407
|
+
// @evidence contracts/portability.md#os-neutral-implementation Checker release is in-process; stopping a mapper process goes through the shim's os/exec boundary.
|
|
408
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms Releasing two recorded owners involves no input-processing algorithm.
|
|
409
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work Cleanup does not determine whether compiler outputs may be reused.
|
|
410
|
+
// @evidence contracts/performance.md#bound-retention-and-release-resources Program owns one checker lease and its project hosts; Close clears both, so repeated Close releases neither twice, and leaves facade memory lifetime to the caller.
|
|
403
411
|
func (p *Program) Close() error {
|
|
404
412
|
if p.checkerRelease != nil {
|
|
405
413
|
p.checkerRelease()
|
|
406
414
|
p.checkerRelease = nil
|
|
407
415
|
}
|
|
408
|
-
|
|
416
|
+
hosts := p.hosts
|
|
417
|
+
p.hosts = nil
|
|
418
|
+
return hosts.Close()
|
|
409
419
|
}
|
|
410
420
|
|
|
411
421
|
// ParseTSConfig parses a tsconfig.json file via tsgo's native JSONC parser.
|
|
@@ -443,14 +453,21 @@ func ParseTSConfig(fs vfs.FS, cwd, tsconfigPath string, host shimcompiler.Compil
|
|
|
443
453
|
// config's own location survives. ttsc forwards exactly these resets to keep a
|
|
444
454
|
// private build's outputs in one directory (`isolatedTsgoOutputArgs`).
|
|
445
455
|
func parseTSConfig(fs vfs.FS, cwd, tsconfigPath string, host shimcompiler.CompilerHost, cliOptions *core.CompilerOptions, commandLine *tsoptions.ParsedCommandLine) (*tsoptions.ParsedCommandLine, []Diagnostic, error) {
|
|
446
|
-
|
|
456
|
+
directory, err := rootedWorkingDirectory(cwd)
|
|
457
|
+
if err != nil {
|
|
458
|
+
return nil, nil, err
|
|
459
|
+
}
|
|
460
|
+
if tsconfigPath == "" {
|
|
461
|
+
return nil, nil, fmt.Errorf("tsconfig not found: %s", string(directory))
|
|
462
|
+
}
|
|
463
|
+
resolved := tspath.ToRootedFilePath(tsconfigPath, directory)
|
|
447
464
|
if !fs.FileExists(resolved) {
|
|
448
|
-
return nil, nil, fmt.Errorf("tsconfig not found: %s", resolved)
|
|
465
|
+
return nil, nil, fmt.Errorf("tsconfig not found: %s", string(resolved))
|
|
449
466
|
}
|
|
450
467
|
if cliOptions == nil {
|
|
451
468
|
cliOptions = &core.CompilerOptions{}
|
|
452
469
|
}
|
|
453
|
-
parsed, diags := tsoptions.GetParsedCommandLineOfConfigFile(resolved, cliOptions, tsoptions.CommandLineRawOptions(commandLine), host, nil)
|
|
470
|
+
parsed, diags := tsoptions.GetParsedCommandLineOfConfigFile(resolved, cliOptions, tsoptions.CommandLineRawOptions(commandLine), tsoptions.NewParseConfigHost(host.FS(), directory), nil)
|
|
454
471
|
allDiags := diags
|
|
455
472
|
if parsed != nil {
|
|
456
473
|
// Read failures are returned separately; recoverable JSON syntax errors
|
|
@@ -486,11 +503,11 @@ func resolveTsgoArgs(explicit []string) ([]string, error) {
|
|
|
486
503
|
// constructs its Program in-process rather than shelling out to `tsgo` — still
|
|
487
504
|
// honors flags like `ttsc --strict`. Returns (nil, nil, nil) when there are no
|
|
488
505
|
// forwarded flags.
|
|
489
|
-
func parseTsgoArgs(args []string, host shimcompiler.CompilerHost) (*tsoptions.ParsedCommandLine, []Diagnostic, error) {
|
|
506
|
+
func parseTsgoArgs(args []string, host shimcompiler.CompilerHost, cwd tspath.RootedDirectoryPath) (*tsoptions.ParsedCommandLine, []Diagnostic, error) {
|
|
490
507
|
if len(args) == 0 {
|
|
491
508
|
return nil, nil, nil
|
|
492
509
|
}
|
|
493
|
-
cli := tsoptions.
|
|
510
|
+
cli := tsoptions.ParseCommandLineAt(args, host.FS(), cwd)
|
|
494
511
|
if cli == nil {
|
|
495
512
|
return nil, nil, fmt.Errorf("driver: tsgo argument parser returned nil")
|
|
496
513
|
}
|
|
@@ -531,11 +548,7 @@ func CreateProgramFromConfig(parsed *tsoptions.ParsedCommandLine, host shimcompi
|
|
|
531
548
|
return nil, nil, fmt.Errorf("driver: nil parsed command line")
|
|
532
549
|
}
|
|
533
550
|
forceSingleChecker(parsed)
|
|
534
|
-
opts := shimcompiler.
|
|
535
|
-
Config: parsed,
|
|
536
|
-
Host: host,
|
|
537
|
-
UseSourceOfProjectReference: true,
|
|
538
|
-
}
|
|
551
|
+
opts := shimcompiler.NewProgramOptions(parsed, host, true)
|
|
539
552
|
p := shimcompiler.NewProgram(opts)
|
|
540
553
|
if p != nil {
|
|
541
554
|
e2etrace.Program("program-construction", "driver-create", "constructor-returned", false, p)
|
|
@@ -583,6 +596,10 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
583
596
|
}
|
|
584
597
|
}
|
|
585
598
|
cwd = tspath.ResolvePath(cwd)
|
|
599
|
+
directory, err := rootedWorkingDirectory(cwd)
|
|
600
|
+
if err != nil {
|
|
601
|
+
return nil, nil, err
|
|
602
|
+
}
|
|
586
603
|
pluginState, err := loadLinkedPluginState(cwd, tsconfigPath)
|
|
587
604
|
if err != nil {
|
|
588
605
|
return nil, nil, err
|
|
@@ -616,14 +633,13 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
616
633
|
if argumentCwd == "" && options.TsgoArgs == nil && len(tsgoArgs) != 0 {
|
|
617
634
|
argumentCwd = os.Getenv(TsgoArgsCwdEnv)
|
|
618
635
|
}
|
|
619
|
-
|
|
636
|
+
// Forwarded flags convert relative values against their own argv base; the
|
|
637
|
+
// host is cwd-less, so only the parser's directory changes.
|
|
638
|
+
argumentDirectory := directory
|
|
620
639
|
if argumentCwd != "" {
|
|
621
|
-
|
|
622
|
-
if argumentCwd != cwd {
|
|
623
|
-
argumentHost = DefaultHost(argumentCwd, fs)
|
|
624
|
-
}
|
|
640
|
+
argumentDirectory = tspath.ToRootedDirectoryPath(argumentCwd, directory)
|
|
625
641
|
}
|
|
626
|
-
commandLine, cliDiags, err := parseTsgoArgs(tsgoArgs,
|
|
642
|
+
commandLine, cliDiags, err := parseTsgoArgs(tsgoArgs, host, argumentDirectory)
|
|
627
643
|
if err != nil {
|
|
628
644
|
return nil, nil, err
|
|
629
645
|
}
|
|
@@ -633,16 +649,24 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
633
649
|
|
|
634
650
|
// Config identity is explicit; argument conversion uses the original argv
|
|
635
651
|
// base, while the Program and linked plugin state retain their selected cwd.
|
|
636
|
-
|
|
637
|
-
|
|
652
|
+
semanticConfig, err := semanticConfigFile(options.SemanticConfigPath)
|
|
653
|
+
if err != nil {
|
|
654
|
+
return nil, nil, err
|
|
655
|
+
}
|
|
656
|
+
parsed, diags, err := parseTSConfig(fs, cwd, tsconfigPath, host, commandLine.CompilerOptions(), commandLine)
|
|
638
657
|
if err != nil {
|
|
639
658
|
return nil, nil, err
|
|
640
659
|
}
|
|
641
660
|
if len(diags) > 0 {
|
|
642
661
|
return nil, diags, nil
|
|
643
662
|
}
|
|
644
|
-
if
|
|
645
|
-
|
|
663
|
+
if semanticConfig != "" {
|
|
664
|
+
if parsed, diags, err = parseSemanticConfig(fs, cwd, semanticConfig, host, parsed, commandLine); err != nil {
|
|
665
|
+
return nil, nil, err
|
|
666
|
+
}
|
|
667
|
+
if len(diags) > 0 {
|
|
668
|
+
return nil, diags, nil
|
|
669
|
+
}
|
|
646
670
|
}
|
|
647
671
|
if options.ForceNoEmit {
|
|
648
672
|
forceNoEmit(parsed)
|
|
@@ -651,10 +675,14 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
651
675
|
forceEmit(parsed)
|
|
652
676
|
}
|
|
653
677
|
if options.OutDir != "" {
|
|
654
|
-
overrideOutDir(
|
|
678
|
+
overrideOutDir(directory, parsed, options.OutDir)
|
|
655
679
|
}
|
|
656
680
|
applyThreadingOptions(parsed, options.SingleThreaded, options.Checkers)
|
|
657
681
|
|
|
682
|
+
// The parsed project decides whether its content mappers run, so the
|
|
683
|
+
// Program's host is built only now, over the same filesystem.
|
|
684
|
+
hosts := shimcompiler.NewProjectHosts(parsed)
|
|
685
|
+
host = projectHost(hosts, cwd, fs)
|
|
658
686
|
tsProgram, _, _ := CreateProgramFromConfig(parsed, host)
|
|
659
687
|
|
|
660
688
|
checker, done := tsProgram.GetTypeChecker(context.Background())
|
|
@@ -664,6 +692,7 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
664
692
|
Checker: checker,
|
|
665
693
|
checkerRelease: done,
|
|
666
694
|
Host: host,
|
|
695
|
+
hosts: hosts,
|
|
667
696
|
FS: fs,
|
|
668
697
|
inputObserver: inputObserver,
|
|
669
698
|
SourcePreamble: options.SourcePreamble,
|
|
@@ -673,16 +702,34 @@ func LoadProgram(cwd, tsconfigPath string, options LoadProgramOptions) (*Program
|
|
|
673
702
|
return prog, nil, nil
|
|
674
703
|
}
|
|
675
704
|
|
|
676
|
-
|
|
705
|
+
// parseSemanticConfig makes the user-authored config the parsed project. A
|
|
706
|
+
// generated wrapper extends it from a scratch directory to add a compiler
|
|
707
|
+
// option overlay; TypeScript-Go anchors resolution, automatic type discovery
|
|
708
|
+
// and the Program's current directory at the directory of the config file it
|
|
709
|
+
// parsed, so the wrapper itself must not become the project. The wrapper's
|
|
710
|
+
// merged options, which already carry the user config's own options, the
|
|
711
|
+
// overlay and the command line, take command-line precedence over a fresh
|
|
712
|
+
// parse of the user config; the command line's raw options keep its resets.
|
|
713
|
+
func parseSemanticConfig(fs vfs.FS, cwd string, semanticConfig tspath.RootedFilePath, host shimcompiler.CompilerHost, wrapper *tsoptions.ParsedCommandLine, commandLine *tsoptions.ParsedCommandLine) (*tsoptions.ParsedCommandLine, []Diagnostic, error) {
|
|
714
|
+
caseSensitivity := vfs.CaseSensitivityOf(fs)
|
|
715
|
+
wrapperConfig := wrapper.CompilerOptions().ConfigFilePath
|
|
716
|
+
if wrapperConfig != "" && tspath.CompareFilePaths(caseSensitivity, wrapperConfig, semanticConfig) == 0 {
|
|
717
|
+
return wrapper, nil, nil
|
|
718
|
+
}
|
|
719
|
+
return parseTSConfig(fs, cwd, string(semanticConfig), host, wrapper.CompilerOptions().Clone(), commandLine)
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// semanticConfigFile validates the user-authored config a generated wrapper
|
|
723
|
+
// stands for; an empty path means the parsed config is its own semantic owner.
|
|
724
|
+
func semanticConfigFile(semanticConfigPath string) (tspath.RootedFilePath, error) {
|
|
677
725
|
configured := strings.TrimSpace(semanticConfigPath)
|
|
678
726
|
if configured == "" {
|
|
679
|
-
return nil
|
|
727
|
+
return "", nil
|
|
680
728
|
}
|
|
681
729
|
if !filepath.IsAbs(configured) {
|
|
682
|
-
return fmt.Errorf("driver: semantic config path must be absolute: %s", configured)
|
|
730
|
+
return "", fmt.Errorf("driver: semantic config path must be absolute: %s", configured)
|
|
683
731
|
}
|
|
684
|
-
|
|
685
|
-
return nil
|
|
732
|
+
return tspath.RootedFilePathFromAbsolute(configured), nil
|
|
686
733
|
}
|
|
687
734
|
|
|
688
735
|
// forceEmit clears noEmit and emitDeclarationOnly so the program always
|
|
@@ -700,8 +747,19 @@ func forceNoEmit(parsed *tsoptions.ParsedCommandLine) {
|
|
|
700
747
|
|
|
701
748
|
// overrideOutDir resolves outDir against cwd and applies it to the parsed
|
|
702
749
|
// config, replacing any outDir already set in tsconfig.json.
|
|
703
|
-
func overrideOutDir(cwd
|
|
704
|
-
parsed.ParsedConfig.CompilerOptions.OutDir = tspath.
|
|
750
|
+
func overrideOutDir(cwd tspath.RootedDirectoryPath, parsed *tsoptions.ParsedCommandLine, outDir string) {
|
|
751
|
+
parsed.ParsedConfig.CompilerOptions.OutDir = tspath.ToRootedDirectoryPath(outDir, cwd)
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// rootedWorkingDirectory converts the caller's working directory to the
|
|
755
|
+
// rooted directory the compiler's command-line and tsconfig parsers resolve
|
|
756
|
+
// against. A relative or empty directory has no such anchor and is an error.
|
|
757
|
+
func rootedWorkingDirectory(cwd string) (tspath.RootedDirectoryPath, error) {
|
|
758
|
+
path, ok := tspath.TryRootedPathFromAbsolute(cwd)
|
|
759
|
+
if !ok {
|
|
760
|
+
return "", fmt.Errorf("driver: working directory must be absolute: %q", cwd)
|
|
761
|
+
}
|
|
762
|
+
return tspath.RootedDirectoryPathFromPath(path), nil
|
|
705
763
|
}
|
|
706
764
|
|
|
707
765
|
// applyThreadingOptions forwards the CLI threading knobs onto the parsed
|
|
@@ -734,12 +792,12 @@ type sourcePreambleFS struct {
|
|
|
734
792
|
preamble string
|
|
735
793
|
}
|
|
736
794
|
|
|
737
|
-
func (fs sourcePreambleFS) ReadFile(filePath
|
|
795
|
+
func (fs sourcePreambleFS) ReadFile(filePath tspath.RootedFilePath) (string, bool) {
|
|
738
796
|
contents, ok := fs.FS.ReadFile(filePath)
|
|
739
797
|
if !ok {
|
|
740
798
|
return contents, ok
|
|
741
799
|
}
|
|
742
|
-
return ApplySourcePreambleToFile(filePath, contents, fs.preamble), true
|
|
800
|
+
return ApplySourcePreambleToFile(string(filePath), contents, fs.preamble), true
|
|
743
801
|
}
|
|
744
802
|
|
|
745
803
|
// isSourcePreambleTarget reports whether the preamble should be injected into
|
|
@@ -1062,14 +1120,7 @@ func (p *Program) diagnostics(files []*ast.SourceFile) []Diagnostic {
|
|
|
1062
1120
|
)
|
|
1063
1121
|
} else {
|
|
1064
1122
|
for _, file := range files {
|
|
1065
|
-
raw = append(raw,
|
|
1066
|
-
ctx,
|
|
1067
|
-
p.TSProgram,
|
|
1068
|
-
file,
|
|
1069
|
-
false,
|
|
1070
|
-
p.TSProgram.GetBindDiagnostics,
|
|
1071
|
-
p.TSProgram.GetSemanticDiagnostics,
|
|
1072
|
-
)...)
|
|
1123
|
+
raw = append(raw, fileDiagnostics(ctx, p.TSProgram, file)...)
|
|
1073
1124
|
}
|
|
1074
1125
|
}
|
|
1075
1126
|
raw = filterDiagnostics(raw)
|
|
@@ -1142,7 +1193,7 @@ func convertDiagnostics(in []*ast.Diagnostic) []Diagnostic {
|
|
|
1142
1193
|
func convertDiagnostic(d *ast.Diagnostic) Diagnostic {
|
|
1143
1194
|
diag := Diagnostic{Code: d.Code(), Message: d.String(), raw: d}
|
|
1144
1195
|
if file := d.File(); file != nil {
|
|
1145
|
-
diag.File = file.FileName()
|
|
1196
|
+
diag.File = string(file.FileName())
|
|
1146
1197
|
if pos := d.Pos(); pos >= 0 {
|
|
1147
1198
|
length := d.Len()
|
|
1148
1199
|
diag.Start = &pos
|
|
@@ -4,9 +4,11 @@ import (
|
|
|
4
4
|
"sort"
|
|
5
5
|
"strings"
|
|
6
6
|
|
|
7
|
+
"github.com/microsoft/typescript-go/shim/ast"
|
|
7
8
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
8
9
|
shimtsoptions "github.com/microsoft/typescript-go/shim/tsoptions"
|
|
9
10
|
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
11
|
+
shimvfs "github.com/microsoft/typescript-go/shim/vfs"
|
|
10
12
|
)
|
|
11
13
|
|
|
12
14
|
// ProgramResolutionInput is one reported lexical filesystem input from
|
|
@@ -93,7 +95,7 @@ func ObserveProgramResolutions(prog *Program, cwd string) ProgramResolutionObser
|
|
|
93
95
|
if prog == nil || prog.TSProgram == nil || prog.FS == nil || prog.inputObserver == nil {
|
|
94
96
|
return output
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
caseSensitivity := shimvfs.CaseSensitivityOf(prog.FS)
|
|
97
99
|
tasks := shimcompiler.ProgramResolutionTasks(prog.TSProgram)
|
|
98
100
|
sort.Slice(tasks, func(left, right int) bool {
|
|
99
101
|
a, b := tasks[left], tasks[right]
|
|
@@ -116,7 +118,7 @@ func ObserveProgramResolutions(prog *Program, cwd string) ProgramResolutionObser
|
|
|
116
118
|
})
|
|
117
119
|
|
|
118
120
|
if !prog.TSProgram.Options().NoResolve.IsTrue() {
|
|
119
|
-
observeProgramPathReferences(prog, cwd,
|
|
121
|
+
observeProgramPathReferences(prog, cwd, caseSensitivity, &output)
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
// Automatic type discovery is a separate compiler operation that enumerates
|
|
@@ -125,7 +127,7 @@ func ObserveProgramResolutions(prog *Program, cwd string) ProgramResolutionObser
|
|
|
125
127
|
// package invalidates a resident program without an importer edit.
|
|
126
128
|
automatic := newInputObservationFS(prog.FS)
|
|
127
129
|
shimcompiler.ReplayAutomaticTypeDirectiveDiscovery(prog.TSProgram, automatic)
|
|
128
|
-
output.Universal = appendResolutionPaths(output.Universal, cwd, automatic, nil,
|
|
130
|
+
output.Universal = appendResolutionPaths(output.Universal, cwd, automatic, nil, caseSensitivity, &output.Inputs)
|
|
129
131
|
prog.inputObserver.mergeFrom(automatic)
|
|
130
132
|
|
|
131
133
|
for first := 0; first < len(tasks); {
|
|
@@ -143,18 +145,18 @@ func ObserveProgramResolutions(prog *Program, cwd string) ProgramResolutionObser
|
|
|
143
145
|
// leave a successful resolution outside the graph; retain those targets
|
|
144
146
|
// as resolver inputs instead of silently dropping them.
|
|
145
147
|
if task.TargetFile != "" {
|
|
146
|
-
selected = append(selected, task.TargetFile)
|
|
148
|
+
selected = append(selected, string(task.TargetFile))
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
owner := group[0]
|
|
150
152
|
if owner.Universal {
|
|
151
|
-
output.Universal = appendResolutionPaths(output.Universal, cwd, replay, selected,
|
|
153
|
+
output.Universal = appendResolutionPaths(output.Universal, cwd, replay, selected, caseSensitivity, &output.Inputs)
|
|
152
154
|
if !matches {
|
|
153
155
|
output.universalFailure = true
|
|
154
156
|
}
|
|
155
157
|
} else if owner.SourceFile != "" {
|
|
156
|
-
source := TransformOutputKey(cwd, owner.SourceFile)
|
|
157
|
-
output.Candidates[source] = appendResolutionPaths(output.Candidates[source], cwd, replay, selected,
|
|
158
|
+
source := TransformOutputKey(cwd, string(owner.SourceFile))
|
|
159
|
+
output.Candidates[source] = appendResolutionPaths(output.Candidates[source], cwd, replay, selected, caseSensitivity, &output.Inputs)
|
|
158
160
|
if !matches {
|
|
159
161
|
output.Failures[source] = string(inputProofResolutionChanged)
|
|
160
162
|
}
|
|
@@ -184,21 +186,25 @@ func sameResolutionTaskOwner(left, right shimcompiler.ProgramResolutionTask) boo
|
|
|
184
186
|
// observeProgramPathReferences replays the file predicates for triple-slash
|
|
185
187
|
// path references. These use the compiler's supported-extension list directly
|
|
186
188
|
// rather than the module resolver cache covered by ProgramResolutionTasks.
|
|
187
|
-
func observeProgramPathReferences(prog *Program, cwd string,
|
|
189
|
+
func observeProgramPathReferences(prog *Program, cwd string, caseSensitivity shimtspath.CaseSensitivity, output *ProgramResolutionObservation) {
|
|
188
190
|
supported := shimtsoptions.GetSupportedExtensions(prog.TSProgram.Options(), nil)
|
|
189
191
|
supported = shimtsoptions.GetSupportedExtensionsWithJsonIfResolveJsonModule(prog.TSProgram.Options(), supported)
|
|
190
192
|
for _, source := range prog.TSProgram.SourceFiles() {
|
|
191
|
-
if source == nil || source.FileName() == "" || strings.HasPrefix(source.FileName(), bundledScheme) {
|
|
193
|
+
if source == nil || source.FileName() == "" || strings.HasPrefix(string(source.FileName()), bundledScheme) {
|
|
192
194
|
continue
|
|
193
195
|
}
|
|
194
|
-
sourceKey := TransformOutputKey(cwd, source.FileName())
|
|
196
|
+
sourceKey := TransformOutputKey(cwd, string(source.FileName()))
|
|
195
197
|
for _, reference := range source.ReferencedFiles {
|
|
196
198
|
replay := newInputObservationFS(prog.FS)
|
|
197
199
|
selected := []string(nil)
|
|
198
|
-
for _, candidate := range pathReferenceCandidates(source.FileName(), reference.FileName, prog.TSProgram.Options().AllowNonTsExtensions.IsTrue(), supported,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
for _, candidate := range pathReferenceCandidates(string(source.FileName()), reference.FileName, prog.TSProgram.Options().AllowNonTsExtensions.IsTrue(), supported, caseSensitivity) {
|
|
201
|
+
candidateFile, rooted := shimtspath.TryRootedFilePathFromAbsolute(candidate)
|
|
202
|
+
if !rooted {
|
|
203
|
+
continue
|
|
204
|
+
}
|
|
205
|
+
if replay.FileExists(candidateFile) {
|
|
206
|
+
if resident := residentSourceWithRedirect(prog.TSProgram, candidateFile); resident != nil {
|
|
207
|
+
selected = []string{string(resident.FileName())}
|
|
202
208
|
}
|
|
203
209
|
break
|
|
204
210
|
}
|
|
@@ -207,30 +213,42 @@ func observeProgramPathReferences(prog *Program, cwd string, caseSensitive bool,
|
|
|
207
213
|
// predicates so a later output appearance or source disappearance
|
|
208
214
|
// invalidates the same resolution without turning either spelling into
|
|
209
215
|
// a realized graph edge.
|
|
210
|
-
|
|
211
|
-
redirect := prog.TSProgram.GetProjectReferenceFromOutputDts(outputPath)
|
|
216
|
+
redirect := prog.TSProgram.GetProjectReferenceFromOutputDts(shimcompiler.ProgramPathKey(prog.TSProgram, candidateFile))
|
|
212
217
|
if redirect == nil || !replay.FileExists(redirect.Source) {
|
|
213
218
|
continue
|
|
214
219
|
}
|
|
215
220
|
if resident := prog.TSProgram.GetSourceFile(redirect.Source); resident != nil {
|
|
216
|
-
selected = []string{resident.FileName()}
|
|
221
|
+
selected = []string{string(resident.FileName())}
|
|
217
222
|
}
|
|
218
223
|
break
|
|
219
224
|
}
|
|
220
|
-
output.Candidates[sourceKey] = appendResolutionPaths(output.Candidates[sourceKey], cwd, replay, selected,
|
|
225
|
+
output.Candidates[sourceKey] = appendResolutionPaths(output.Candidates[sourceKey], cwd, replay, selected, caseSensitivity, &output.Inputs)
|
|
221
226
|
prog.inputObserver.mergeFrom(replay)
|
|
222
227
|
}
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
230
|
|
|
226
|
-
|
|
231
|
+
// residentSourceWithRedirect is the Program's lookup of a resolved file: the
|
|
232
|
+
// resident source at that name, else the source its project-reference
|
|
233
|
+
// redirect loaded in its place.
|
|
234
|
+
func residentSourceWithRedirect(program *shimcompiler.Program, file shimtspath.RootedFilePath) *ast.SourceFile {
|
|
235
|
+
if resident := program.GetSourceFile(file); resident != nil {
|
|
236
|
+
return resident
|
|
237
|
+
}
|
|
238
|
+
if redirect := program.GetParseFileRedirect(file); redirect != "" {
|
|
239
|
+
return program.GetSourceFile(redirect)
|
|
240
|
+
}
|
|
241
|
+
return nil
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
func pathReferenceCandidates(containingFile, reference string, allowNonTsExtensions bool, supported [][]string, caseSensitivity shimtspath.CaseSensitivity) []string {
|
|
227
245
|
base := reference
|
|
228
246
|
if !shimtspath.IsRootedDiskPath(base) {
|
|
229
247
|
base = shimtspath.CombinePaths(shimtspath.GetDirectoryPath(containingFile), base)
|
|
230
248
|
}
|
|
231
249
|
base = shimtspath.NormalizePath(base)
|
|
232
250
|
if shimtspath.HasExtension(base) {
|
|
233
|
-
canonicalBase := shimtspath.
|
|
251
|
+
canonicalBase := shimtspath.Canonicalize(caseSensitivity, base)
|
|
234
252
|
if allowNonTsExtensions || supportedFileExtension(canonicalBase, supported) {
|
|
235
253
|
return []string{base}
|
|
236
254
|
}
|
|
@@ -282,18 +300,18 @@ func appendResolutionPaths(
|
|
|
282
300
|
cwd string,
|
|
283
301
|
observer *inputObservationFS,
|
|
284
302
|
selected []string,
|
|
285
|
-
|
|
303
|
+
caseSensitivity shimtspath.CaseSensitivity,
|
|
286
304
|
flat *[]ProgramResolutionInput,
|
|
287
305
|
) []string {
|
|
288
306
|
for _, candidate := range observer.observedPaths() {
|
|
289
|
-
selectedPath := slicesContainResolutionPath(selected, candidate,
|
|
290
|
-
identityOnly := selectedPath && observedResolutionPathHasDistinctIdentity(observer, candidate,
|
|
307
|
+
selectedPath := slicesContainResolutionPath(selected, candidate, caseSensitivity)
|
|
308
|
+
identityOnly := selectedPath && observedResolutionPathHasDistinctIdentity(observer, candidate, caseSensitivity)
|
|
291
309
|
if selectedPath && !identityOnly {
|
|
292
310
|
continue
|
|
293
311
|
}
|
|
294
312
|
if !identityOnly {
|
|
295
313
|
for _, target := range selected {
|
|
296
|
-
if observedResolutionAlias(observer, candidate, target,
|
|
314
|
+
if observedResolutionAlias(observer, candidate, target, caseSensitivity) {
|
|
297
315
|
identityOnly = true
|
|
298
316
|
break
|
|
299
317
|
}
|
|
@@ -309,36 +327,36 @@ func appendResolutionPaths(
|
|
|
309
327
|
return target
|
|
310
328
|
}
|
|
311
329
|
|
|
312
|
-
func observedResolutionPathHasDistinctIdentity(observer *inputObservationFS, candidate string,
|
|
330
|
+
func observedResolutionPathHasDistinctIdentity(observer *inputObservationFS, candidate string, caseSensitivity shimtspath.CaseSensitivity) bool {
|
|
313
331
|
if observer == nil || candidate == "" {
|
|
314
332
|
return false
|
|
315
333
|
}
|
|
316
334
|
observation, failure := observer.predicateProof(candidate)
|
|
317
|
-
return failure == "" && observation.Realpath != nil && observation.Realpath.OK && !sameResolutionPath(observation.Realpath.Path, candidate,
|
|
335
|
+
return failure == "" && observation.Realpath != nil && observation.Realpath.OK && !sameResolutionPath(observation.Realpath.Path, candidate, caseSensitivity)
|
|
318
336
|
}
|
|
319
337
|
|
|
320
|
-
func slicesContainResolutionPath(paths []string, candidate string,
|
|
338
|
+
func slicesContainResolutionPath(paths []string, candidate string, caseSensitivity shimtspath.CaseSensitivity) bool {
|
|
321
339
|
for _, path := range paths {
|
|
322
|
-
if sameResolutionPath(candidate, path,
|
|
340
|
+
if sameResolutionPath(candidate, path, caseSensitivity) {
|
|
323
341
|
return true
|
|
324
342
|
}
|
|
325
343
|
}
|
|
326
344
|
return false
|
|
327
345
|
}
|
|
328
346
|
|
|
329
|
-
func sameResolutionPath(left, right string,
|
|
347
|
+
func sameResolutionPath(left, right string, caseSensitivity shimtspath.CaseSensitivity) bool {
|
|
330
348
|
if left == "" || right == "" {
|
|
331
349
|
return false
|
|
332
350
|
}
|
|
333
|
-
return shimtspath.
|
|
351
|
+
return shimtspath.Canonicalize(caseSensitivity, shimtspath.NormalizePath(left)) == shimtspath.Canonicalize(caseSensitivity, shimtspath.NormalizePath(right))
|
|
334
352
|
}
|
|
335
353
|
|
|
336
|
-
func observedResolutionAlias(observer *inputObservationFS, candidate, target string,
|
|
354
|
+
func observedResolutionAlias(observer *inputObservationFS, candidate, target string, caseSensitivity shimtspath.CaseSensitivity) bool {
|
|
337
355
|
if observer == nil || candidate == "" || target == "" {
|
|
338
356
|
return false
|
|
339
357
|
}
|
|
340
358
|
observation, failure := observer.predicateProof(candidate)
|
|
341
|
-
return failure == "" && observation.Realpath != nil && observation.Realpath.OK && sameResolutionPath(observation.Realpath.Path, target,
|
|
359
|
+
return failure == "" && observation.Realpath != nil && observation.Realpath.OK && sameResolutionPath(observation.Realpath.Path, target, caseSensitivity)
|
|
342
360
|
}
|
|
343
361
|
|
|
344
362
|
func compactResolutionInputs(inputs []ProgramResolutionInput) []ProgramResolutionInput {
|
|
@@ -6,6 +6,10 @@ import (
|
|
|
6
6
|
"path/filepath"
|
|
7
7
|
"slices"
|
|
8
8
|
"testing"
|
|
9
|
+
|
|
10
|
+
"github.com/microsoft/typescript-go/shim/core"
|
|
11
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
12
|
+
shimvfs "github.com/microsoft/typescript-go/shim/vfs"
|
|
9
13
|
)
|
|
10
14
|
|
|
11
15
|
// TestTransformGraphReplaysCompilerResolutionSemantics loads authored native
|
|
@@ -14,8 +18,8 @@ import (
|
|
|
14
18
|
// Required candidate membership is checked rather than an exact candidate set;
|
|
15
19
|
// the same maintained compiler supplies the Program and resolution replay.
|
|
16
20
|
//
|
|
17
|
-
// @evidence contracts/testing.md#behavioral-verification Actual LoadProgram and NewTransformGraph expose the asserted package/import/suffix/reference candidate paths and type-root listing. Additional fixtures check JSON-reference admission, a noResolve target outside the Program, unbuilt project-reference resident versus nonresident edges, and explicit versus absent or relative semantic config selection.
|
|
18
|
-
// @evidence contracts/testing.md#independent-expectations Required candidate paths, project-reference edge presence/absence,
|
|
21
|
+
// @evidence contracts/testing.md#behavioral-verification Actual LoadProgram and NewTransformGraph expose the asserted package/import/suffix/reference candidate paths and type-root listing. Additional fixtures check JSON-reference admission, a noResolve target outside the Program, unbuilt project-reference resident versus nonresident edges, and explicit versus absent or relative semantic config selection; an explicit semantic config must also own the Program's current directory while the generated wrapper's strict overlay still applies.
|
|
22
|
+
// @evidence contracts/testing.md#independent-expectations Required candidate paths, project-reference edge presence/absence, selected config filenames, the semantic project directory and the wrapper's authored strict option are authored literals. The explicit wildcard type root contains exactly fixture-types and no files; independent native EvalSymlinks supplies its expected directory identity. Candidates are not checked for exact equality, and the uppercase JSON expectation uses the Program's filesystem case policy; this does not independently certify that policy or the compiler's full resolver semantics. Wildcard type enumeration is not claimed for an omitted types option.
|
|
19
23
|
// @evidence contracts/testing.md#distinguishing-cases resolveJsonModule false/true and conditional uppercase admission contrast; noResolve retains a successful target as a candidate. Project-reference source presence and output absence differ from realized edge membership. Explicit absolute semantic config, an unmarked wrapper despite ambient metadata, and a rejected relative semantic path exercise separate selection branches.
|
|
20
24
|
// @evidence contracts/testing.md#execution-ownership This driver Go unit writes and cleans its own temporary projects, constructs maintained native compiler Programs in-process, and calls the owning graph operation. Each returned Program is closed; a restored empty linked-plugin manifest excludes ambient hooks, and no installed consumer or external compiler command is used. It does not substitute a literal-input-only aggregation test for this native compiler connection.
|
|
21
25
|
func TestTransformGraphReplaysCompilerResolutionSemantics(t *testing.T) {
|
|
@@ -163,7 +167,7 @@ export const value = true;
|
|
|
163
167
|
t.Fatalf("resolveJsonModule=%t JSON candidates = %v", resolveJSON, jsonReferenceGraph.Candidates[jsonReferenceSource])
|
|
164
168
|
}
|
|
165
169
|
containsUppercaseCandidate := slices.Contains(jsonReferenceGraph.Candidates[jsonReferenceSource], uppercaseJSONCandidate)
|
|
166
|
-
expectsUppercaseCandidate := resolveJSON && !jsonReferenceProgram.FS.
|
|
170
|
+
expectsUppercaseCandidate := resolveJSON && !(shimvfs.CaseSensitivityOf(jsonReferenceProgram.FS) == shimtspath.CaseSensitive)
|
|
167
171
|
if containsUppercaseCandidate != expectsUppercaseCandidate {
|
|
168
172
|
t.Fatalf("resolveJsonModule=%t uppercase JSON candidates = %v", resolveJSON, jsonReferenceGraph.Candidates[jsonReferenceSource])
|
|
169
173
|
}
|
|
@@ -340,9 +344,18 @@ export const parent = true;`,
|
|
|
340
344
|
t.Fatalf("unexpected generated-wrapper diagnostics: %#v", semanticDiagnostics)
|
|
341
345
|
}
|
|
342
346
|
defer semanticProgram.Close()
|
|
343
|
-
if got := semanticProgram.TSProgram.Options().ConfigFilePath; got != filepath.ToSlash(semanticConfig) {
|
|
347
|
+
if got := semanticProgram.TSProgram.Options().ConfigFilePath; string(got) != filepath.ToSlash(semanticConfig) {
|
|
344
348
|
t.Fatalf("generated wrapper semantic config = %q, want %q", got, filepath.ToSlash(semanticConfig))
|
|
345
349
|
}
|
|
350
|
+
// The compiler anchors type discovery and its current directory at the
|
|
351
|
+
// parsed config's base directory, not ConfigFilePath. The user config must
|
|
352
|
+
// be the parsed project while the wrapper's overlay still applies.
|
|
353
|
+
if got := semanticProgram.TSProgram.GetCurrentDirectory(); string(got) != filepath.ToSlash(semanticRoot) {
|
|
354
|
+
t.Fatalf("generated wrapper base directory = %q, want %q", got, filepath.ToSlash(semanticRoot))
|
|
355
|
+
}
|
|
356
|
+
if got := semanticProgram.TSProgram.Options().Strict; got != core.TSTrue {
|
|
357
|
+
t.Fatalf("generated wrapper overlay strict = %v, want true", got)
|
|
358
|
+
}
|
|
346
359
|
semanticGraph := NewTransformGraph(semanticProgram, semanticRoot)
|
|
347
360
|
semanticTypeRoot := filepath.ToSlash(filepath.Join("node_modules", "@types"))
|
|
348
361
|
if !slices.Contains(semanticGraph.ResolutionInputs, semanticTypeRoot) {
|
|
@@ -356,7 +369,7 @@ export const parent = true;`,
|
|
|
356
369
|
t.Fatalf("unexpected unmarked-wrapper diagnostics: %#v", unmarkedDiagnostics)
|
|
357
370
|
}
|
|
358
371
|
defer unmarkedProgram.Close()
|
|
359
|
-
if got := unmarkedProgram.TSProgram.Options().ConfigFilePath; got != filepath.ToSlash(generatedConfig) {
|
|
372
|
+
if got := unmarkedProgram.TSProgram.Options().ConfigFilePath; string(got) != filepath.ToSlash(generatedConfig) {
|
|
360
373
|
t.Fatalf("unmarked wrapper inherited ambient semantic config = %q, want %q", got, filepath.ToSlash(generatedConfig))
|
|
361
374
|
}
|
|
362
375
|
invalidProgram, _, err := LoadProgram(semanticRoot, generatedConfig, LoadProgramOptions{SemanticConfigPath: "relative.json"})
|