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/shim/transformers/go.sum
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
2
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 h1:KZaTBSyshWX3MP5jukJcNSuXDQTO+rNpt0J564dX/eg=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
3
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
4
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
5
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
|
6
6
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
|
7
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
8
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
7
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
8
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
9
9
|
github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
|
|
10
10
|
github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
|
|
11
11
|
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
package/shim/tsoptions/go.mod
CHANGED
|
@@ -2,10 +2,10 @@ module github.com/microsoft/typescript-go/shim/tsoptions
|
|
|
2
2
|
|
|
3
3
|
go 1.26
|
|
4
4
|
|
|
5
|
-
require github.com/microsoft/typescript-go v0.0.0-
|
|
5
|
+
require github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b
|
|
6
6
|
|
|
7
7
|
require (
|
|
8
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
8
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 // indirect
|
|
9
9
|
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
|
10
10
|
github.com/zeebo/xxh3 v1.1.0 // indirect
|
|
11
11
|
golang.org/x/sync v0.21.0 // indirect
|
package/shim/tsoptions/go.sum
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
2
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 h1:KZaTBSyshWX3MP5jukJcNSuXDQTO+rNpt0J564dX/eg=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
3
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
4
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
5
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
|
6
6
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
|
7
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
8
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
7
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
8
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
9
9
|
github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
|
|
10
10
|
github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
|
|
11
11
|
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package tsoptions
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
innertsoptions "github.com/microsoft/typescript-go/internal/tsoptions"
|
|
5
|
+
innervfs "github.com/microsoft/typescript-go/internal/vfs"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
// Version-neutral command-line and config parsing entry points.
|
|
9
|
+
//
|
|
10
|
+
// TypeScript 7.0 parses through a host that carries the working directory,
|
|
11
|
+
// while TypeScript 7.1 takes the filesystem and directory separately and asks
|
|
12
|
+
// its config host whether a content-mapper package may run. Code that must
|
|
13
|
+
// compile on both compiler targets calls these functions, which the 7.1 bridge
|
|
14
|
+
// declares with identical signatures.
|
|
15
|
+
|
|
16
|
+
// parseConfigHost is the 7.0 ParseConfigHost over a filesystem and the
|
|
17
|
+
// directory relative paths resolve against.
|
|
18
|
+
type parseConfigHost struct {
|
|
19
|
+
fs innervfs.FS
|
|
20
|
+
currentDirectory string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func (h parseConfigHost) FS() innervfs.FS { return h.fs }
|
|
24
|
+
func (h parseConfigHost) GetCurrentDirectory() string { return h.currentDirectory }
|
|
25
|
+
|
|
26
|
+
// NewParseConfigHost returns the config-parsing host over fs. TypeScript 7.0
|
|
27
|
+
// resolves relative paths against currentDirectory; TypeScript 7.1 resolves
|
|
28
|
+
// them against the config file and leaves content-mapper authorization to the
|
|
29
|
+
// runExternalCode option.
|
|
30
|
+
//
|
|
31
|
+
// @evidence contracts/common.md#principled-implementation Supplies 7.0's ParseConfigHost contract, a filesystem and a current directory, which ttsc's compiler host satisfied before.
|
|
32
|
+
// @evidence contracts/common.md#clear-and-simple-design A two-field value implements the two-method interface.
|
|
33
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts The host only reports its inputs; parsing stays with the compiler.
|
|
34
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states each target's use of currentDirectory.
|
|
35
|
+
// @evidence contracts/portability.md#os-neutral-implementation The supplied FS owns every native operation; the host adds none.
|
|
36
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms Construction assigns two fields.
|
|
37
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work Each call returns a fresh value.
|
|
38
|
+
// @evidence contracts/performance.md#bound-retention-and-release-resources The value retains fs and the directory string for the caller's lifetime and owns no handle.
|
|
39
|
+
func NewParseConfigHost(fs innervfs.FS, currentDirectory string) innertsoptions.ParseConfigHost {
|
|
40
|
+
return parseConfigHost{fs: fs, currentDirectory: currentDirectory}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ParseCommandLineAt parses tsc arguments, resolving relative values against
|
|
44
|
+
// currentDirectory, the directory the arguments were given in.
|
|
45
|
+
//
|
|
46
|
+
// @evidence contracts/common.md#principled-implementation Calls ParseCommandLine with a host whose current directory is the argument base, as ttsc's driver did with a host built at that directory.
|
|
47
|
+
// @evidence contracts/common.md#clear-and-simple-design One parser call keeps the target difference inside the shim.
|
|
48
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts Argument parsing remains the compiler's.
|
|
49
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states which directory relative values use.
|
|
50
|
+
// @evidence contracts/portability.md#os-neutral-implementation Response-file reads go through the supplied FS.
|
|
51
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the argument scan.
|
|
52
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
53
|
+
// @evidence contracts/performance.md#bound-retention-and-release-resources The returned command line is caller-owned; the temporary host is released on return.
|
|
54
|
+
func ParseCommandLineAt(args []string, fs innervfs.FS, currentDirectory string) *innertsoptions.ParsedCommandLine {
|
|
55
|
+
return innertsoptions.ParseCommandLine(args, NewParseConfigHost(fs, currentDirectory))
|
|
56
|
+
}
|
package/shim/tspath/go.mod
CHANGED
package/shim/tspath/go.sum
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
2
2
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
3
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
4
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
3
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
4
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
5
5
|
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
|
|
6
6
|
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
package tspath
|
|
2
|
+
|
|
3
|
+
import innertspath "github.com/microsoft/typescript-go/internal/tspath"
|
|
4
|
+
|
|
5
|
+
// Version-neutral path operations.
|
|
6
|
+
//
|
|
7
|
+
// TypeScript 7.1 spells these path operations as methods of
|
|
8
|
+
// its typed paths and CaseSensitivity. TypeScript 7.0 spells the same values as
|
|
9
|
+
// strings and booleans, which cannot carry methods. Code that must compile on
|
|
10
|
+
// both compiler targets calls these functions, which the 7.1 bridge declares
|
|
11
|
+
// with identical signatures over its methods. Here each maps to the 7.0 path
|
|
12
|
+
// function that ttsc's own 7.0 code used for the same purpose.
|
|
13
|
+
|
|
14
|
+
func compareOptions(caseSensitivity CaseSensitivity) innertspath.ComparePathsOptions {
|
|
15
|
+
return innertspath.ComparePathsOptions{UseCaseSensitiveFileNames: caseSensitivity}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Canonicalize applies the case policy to text used as a path identity: an
|
|
19
|
+
// insensitive policy lowercases it the way file names compare.
|
|
20
|
+
//
|
|
21
|
+
// @evidence contracts/common.md#principled-implementation GetCanonicalFileName applies the same file-name lowercasing under an insensitive policy.
|
|
22
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
23
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No case folding is reimplemented here.
|
|
24
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the insensitive-policy effect.
|
|
25
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Text canonicalization performs no native filesystem, path or process operation; the policy is supplied, not read from the OS.
|
|
26
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the single pass over the text.
|
|
27
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
28
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned string.
|
|
29
|
+
func Canonicalize(caseSensitivity CaseSensitivity, text string) string {
|
|
30
|
+
return innertspath.GetCanonicalFileName(text, caseSensitivity)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// CompareFilePaths orders two rooted, normalized file paths under the case
|
|
34
|
+
// policy, returning a negative, zero or positive result.
|
|
35
|
+
//
|
|
36
|
+
// @evidence contracts/common.md#principled-implementation ComparePaths compares the two paths under the supplied case policy; with rooted, normalized operands it needs no current directory.
|
|
37
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
38
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No comparison is reimplemented here.
|
|
39
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the operand requirements and the result sign.
|
|
40
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Comparison reads its arguments only; it opens no file and calls no process.
|
|
41
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the comparison over the path text.
|
|
42
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
43
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing.
|
|
44
|
+
func CompareFilePaths(caseSensitivity CaseSensitivity, a RootedFilePath, b RootedFilePath) int {
|
|
45
|
+
return innertspath.ComparePaths(a, b, compareOptions(caseSensitivity))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ContainsPathWith reports whether child is parent or lies below it under the
|
|
49
|
+
// case policy. Both paths must be rooted and normalized.
|
|
50
|
+
//
|
|
51
|
+
// @evidence contracts/common.md#principled-implementation ContainsPath tests containment under the supplied case policy; with rooted operands it needs no current directory.
|
|
52
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
53
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No containment test is reimplemented here.
|
|
54
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the inclusive meaning and operand requirements.
|
|
55
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Containment reads its arguments only; it opens no file and calls no process.
|
|
56
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the prefix comparison.
|
|
57
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
58
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing.
|
|
59
|
+
func ContainsPathWith(caseSensitivity CaseSensitivity, parent RootedDirectoryPath, child RootedPath) bool {
|
|
60
|
+
return innertspath.ContainsPath(parent, child, compareOptions(caseSensitivity))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// RelativePathFromFile returns to relative to the directory of from. The
|
|
64
|
+
// boolean is false when the two paths share no root to relate them through.
|
|
65
|
+
//
|
|
66
|
+
// @evidence contracts/common.md#principled-implementation GetRelativePathFromFile relativizes to against from's directory; 7.0 returns the absolute target when the roots differ, which is reported as false.
|
|
67
|
+
// @evidence contracts/common.md#clear-and-simple-design Two upstream calls keep the target difference inside the shim.
|
|
68
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts An unrelatable target is reported rather than returned as a relative path.
|
|
69
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the base directory and the false result.
|
|
70
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Relativization reads its arguments only; it opens no file and calls no process.
|
|
71
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the component walk.
|
|
72
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
73
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
74
|
+
func RelativePathFromFile(caseSensitivity CaseSensitivity, from RootedFilePath, to RootedFilePath) (RelativePath, bool) {
|
|
75
|
+
relative := innertspath.GetRelativePathFromFile(from, to, compareOptions(caseSensitivity))
|
|
76
|
+
return relative, !innertspath.IsRootedDiskPath(relative)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// RelativeModuleSpecifier spells a relative path as a module specifier, adding
|
|
80
|
+
// the leading "./" a bare relative path needs.
|
|
81
|
+
//
|
|
82
|
+
// @evidence contracts/common.md#principled-implementation EnsurePathIsNonModuleName adds the "./" prefix a relative module specifier needs.
|
|
83
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
84
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No specifier spelling is reimplemented here.
|
|
85
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the added "./" prefix.
|
|
86
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The conversion reads its argument only.
|
|
87
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the prefix check.
|
|
88
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
89
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned specifier.
|
|
90
|
+
func RelativeModuleSpecifier(path RelativePath) ModuleSpecifier {
|
|
91
|
+
return innertspath.EnsurePathIsNonModuleName(path)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ResolveFile resolves path against a rooted directory and normalizes the
|
|
95
|
+
// result. directory must not be empty.
|
|
96
|
+
//
|
|
97
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath combines path with the directory and normalizes it, the resolution 7.1 performs.
|
|
98
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
99
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No resolution is reimplemented here.
|
|
100
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the normalization and the empty-directory precondition.
|
|
101
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Resolution manipulates path text only; it reads no filesystem.
|
|
102
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
103
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
104
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
105
|
+
func ResolveFile(directory RootedDirectoryPath, path string) RootedFilePath {
|
|
106
|
+
return innertspath.GetNormalizedAbsolutePath(path, directory)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// FileBaseName returns the last component of a rooted file path.
|
|
110
|
+
//
|
|
111
|
+
// @evidence contracts/common.md#principled-implementation GetBaseFileName returns the path's last component.
|
|
112
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
113
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No component split is reimplemented here.
|
|
114
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states which component is returned.
|
|
115
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The split reads its argument only.
|
|
116
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the separator scan.
|
|
117
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
118
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned name.
|
|
119
|
+
func FileBaseName(fileName RootedFilePath) string {
|
|
120
|
+
return innertspath.GetBaseFileName(fileName)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// FileDirectory returns the rooted directory that contains a file.
|
|
124
|
+
//
|
|
125
|
+
// @evidence contracts/common.md#principled-implementation GetDirectoryPath returns the path without its last component.
|
|
126
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
127
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No directory split is reimplemented here.
|
|
128
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the returned directory.
|
|
129
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The split reads its argument only.
|
|
130
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the separator scan.
|
|
131
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
132
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned directory.
|
|
133
|
+
func FileDirectory(fileName RootedFilePath) RootedDirectoryPath {
|
|
134
|
+
return innertspath.GetDirectoryPath(fileName)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// RelativePathFromDirectoryWith returns path relative to directory under the
|
|
138
|
+
// case policy. A path on another root comes back absolute.
|
|
139
|
+
//
|
|
140
|
+
// @evidence contracts/common.md#principled-implementation Calls GetRelativePathFromDirectory with the case policy and the directory as its current directory, as ttsc's graph dump called it on 7.0.
|
|
141
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
142
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No relative-path computation is reimplemented here.
|
|
143
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the result for different roots.
|
|
144
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Relativization reads its arguments only; it opens no file and calls no process.
|
|
145
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the component walk.
|
|
146
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
147
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
148
|
+
func RelativePathFromDirectoryWith(caseSensitivity CaseSensitivity, directory string, path string) string {
|
|
149
|
+
return innertspath.GetRelativePathFromDirectory(directory, path, innertspath.ComparePathsOptions{UseCaseSensitiveFileNames: caseSensitivity, CurrentDirectory: directory})
|
|
150
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
package tspath
|
|
2
|
+
|
|
3
|
+
import innertspath "github.com/microsoft/typescript-go/internal/tspath"
|
|
4
|
+
|
|
5
|
+
// Typed path names of the TypeScript 7.1 compiler.
|
|
6
|
+
//
|
|
7
|
+
// TypeScript 7.1 types every path, while TypeScript 7.0 spells each one as a
|
|
8
|
+
// string and keys files by Path. These aliases give 7.0 the 7.1 names, so code
|
|
9
|
+
// that must compile on both compiler targets can convert a string to the type
|
|
10
|
+
// each compiler's API expects with one expression, such as RootedFilePath(name).
|
|
11
|
+
// They add no behavior: on 7.0 every typed path is the string it names.
|
|
12
|
+
|
|
13
|
+
// RootedPath is 7.1's rooted, normalized path, a string on 7.0.
|
|
14
|
+
//
|
|
15
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
16
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
17
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
18
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
19
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
20
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
21
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
22
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
23
|
+
type RootedPath = string
|
|
24
|
+
|
|
25
|
+
// RootedFilePath is 7.1's rooted file path, a string on 7.0.
|
|
26
|
+
//
|
|
27
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
28
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
29
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
30
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
31
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
32
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
33
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
34
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
35
|
+
type RootedFilePath = string
|
|
36
|
+
|
|
37
|
+
// RootedDirectoryPath is 7.1's rooted directory path, a string on 7.0.
|
|
38
|
+
//
|
|
39
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
40
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
41
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
42
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
43
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
44
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
45
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
46
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
47
|
+
type RootedDirectoryPath = string
|
|
48
|
+
|
|
49
|
+
// RelativePath is 7.1's relative path, a string on 7.0.
|
|
50
|
+
//
|
|
51
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
52
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
53
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
54
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
55
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
56
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
57
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
58
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
59
|
+
type RelativePath = string
|
|
60
|
+
|
|
61
|
+
// FileNameStem is 7.1's file name without its extension, a string on 7.0.
|
|
62
|
+
//
|
|
63
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
64
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
65
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
66
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
67
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
68
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
69
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
70
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
71
|
+
type FileNameStem = string
|
|
72
|
+
|
|
73
|
+
// ModuleSpecifier is 7.1's module specifier, a string on 7.0.
|
|
74
|
+
//
|
|
75
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
76
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
77
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
78
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
79
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
80
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
81
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
82
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
83
|
+
type ModuleSpecifier = string
|
|
84
|
+
|
|
85
|
+
// PathKey is 7.1's canonical path key, which is 7.0's Path.
|
|
86
|
+
//
|
|
87
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
88
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
89
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
90
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
91
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
92
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
93
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
94
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
95
|
+
type PathKey = innertspath.Path
|
|
96
|
+
|
|
97
|
+
// CaseSensitivity is TypeScript 7.1's case policy for path identity. On 7.0 it
|
|
98
|
+
// is the useCaseSensitiveFileNames boolean that the 7.0 path functions take, so
|
|
99
|
+
// a value passes to either compiler's API unchanged.
|
|
100
|
+
//
|
|
101
|
+
// @evidence contracts/common.md#principled-implementation A type alias names the representation 7.0 already uses for this value, so it adds no behavior.
|
|
102
|
+
// @evidence contracts/common.md#clear-and-simple-design One alias per 7.1 name lets one expression produce each compiler's parameter type.
|
|
103
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No validation or method is attached to the 7.0 value.
|
|
104
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the 7.1 type and the 7.0 representation.
|
|
105
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation A type alias performs no native operation.
|
|
106
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms A type alias executes nothing.
|
|
107
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type alias coordinates no work.
|
|
108
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type alias acquires nothing.
|
|
109
|
+
type CaseSensitivity = bool
|
|
110
|
+
|
|
111
|
+
// The two case policies, matching TypeScript 7.1's constants. CaseInsensitive
|
|
112
|
+
// is the zero value on both targets.
|
|
113
|
+
const (
|
|
114
|
+
CaseInsensitive CaseSensitivity = false
|
|
115
|
+
CaseSensitive CaseSensitivity = true
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
// Constructors of TypeScript 7.1's typed paths. 7.1 declares them in its own
|
|
119
|
+
// tspath package; here each maps to the 7.0 path function that ttsc's own 7.0
|
|
120
|
+
// code used for the same purpose, so code calling them compiles on both.
|
|
121
|
+
|
|
122
|
+
// ToRootedFilePath resolves fileName against currentDirectory and normalizes
|
|
123
|
+
// the result, as TypeScript 7.1's constructor of the same name does.
|
|
124
|
+
//
|
|
125
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath combines a relative name with the directory and normalizes separators and dot segments, the rooting 7.1 performs.
|
|
126
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
127
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No path normalization is reimplemented here.
|
|
128
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the resolution and normalization.
|
|
129
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Resolution manipulates path text only; it reads no filesystem.
|
|
130
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
131
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
132
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
133
|
+
func ToRootedFilePath(fileName string, currentDirectory RootedDirectoryPath) RootedFilePath {
|
|
134
|
+
return innertspath.GetNormalizedAbsolutePath(fileName, currentDirectory)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ToRootedDirectoryPath resolves directory against currentDirectory and
|
|
138
|
+
// normalizes the result, as TypeScript 7.1's constructor of the same name does.
|
|
139
|
+
//
|
|
140
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath combines a relative directory with the base and normalizes it, the rooting 7.1 performs.
|
|
141
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
142
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No path normalization is reimplemented here.
|
|
143
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the resolution and normalization.
|
|
144
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Resolution manipulates path text only; it reads no filesystem.
|
|
145
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
146
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
147
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
148
|
+
func ToRootedDirectoryPath(directory string, currentDirectory RootedDirectoryPath) RootedDirectoryPath {
|
|
149
|
+
return innertspath.GetNormalizedAbsolutePath(directory, currentDirectory)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// TryRootedPathFromAbsolute normalizes an absolute path. The boolean is false,
|
|
153
|
+
// and the path empty, when path is not absolute.
|
|
154
|
+
//
|
|
155
|
+
// @evidence contracts/common.md#principled-implementation PathIsAbsolute gates the input and GetNormalizedAbsolutePath normalizes it with no base, matching 7.1's absolute-only constructor.
|
|
156
|
+
// @evidence contracts/common.md#clear-and-simple-design Two upstream calls keep the target difference inside the shim.
|
|
157
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts A relative path is refused rather than resolved against an assumed directory.
|
|
158
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the false result.
|
|
159
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The check and normalization read path text only.
|
|
160
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the root check and normalization pass.
|
|
161
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
162
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
163
|
+
func TryRootedPathFromAbsolute(path string) (RootedPath, bool) {
|
|
164
|
+
if !innertspath.PathIsAbsolute(path) {
|
|
165
|
+
return "", false
|
|
166
|
+
}
|
|
167
|
+
return innertspath.GetNormalizedAbsolutePath(path, ""), true
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// TryRootedFilePathFromAbsolute is TryRootedPathFromAbsolute for a file path.
|
|
171
|
+
//
|
|
172
|
+
// @evidence contracts/common.md#principled-implementation Delegates to TryRootedPathFromAbsolute; on 7.0 file and plain rooted paths share one representation.
|
|
173
|
+
// @evidence contracts/common.md#clear-and-simple-design One delegation mirrors 7.1's file-intent constructor.
|
|
174
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts The same absolute-only gate applies.
|
|
175
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names the shared behavior.
|
|
176
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The check and normalization read path text only.
|
|
177
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The delegate owns the work.
|
|
178
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
179
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
180
|
+
func TryRootedFilePathFromAbsolute(fileName string) (RootedFilePath, bool) {
|
|
181
|
+
return TryRootedPathFromAbsolute(fileName)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// RootedFilePathFromAbsolute normalizes a file path that the caller has
|
|
185
|
+
// already checked is absolute.
|
|
186
|
+
//
|
|
187
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath with no base normalizes an absolute path, the value 7.1's constructor produces for valid input.
|
|
188
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
189
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No path normalization is reimplemented here.
|
|
190
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the caller's absolute-path precondition.
|
|
191
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Normalization manipulates path text only.
|
|
192
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
193
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
194
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
195
|
+
func RootedFilePathFromAbsolute(fileName string) RootedFilePath {
|
|
196
|
+
return innertspath.GetNormalizedAbsolutePath(fileName, "")
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// RootedPathFromAbsolute normalizes a path that the caller has already checked
|
|
200
|
+
// is absolute.
|
|
201
|
+
//
|
|
202
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath with no base normalizes an absolute path, the value 7.1's constructor produces for valid input.
|
|
203
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
204
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No path normalization is reimplemented here.
|
|
205
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the caller's absolute-path precondition.
|
|
206
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Normalization manipulates path text only.
|
|
207
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
208
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
209
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
210
|
+
func RootedPathFromAbsolute(path string) RootedPath {
|
|
211
|
+
return innertspath.GetNormalizedAbsolutePath(path, "")
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// RootedDirectoryPathFromAbsolute normalizes a directory path that the caller
|
|
215
|
+
// has already checked is absolute.
|
|
216
|
+
//
|
|
217
|
+
// @evidence contracts/common.md#principled-implementation GetNormalizedAbsolutePath with no base normalizes an absolute path, the value 7.1's constructor produces for valid input.
|
|
218
|
+
// @evidence contracts/common.md#clear-and-simple-design One upstream call keeps the target difference inside the shim.
|
|
219
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts No path normalization is reimplemented here.
|
|
220
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the caller's absolute-path precondition.
|
|
221
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation Normalization manipulates path text only.
|
|
222
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms The compiler owns the normalization pass.
|
|
223
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
224
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing beyond the returned path.
|
|
225
|
+
func RootedDirectoryPathFromAbsolute(directory string) RootedDirectoryPath {
|
|
226
|
+
return innertspath.GetNormalizedAbsolutePath(directory, "")
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// RootedPathFromNormalized accepts a path that is already rooted and
|
|
230
|
+
// normalized. On 7.0 it is returned unchanged.
|
|
231
|
+
//
|
|
232
|
+
// @evidence contracts/common.md#principled-implementation 7.0 represents a normalized rooted path as the same string, so the value is returned unchanged.
|
|
233
|
+
// @evidence contracts/common.md#clear-and-simple-design An identity conversion mirrors 7.1's validating constructor for valid input.
|
|
234
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts The path is not altered.
|
|
235
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the precondition and the identity on 7.0.
|
|
236
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The conversion reads its argument only.
|
|
237
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms An identity conversion chooses no algorithm.
|
|
238
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
239
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing.
|
|
240
|
+
func RootedPathFromNormalized(path string) RootedPath { return path }
|
|
241
|
+
|
|
242
|
+
// RootedDirectoryPathFromNormalized gives directory intent to a path that is
|
|
243
|
+
// already rooted and normalized. On 7.0 it is returned unchanged.
|
|
244
|
+
//
|
|
245
|
+
// @evidence contracts/common.md#principled-implementation 7.0 represents a normalized rooted directory as the same string, so the value is returned unchanged.
|
|
246
|
+
// @evidence contracts/common.md#clear-and-simple-design An identity conversion mirrors 7.1's intent conversion.
|
|
247
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts The path is not altered.
|
|
248
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the precondition and the identity on 7.0.
|
|
249
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The conversion reads its argument only.
|
|
250
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms An identity conversion chooses no algorithm.
|
|
251
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
252
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing.
|
|
253
|
+
func RootedDirectoryPathFromNormalized(directory string) RootedDirectoryPath { return directory }
|
|
254
|
+
|
|
255
|
+
// RootedDirectoryPathFromPath gives a rooted path directory intent. On 7.0 both
|
|
256
|
+
// are the same string.
|
|
257
|
+
//
|
|
258
|
+
// @evidence contracts/common.md#principled-implementation 7.0 represents file and directory intent identically, so the value is returned unchanged.
|
|
259
|
+
// @evidence contracts/common.md#clear-and-simple-design An identity conversion mirrors 7.1's intent conversion.
|
|
260
|
+
// @evidence contracts/common.md#prohibited-implementation-shortcuts The path is not altered.
|
|
261
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose states the identity on 7.0.
|
|
262
|
+
// @evidenceExclude contracts/portability.md#os-neutral-implementation The conversion reads its argument only.
|
|
263
|
+
// @evidenceExclude contracts/performance.md#efficient-algorithms An identity conversion chooses no algorithm.
|
|
264
|
+
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The function coordinates no shared work.
|
|
265
|
+
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The function retains nothing.
|
|
266
|
+
func RootedDirectoryPathFromPath(path RootedPath) RootedDirectoryPath { return path }
|
|
@@ -2,6 +2,6 @@ module github.com/microsoft/typescript-go/shim/vfs/cachedvfs
|
|
|
2
2
|
|
|
3
3
|
go 1.26
|
|
4
4
|
|
|
5
|
-
require github.com/microsoft/typescript-go v0.0.0-
|
|
5
|
+
require github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b
|
|
6
6
|
|
|
7
|
-
require github.com/go-json-experiment/json v0.0.0-
|
|
7
|
+
require github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 // indirect
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
2
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 h1:KZaTBSyshWX3MP5jukJcNSuXDQTO+rNpt0J564dX/eg=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
3
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
4
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
6
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
5
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
6
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
7
7
|
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
|
|
8
8
|
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
|
9
9
|
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
|
package/shim/vfs/go.mod
CHANGED
|
@@ -2,10 +2,10 @@ module github.com/microsoft/typescript-go/shim/vfs
|
|
|
2
2
|
|
|
3
3
|
go 1.26
|
|
4
4
|
|
|
5
|
-
require github.com/microsoft/typescript-go v0.0.0-
|
|
5
|
+
require github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b
|
|
6
6
|
|
|
7
7
|
require (
|
|
8
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
8
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 // indirect
|
|
9
9
|
golang.org/x/sync v0.21.0 // indirect
|
|
10
10
|
golang.org/x/sys v0.46.0 // indirect
|
|
11
11
|
)
|
package/shim/vfs/go.sum
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
2
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 h1:KZaTBSyshWX3MP5jukJcNSuXDQTO+rNpt0J564dX/eg=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
3
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
4
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
6
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
5
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
6
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
7
7
|
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
|
|
8
8
|
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
|
9
9
|
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
|