ttsc 0.33.1 → 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_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 +9 -9
- 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 +17 -17
- 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 +1 -1
- 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 +49 -38
- 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 +5 -5
- 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 +7 -7
- 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 +6 -6
- 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
|
@@ -6,6 +6,7 @@ import (
|
|
|
6
6
|
|
|
7
7
|
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
8
8
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
9
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
// PluginEmitError reports compiler errors from a native plugin emit. The same
|
|
@@ -63,7 +64,7 @@ func (p *Program) pluginEmitDiagnostics(phase string, raw []*shimast.Diagnostic)
|
|
|
63
64
|
Diagnostics: diagnostics,
|
|
64
65
|
Phase: phase,
|
|
65
66
|
Declarations: p.TSProgram.Options().GetEmitDeclarations(),
|
|
66
|
-
cwd: p.TSProgram.GetCurrentDirectory(),
|
|
67
|
+
cwd: string(p.TSProgram.GetCurrentDirectory()),
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -74,22 +75,22 @@ type pluginEmitOutput struct {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
type pluginEmitFile struct {
|
|
77
|
-
name
|
|
78
|
+
name shimtspath.RootedFilePath
|
|
78
79
|
text string
|
|
79
80
|
data *shimcompiler.WriteFileData
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
func newPluginEmitOutput(writeFile shimcompiler.WriteFile, buffered bool) *pluginEmitOutput {
|
|
83
84
|
if writeFile == nil {
|
|
84
|
-
writeFile = func(name, text string, _ *shimcompiler.WriteFileData) error {
|
|
85
|
-
return DefaultWriteFile(name, text)
|
|
85
|
+
writeFile = func(name shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
|
|
86
|
+
return DefaultWriteFile(string(name), text)
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
return &pluginEmitOutput{writeFile: writeFile, buffered: buffered}
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
// The caller serializes declaration writes; JavaScript and flush are serial.
|
|
92
|
-
func (o *pluginEmitOutput) write(name, text string, data *shimcompiler.WriteFileData) error {
|
|
93
|
+
func (o *pluginEmitOutput) write(name shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
93
94
|
if !o.buffered {
|
|
94
95
|
return o.writeFile(name, text, data)
|
|
95
96
|
}
|
|
@@ -52,43 +52,40 @@ func (p *Program) NewEmitProvenanceRecorder(writeFile shimcompiler.WriteFile) (s
|
|
|
52
52
|
program := p.TSProgram
|
|
53
53
|
observer := p.inputObserver
|
|
54
54
|
cwd := program.GetCurrentDirectory()
|
|
55
|
-
|
|
55
|
+
caseSensitivity := shimcompiler.ProgramCaseSensitivity(program)
|
|
56
56
|
nativePath := func(name string) string {
|
|
57
57
|
return filepath.FromSlash(shimtspath.GetNormalizedAbsolutePath(name, cwd))
|
|
58
58
|
}
|
|
59
59
|
coordinateKey := func(name string) string {
|
|
60
|
-
return shimtspath.
|
|
61
|
-
shimtspath.NormalizePath(nativePath(name)),
|
|
62
|
-
caseSensitive,
|
|
63
|
-
)
|
|
60
|
+
return shimtspath.Canonicalize(caseSensitivity, shimtspath.NormalizePath(nativePath(name)))
|
|
64
61
|
}
|
|
65
62
|
candidates := map[string][]string{}
|
|
66
63
|
host := &pluginEmitHost{program: program}
|
|
67
|
-
for _, source := range shimcompiler.
|
|
68
|
-
output := shimcompiler.
|
|
69
|
-
switch strings.ToLower(filepath.Ext(output)) {
|
|
64
|
+
for _, source := range shimcompiler.SourceFilesToEmit(host) {
|
|
65
|
+
output := shimcompiler.OutputPathsFor(source, program.Options(), host).JsFilePath()
|
|
66
|
+
switch strings.ToLower(filepath.Ext(string(output))) {
|
|
70
67
|
case ".js", ".jsx", ".mjs", ".cjs":
|
|
71
|
-
key := coordinateKey(output)
|
|
72
|
-
candidates[key] = append(candidates[key], nativePath(source.FileName()))
|
|
68
|
+
key := coordinateKey(string(output))
|
|
69
|
+
candidates[key] = append(candidates[key], nativePath(string(source.FileName())))
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
if writeFile == nil {
|
|
76
|
-
writeFile = func(name, text string, _ *shimcompiler.WriteFileData) error {
|
|
77
|
-
return DefaultWriteFile(name, text)
|
|
73
|
+
writeFile = func(name shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
|
|
74
|
+
return DefaultWriteFile(string(name), text)
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
77
|
written := map[string]string{}
|
|
81
78
|
var mu sync.Mutex
|
|
82
|
-
record := func(name, text string, data *shimcompiler.WriteFileData) error {
|
|
79
|
+
record := func(name shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
83
80
|
mu.Lock()
|
|
84
81
|
defer mu.Unlock()
|
|
85
82
|
if err := writeFile(name, text, data); err != nil {
|
|
86
83
|
return err
|
|
87
84
|
}
|
|
88
85
|
if data == nil || !data.SkippedDtsWrite {
|
|
89
|
-
switch strings.ToLower(filepath.Ext(name)) {
|
|
86
|
+
switch strings.ToLower(filepath.Ext(string(name))) {
|
|
90
87
|
case ".js", ".jsx", ".mjs", ".cjs":
|
|
91
|
-
written[nativePath(name)] = coordinateKey(name)
|
|
88
|
+
written[nativePath(string(name))] = coordinateKey(string(name))
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
91
|
return nil
|
package/driver/graph.go
CHANGED
|
@@ -103,10 +103,10 @@ func NewTransformGraph(prog *Program, cwd string) *TransformGraph {
|
|
|
103
103
|
}
|
|
104
104
|
for _, file := range prog.TSProgram.SourceFiles() {
|
|
105
105
|
fileName := file.FileName()
|
|
106
|
-
if strings.HasPrefix(fileName, bundledScheme) {
|
|
106
|
+
if strings.HasPrefix(string(fileName), bundledScheme) {
|
|
107
107
|
continue
|
|
108
108
|
}
|
|
109
|
-
key := TransformOutputKey(cwd, fileName)
|
|
109
|
+
key := TransformOutputKey(cwd, string(fileName))
|
|
110
110
|
if shimcompiler.FileAffectsGlobalScope(file) {
|
|
111
111
|
graph.Globals = append(graph.Globals, key)
|
|
112
112
|
}
|
|
@@ -216,17 +216,17 @@ func referenceTargets(prog *Program, cwd string, file *ast.SourceFile) []string
|
|
|
216
216
|
paths := shimcompiler.GetReferencedFilePaths(prog.TSProgram, file)
|
|
217
217
|
targets := make([]string, 0, len(paths))
|
|
218
218
|
for _, referencedPath := range paths {
|
|
219
|
-
// Referenced paths are case-canonicalized tspath.
|
|
219
|
+
// Referenced paths are case-canonicalized tspath.PathKey values; recover the
|
|
220
220
|
// resident source and its real spelling from the Program. The incremental
|
|
221
221
|
// helper can retain a raw extensionless project-reference directive even
|
|
222
222
|
// when no corresponding source became resident. That spelling is a
|
|
223
223
|
// resolver candidate, not a realized graph edge, and has no compiler-time
|
|
224
224
|
// content proof.
|
|
225
|
-
resolved := prog.TSProgram.GetSourceFileByPath(shimtspath.
|
|
226
|
-
if resolved == nil || resolved == file || strings.HasPrefix(resolved.FileName(), bundledScheme) {
|
|
225
|
+
resolved := prog.TSProgram.GetSourceFileByPath(shimtspath.PathKey(referencedPath))
|
|
226
|
+
if resolved == nil || resolved == file || strings.HasPrefix(string(resolved.FileName()), bundledScheme) {
|
|
227
227
|
continue
|
|
228
228
|
}
|
|
229
|
-
targets = append(targets, TransformOutputKey(cwd, resolved.FileName()))
|
|
229
|
+
targets = append(targets, TransformOutputKey(cwd, string(resolved.FileName())))
|
|
230
230
|
}
|
|
231
231
|
sort.Strings(targets)
|
|
232
232
|
return targets
|
|
@@ -241,10 +241,10 @@ func configChain(prog *Program, cwd string) []string {
|
|
|
241
241
|
return configs
|
|
242
242
|
}
|
|
243
243
|
if source := parsed.ConfigFile.SourceFile; source != nil {
|
|
244
|
-
configs = append(configs, TransformOutputKey(cwd, source.FileName()))
|
|
244
|
+
configs = append(configs, TransformOutputKey(cwd, string(source.FileName())))
|
|
245
245
|
}
|
|
246
246
|
for _, extended := range parsed.ExtendedSourceFiles() {
|
|
247
|
-
configs = append(configs, TransformOutputKey(cwd, extended))
|
|
247
|
+
configs = append(configs, TransformOutputKey(cwd, string(extended)))
|
|
248
248
|
}
|
|
249
249
|
return configs
|
|
250
250
|
}
|
package/driver/host.go
CHANGED
|
@@ -12,6 +12,7 @@ package driver
|
|
|
12
12
|
import (
|
|
13
13
|
"github.com/microsoft/typescript-go/shim/bundled"
|
|
14
14
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
15
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
15
16
|
"github.com/microsoft/typescript-go/shim/vfs"
|
|
16
17
|
"github.com/microsoft/typescript-go/shim/vfs/cachedvfs"
|
|
17
18
|
"github.com/microsoft/typescript-go/shim/vfs/osvfs"
|
|
@@ -34,21 +35,30 @@ func DefaultFS() vfs.FS {
|
|
|
34
35
|
return bundled.WrapFS(cachedvfs.From(osvfs.FS()))
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
// DefaultHost returns a CompilerHost
|
|
38
|
-
//
|
|
38
|
+
// DefaultHost returns a CompilerHost over fs that can find tsgo's bundled
|
|
39
|
+
// library files via `bundled.LibPath()`. On the TypeScript 7.0 target the host
|
|
40
|
+
// carries cwd as the Program's working directory; on 7.1 the parsed command
|
|
41
|
+
// line's base directory anchors a Program, and cwd is unused.
|
|
39
42
|
// The constructor retains the supplied cwd and FS without independently
|
|
40
43
|
// normalizing or probing that anchor. In noembed builds the native library
|
|
41
44
|
// provider initializes a process-wide disk location, which can perform native
|
|
42
45
|
// queries or panic if its required library layout is unavailable.
|
|
43
46
|
//
|
|
44
|
-
// @evidence contracts/common.md#principled-implementation The supplied FS and cwd are passed to the upstream CompilerHost with the matching bundled-library location.
|
|
47
|
+
// @evidence contracts/common.md#principled-implementation The supplied FS and cwd are passed to the target's upstream CompilerHost constructor through shimcompiler.NewHost with the matching bundled-library location.
|
|
45
48
|
// @evidence contracts/common.md#clear-and-simple-design Host construction stays in one adapter used by initial and incremental program creation.
|
|
46
49
|
// @evidence contracts/common.md#prohibited-implementation-shortcuts The supported CompilerHost constructor owns behavior without an injected foreign-method replacement.
|
|
47
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose names
|
|
50
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose names each target's use of cwd and bundled library lookup under documentation-skill guidance.
|
|
48
51
|
// @evidence contracts/portability.md#os-neutral-implementation The host uses the supplied filesystem's native capabilities and upstream path handling rather than hardcoded OS path rules.
|
|
49
52
|
// @evidence contracts/performance.md#bound-retention-and-release-resources The new host transfers its cwd/library strings and supplied FS reference to the caller; keeping it reachable also keeps that FS stack and its caches reachable. The factory adds no separate host cache, handle or release operation.
|
|
50
53
|
// @evidence contracts/performance.md#efficient-algorithms Host allocation initializes fixed fields; embedded library location is a constant, while first noembed location initialization can query executable/realpath/library metadata under the native provider's once cache. This constructor does not parse source files, but delegated location work is not universally a fixed field assignment.
|
|
51
54
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work Each returned host retains its supplied cwd/FS without a driver-owned cache or request coordinator; the native library provider owns any process-wide location sharing.
|
|
52
55
|
func DefaultHost(cwd string, fs vfs.FS) shimcompiler.CompilerHost {
|
|
53
|
-
return shimcompiler.
|
|
56
|
+
return shimcompiler.NewHost(shimtspath.RootedDirectoryPath(cwd), fs, shimtspath.RootedDirectoryPath(bundled.LibPath()))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// projectHost is DefaultHost for a Program built from a parsed project: on the
|
|
60
|
+
// TypeScript 7.1 target, hosts transforms the project's content-mapped files
|
|
61
|
+
// through its content mappers. A nil hosts yields DefaultHost's host.
|
|
62
|
+
func projectHost(hosts *shimcompiler.ProjectHosts, cwd string, fs vfs.FS) shimcompiler.CompilerHost {
|
|
63
|
+
return hosts.Host(shimtspath.RootedDirectoryPath(cwd), fs, shimtspath.RootedDirectoryPath(bundled.LibPath()))
|
|
54
64
|
}
|
|
@@ -142,7 +142,7 @@ type observedInput struct {
|
|
|
142
142
|
// of attaching post-compile disk hashes to an earlier result.
|
|
143
143
|
type inputObservationFS struct {
|
|
144
144
|
vfs.FS
|
|
145
|
-
|
|
145
|
+
caseSensitivity shimtspath.CaseSensitivity
|
|
146
146
|
mu sync.Mutex
|
|
147
147
|
observations map[string]observedInput
|
|
148
148
|
observationOrder []string
|
|
@@ -152,14 +152,15 @@ type inputObservationFS struct {
|
|
|
152
152
|
func newInputObservationFS(inner vfs.FS) *inputObservationFS {
|
|
153
153
|
return &inputObservationFS{
|
|
154
154
|
FS: inner,
|
|
155
|
-
|
|
155
|
+
caseSensitivity: vfs.CaseSensitivityOf(inner),
|
|
156
156
|
observations: map[string]observedInput{},
|
|
157
157
|
observationSpellings: map[string]string{},
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
func (fs *inputObservationFS) FileExists(
|
|
162
|
-
exists := fs.FS.FileExists(
|
|
161
|
+
func (fs *inputObservationFS) FileExists(file shimtspath.RootedFilePath) bool {
|
|
162
|
+
exists := fs.FS.FileExists(file)
|
|
163
|
+
path := shimtspath.RootedPath(file)
|
|
163
164
|
proof := TransformInputObservation{FileExists: boolPointer(exists)}
|
|
164
165
|
if exists {
|
|
165
166
|
// Existence participates in resolution, but only ReadFile returns bytes
|
|
@@ -171,8 +172,9 @@ func (fs *inputObservationFS) FileExists(path string) bool {
|
|
|
171
172
|
return exists
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
func (fs *inputObservationFS) ReadFile(
|
|
175
|
-
contents, ok := fs.FS.ReadFile(
|
|
175
|
+
func (fs *inputObservationFS) ReadFile(file shimtspath.RootedFilePath) (string, bool) {
|
|
176
|
+
contents, ok := fs.FS.ReadFile(file)
|
|
177
|
+
path := shimtspath.RootedPath(file)
|
|
176
178
|
if ok {
|
|
177
179
|
digest := sha256.Sum256([]byte(contents))
|
|
178
180
|
hash := hex.EncodeToString(digest[:])
|
|
@@ -192,8 +194,9 @@ func (fs *inputObservationFS) ReadFile(path string) (string, bool) {
|
|
|
192
194
|
return contents, ok
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
func (fs *inputObservationFS) DirectoryExists(
|
|
196
|
-
exists := fs.FS.DirectoryExists(
|
|
197
|
+
func (fs *inputObservationFS) DirectoryExists(directory shimtspath.RootedDirectoryPath) bool {
|
|
198
|
+
exists := fs.FS.DirectoryExists(directory)
|
|
199
|
+
path := shimtspath.RootedPath(directory)
|
|
197
200
|
proof := TransformInputObservation{DirectoryExists: boolPointer(exists)}
|
|
198
201
|
if exists {
|
|
199
202
|
proof.Realpath = fs.currentRealpath(path)
|
|
@@ -202,9 +205,9 @@ func (fs *inputObservationFS) DirectoryExists(path string) bool {
|
|
|
202
205
|
return exists
|
|
203
206
|
}
|
|
204
207
|
|
|
205
|
-
func (fs *inputObservationFS) GetAccessibleEntries(
|
|
206
|
-
entries := fs.FS.GetAccessibleEntries(
|
|
207
|
-
fs.observe(
|
|
208
|
+
func (fs *inputObservationFS) GetAccessibleEntries(directory shimtspath.RootedDirectoryPath) vfs.Entries {
|
|
209
|
+
entries := fs.FS.GetAccessibleEntries(directory)
|
|
210
|
+
fs.observe(shimtspath.RootedPath(directory), observedInput{
|
|
208
211
|
proof: TransformInputObservation{
|
|
209
212
|
AccessibleEntries: &TransformInputEntriesObservation{
|
|
210
213
|
Directories: append([]string{}, entries.Directories...),
|
|
@@ -215,7 +218,7 @@ func (fs *inputObservationFS) GetAccessibleEntries(path string) vfs.Entries {
|
|
|
215
218
|
return entries
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
func (fs *inputObservationFS) Stat(path
|
|
221
|
+
func (fs *inputObservationFS) Stat(path shimtspath.RootedPath) vfs.FileInfo {
|
|
219
222
|
info := fs.FS.Stat(path)
|
|
220
223
|
kind := "missing"
|
|
221
224
|
if info == nil {
|
|
@@ -242,16 +245,16 @@ func (fs *inputObservationFS) Stat(path string) vfs.FileInfo {
|
|
|
242
245
|
return info
|
|
243
246
|
}
|
|
244
247
|
|
|
245
|
-
func (fs *inputObservationFS) Realpath(path
|
|
248
|
+
func (fs *inputObservationFS) Realpath(path shimtspath.RootedPath) shimtspath.RootedPath {
|
|
246
249
|
realpath := fs.FS.Realpath(path)
|
|
247
250
|
fs.observe(path, observedInput{
|
|
248
|
-
proof: TransformInputObservation{Realpath: realpathObservation(realpath)},
|
|
251
|
+
proof: TransformInputObservation{Realpath: realpathObservation(string(realpath))},
|
|
249
252
|
})
|
|
250
253
|
return realpath
|
|
251
254
|
}
|
|
252
255
|
|
|
253
|
-
func (fs *inputObservationFS) currentRealpath(path
|
|
254
|
-
return realpathObservation(fs.FS.Realpath(path))
|
|
256
|
+
func (fs *inputObservationFS) currentRealpath(path shimtspath.RootedPath) *TransformInputRealpathObservation {
|
|
257
|
+
return realpathObservation(string(fs.FS.Realpath(path)))
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
func realpathObservation(realpath string) *TransformInputRealpathObservation {
|
|
@@ -272,13 +275,11 @@ func (fs *inputObservationFS) observationKey(path string) string {
|
|
|
272
275
|
if !filepath.IsAbs(path) {
|
|
273
276
|
return ""
|
|
274
277
|
}
|
|
275
|
-
return shimtspath.
|
|
276
|
-
shimtspath.NormalizePath(path),
|
|
277
|
-
fs.caseSensitive,
|
|
278
|
-
)
|
|
278
|
+
return shimtspath.Canonicalize(fs.caseSensitivity, shimtspath.NormalizePath(path))
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
func (fs *inputObservationFS) observe(
|
|
281
|
+
func (fs *inputObservationFS) observe(rooted shimtspath.RootedPath, next observedInput) {
|
|
282
|
+
path := string(rooted)
|
|
282
283
|
key := fs.observationKey(path)
|
|
283
284
|
if key == "" {
|
|
284
285
|
return
|
|
@@ -9,6 +9,7 @@ import (
|
|
|
9
9
|
"runtime"
|
|
10
10
|
"testing"
|
|
11
11
|
|
|
12
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
12
13
|
"github.com/samchon/ttsc/packages/ttsc/driver/windowsjunction"
|
|
13
14
|
)
|
|
14
15
|
|
|
@@ -23,13 +24,13 @@ func TestInputObservationFSRejectsRestoredContent(t *testing.T) {
|
|
|
23
24
|
t.Fatal(err)
|
|
24
25
|
}
|
|
25
26
|
observed := newInputObservationFS(DefaultFS())
|
|
26
|
-
if contents, ok := observed.ReadFile(file); !ok || contents != "A" {
|
|
27
|
+
if contents, ok := observed.ReadFile(shimtspath.RootedFilePathFromAbsolute(file)); !ok || contents != "A" {
|
|
27
28
|
t.Fatalf("first read = %q, %v", contents, ok)
|
|
28
29
|
}
|
|
29
30
|
if err := os.WriteFile(file, []byte("B"), 0o644); err != nil {
|
|
30
31
|
t.Fatal(err)
|
|
31
32
|
}
|
|
32
|
-
if contents, ok := observed.ReadFile(file); !ok || contents != "B" {
|
|
33
|
+
if contents, ok := observed.ReadFile(shimtspath.RootedFilePathFromAbsolute(file)); !ok || contents != "B" {
|
|
33
34
|
t.Fatalf("second read = %q, %v", contents, ok)
|
|
34
35
|
}
|
|
35
36
|
if err := os.WriteFile(file, []byte("A"), 0o644); err != nil {
|
|
@@ -53,16 +54,16 @@ func TestInputObservationFSProvesReadBytesAndMissingCandidates(t *testing.T) {
|
|
|
53
54
|
t.Fatal(err)
|
|
54
55
|
}
|
|
55
56
|
observed := newInputObservationFS(DefaultFS())
|
|
56
|
-
if !observed.FileExists(file) {
|
|
57
|
+
if !observed.FileExists(shimtspath.RootedFilePathFromAbsolute(file)) {
|
|
57
58
|
t.Fatal("selected file was not found")
|
|
58
59
|
}
|
|
59
60
|
if _, _, failure := observed.proof(file); failure != inputProofContentUnavailable {
|
|
60
61
|
t.Fatalf("existence-only proof failure = %q, want %q", failure, inputProofContentUnavailable)
|
|
61
62
|
}
|
|
62
|
-
if _, ok := observed.ReadFile(file); !ok {
|
|
63
|
+
if _, ok := observed.ReadFile(shimtspath.RootedFilePathFromAbsolute(file)); !ok {
|
|
63
64
|
t.Fatal("selected file was not read")
|
|
64
65
|
}
|
|
65
|
-
if observed.FileExists(missing) {
|
|
66
|
+
if observed.FileExists(shimtspath.RootedFilePathFromAbsolute(missing)) {
|
|
66
67
|
t.Fatal("missing candidate unexpectedly exists")
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -109,10 +110,10 @@ func testInputObservationFSKeepsFileAndDirectoryPredicatesIndependent(t *testing
|
|
|
109
110
|
t.Fatal(err)
|
|
110
111
|
}
|
|
111
112
|
observed := newInputObservationFS(DefaultFS())
|
|
112
|
-
if observed.FileExists(directory) {
|
|
113
|
+
if observed.FileExists(shimtspath.RootedFilePathFromAbsolute(directory)) {
|
|
113
114
|
t.Fatal("directory unexpectedly satisfied FileExists")
|
|
114
115
|
}
|
|
115
|
-
if !observed.DirectoryExists(directory) {
|
|
116
|
+
if !observed.DirectoryExists(shimtspath.RootedDirectoryPathFromAbsolute(directory)) {
|
|
116
117
|
t.Fatal("directory did not satisfy DirectoryExists")
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -310,7 +311,7 @@ func TestInputObservationFSHashesCompilerDecodedText(t *testing.T) {
|
|
|
310
311
|
t.Fatal(err)
|
|
311
312
|
}
|
|
312
313
|
observed := newInputObservationFS(DefaultFS())
|
|
313
|
-
contents, ok := observed.ReadFile(file)
|
|
314
|
+
contents, ok := observed.ReadFile(shimtspath.RootedFilePathFromAbsolute(file))
|
|
314
315
|
if !ok || contents != text {
|
|
315
316
|
t.Fatalf("compiler read = %q, %v; want decoded text", contents, ok)
|
|
316
317
|
}
|
|
@@ -349,10 +350,10 @@ func TestInputObservationFSJoinsSelectedAliasProbeToPhysicalRead(t *testing.T) {
|
|
|
349
350
|
}
|
|
350
351
|
lexical := filepath.Join(alias, "value.js")
|
|
351
352
|
observed := newInputObservationFS(DefaultFS())
|
|
352
|
-
if !observed.FileExists(lexical) {
|
|
353
|
+
if !observed.FileExists(shimtspath.RootedFilePathFromAbsolute(lexical)) {
|
|
353
354
|
t.Fatal("selected lexical alias was not found")
|
|
354
355
|
}
|
|
355
|
-
if _, ok := observed.ReadFile(physical); !ok {
|
|
356
|
+
if _, ok := observed.ReadFile(shimtspath.RootedFilePathFromAbsolute(physical)); !ok {
|
|
356
357
|
t.Fatal("selected physical source was not read")
|
|
357
358
|
}
|
|
358
359
|
|
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)
|