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
|
@@ -67,14 +67,15 @@ func (g *Graph) resolve(checker *shimchecker.Checker, ref *shimast.Node) *Target
|
|
|
67
67
|
return target
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// Resolve uses the checker's external
|
|
71
|
-
//
|
|
70
|
+
// Resolve uses the checker's external symbol APIs, including source-value lookup
|
|
71
|
+
// for shorthand properties and contextual property lookup for destructuring and
|
|
72
|
+
// JSX attributes, then unwraps aliases. These APIs return a contextual
|
|
72
73
|
// symbol, not a universal type-checking binding guarantee. A valid checker and
|
|
73
74
|
// parented source-tree ref are required. Nil means no reported symbol; a symbol
|
|
74
75
|
// without a source declaration can instead return a target with empty File.
|
|
75
76
|
//
|
|
76
|
-
// @evidence contracts/common.md#principled-implementation
|
|
77
|
-
// @evidence contracts/common.md#clear-and-simple-design
|
|
77
|
+
// @evidence contracts/common.md#principled-implementation Supported upstream symbol, shorthand-value and contextual-type/property queries supply endpoints for their respective syntax. Alias unwrapping and representative declaration selection prefer workspace bodies without certifying physical ownership or every expression's type-checking binding.
|
|
78
|
+
// @evidence contracts/common.md#clear-and-simple-design Syntax-specific supported checker queries feed shared alias unwrapping and declaration classification in one endpoint adapter.
|
|
78
79
|
// @evidence contracts/common.md#prohibited-implementation-shortcuts Barrel resolution uses the supported checker API rather than guessing export files or rewriting foreign state.
|
|
79
80
|
// @evidence contracts/common.md#meaningful-documentation Native prose states alias behavior, unresolved outcomes and source ownership, with documentation-skill tag spacing.
|
|
80
81
|
// @evidence contracts/performance.md#efficient-algorithms Delegated contextual lookup/alias resolution can perform lazy semantic work beyond the returned symbol. Up to three declaration passes, source ancestry and filename classification add declaration-count/depth/string costs; this adapter itself performs no repository scan.
|
|
@@ -97,11 +98,35 @@ func Resolve(checker *shimchecker.Checker, ref *shimast.Node) *Target {
|
|
|
97
98
|
return nil
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
symbol
|
|
101
|
+
var symbol *shimast.Symbol
|
|
102
|
+
switch ref.Kind {
|
|
103
|
+
case shimast.KindShorthandPropertyAssignment:
|
|
104
|
+
symbol = checker.GetShorthandAssignmentValueSymbol(ref)
|
|
105
|
+
case shimast.KindBindingElement:
|
|
106
|
+
binding := ref.AsBindingElement()
|
|
107
|
+
if ref.Parent != nil && ref.Parent.Kind == shimast.KindObjectBindingPattern && binding.DotDotDotToken == nil {
|
|
108
|
+
name := binding.PropertyName
|
|
109
|
+
if name == nil {
|
|
110
|
+
name = binding.Name()
|
|
111
|
+
}
|
|
112
|
+
if property, ok := staticObjectMemberName(name); ok {
|
|
113
|
+
symbol = checker.GetPropertyOfType(checker.GetTypeAtLocation(ref.Parent), property)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
case shimast.KindJsxAttribute:
|
|
117
|
+
if property, ok := staticObjectMemberName(ref.Name()); ok && ref.Parent != nil {
|
|
118
|
+
// Zero requests the upstream API's ordinary contextual type, with no flags.
|
|
119
|
+
if contextual := checker.GetContextualType(ref.Parent, 0); contextual != nil {
|
|
120
|
+
symbol = checker.GetPropertyOfType(contextual, property)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
symbol = checker.GetSymbolAtLocation(ref)
|
|
125
|
+
}
|
|
101
126
|
if symbol == nil {
|
|
102
127
|
return nil
|
|
103
128
|
}
|
|
104
|
-
if symbol
|
|
129
|
+
if shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsAlias != 0 {
|
|
105
130
|
if aliased := shimchecker.Checker_getAliasedSymbol(checker, symbol); aliased != nil {
|
|
106
131
|
symbol = aliased
|
|
107
132
|
}
|
|
@@ -111,7 +136,7 @@ func Resolve(checker *shimchecker.Checker, ref *shimast.Node) *Target {
|
|
|
111
136
|
target.Pos = declaration.Pos()
|
|
112
137
|
target.End = declaration.End()
|
|
113
138
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil {
|
|
114
|
-
target.File = file.FileName()
|
|
139
|
+
target.File = string(file.FileName())
|
|
115
140
|
target.External = !IsWorkspaceSourceFile(file)
|
|
116
141
|
}
|
|
117
142
|
}
|
|
@@ -131,27 +156,27 @@ func declarationFile(symbol *shimast.Symbol) *shimast.SourceFile {
|
|
|
131
156
|
}
|
|
132
157
|
|
|
133
158
|
func declarationNode(symbol *shimast.Symbol) *shimast.Node {
|
|
134
|
-
if len(symbol
|
|
159
|
+
if len(shimast.SymbolDeclarationsOf(symbol)) == 0 {
|
|
135
160
|
return nil
|
|
136
161
|
}
|
|
137
162
|
// Prefer a non-declaration-file declaration. A declaration-merged symbol (a
|
|
138
163
|
// class paired with an interface, or a function with a namespace) can list a
|
|
139
164
|
// `.d.ts` declaration first; classifying by it would mark a real workspace
|
|
140
165
|
// symbol external and sever it from the graph.
|
|
141
|
-
for _, declaration := range symbol
|
|
166
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
142
167
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil && !file.IsDeclarationFile && declaration.Body() != nil {
|
|
143
168
|
return declaration
|
|
144
169
|
}
|
|
145
170
|
}
|
|
146
|
-
for _, declaration := range symbol
|
|
171
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
147
172
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil && !file.IsDeclarationFile {
|
|
148
173
|
return declaration
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
|
-
for _, declaration := range symbol
|
|
176
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
152
177
|
if declaration.Body() != nil {
|
|
153
178
|
return declaration
|
|
154
179
|
}
|
|
155
180
|
}
|
|
156
|
-
return symbol
|
|
181
|
+
return shimast.SymbolDeclarationsOf(symbol)[0]
|
|
157
182
|
}
|
|
@@ -77,11 +77,11 @@ void echoed;
|
|
|
77
77
|
if raw == nil {
|
|
78
78
|
t.Fatal("GetSymbolAtLocation returned nil for the call-site reference")
|
|
79
79
|
}
|
|
80
|
-
if raw
|
|
80
|
+
if shimast.SymbolFlagsOf(raw)&shimast.SymbolFlagsAlias == 0 {
|
|
81
81
|
t.Fatal("premise broken: the call-site reference is not an alias, so there is no barrel hop to unwrap")
|
|
82
82
|
}
|
|
83
|
-
if rawFile := declarationFile(raw); rawFile == nil || !strings.HasSuffix(rawFile.FileName(), "main.ts") {
|
|
84
|
-
t.Fatalf("naive stop did not land on the import in main.ts: %v", raw
|
|
83
|
+
if rawFile := declarationFile(raw); rawFile == nil || !strings.HasSuffix(string(rawFile.FileName()), "main.ts") {
|
|
84
|
+
t.Fatalf("naive stop did not land on the import in main.ts: %v", shimast.SymbolDeclarationsOf(raw))
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// The bridged walk: Resolve unwraps the alias chain to the real declaration.
|
|
@@ -89,7 +89,7 @@ void echoed;
|
|
|
89
89
|
if resolved == nil {
|
|
90
90
|
t.Fatal("Resolve returned nil for the call-site reference")
|
|
91
91
|
}
|
|
92
|
-
if resolved.Symbol == nil || resolved.Symbol
|
|
92
|
+
if resolved.Symbol == nil || shimast.SymbolNameOf(resolved.Symbol) != "target" {
|
|
93
93
|
t.Fatalf("Resolve did not land on the target symbol: %+v", resolved.Symbol)
|
|
94
94
|
}
|
|
95
95
|
if !strings.HasSuffix(resolved.File, "impl.ts") {
|
|
@@ -105,7 +105,7 @@ void echoed;
|
|
|
105
105
|
// The helper selects the local declaration's first value identifier; it is a
|
|
106
106
|
// workspace node, not an external leaf.
|
|
107
107
|
local := Resolve(checker, identifier(t, main, "value"))
|
|
108
|
-
if local == nil || local.Symbol == nil || local.Symbol
|
|
108
|
+
if local == nil || local.Symbol == nil || shimast.SymbolNameOf(local.Symbol) != "value" {
|
|
109
109
|
t.Fatalf("Resolve did not bind the local const reference: %+v", local)
|
|
110
110
|
}
|
|
111
111
|
if !strings.HasSuffix(local.File, "main.ts") || local.External {
|
|
@@ -124,7 +124,7 @@ void echoed;
|
|
|
124
124
|
func sourceFile(t *testing.T, prog *driver.Program, suffix string) *shimast.SourceFile {
|
|
125
125
|
t.Helper()
|
|
126
126
|
for _, file := range prog.SourceFiles() {
|
|
127
|
-
if strings.HasSuffix(file.FileName(), suffix) {
|
|
127
|
+
if strings.HasSuffix(string(file.FileName()), suffix) {
|
|
128
128
|
return file
|
|
129
129
|
}
|
|
130
130
|
}
|
package/internal/graph/source.go
CHANGED
|
@@ -28,6 +28,6 @@ func IsWorkspaceSourceFile(file *shimast.SourceFile) bool {
|
|
|
28
28
|
if file == nil || file.IsDeclarationFile {
|
|
29
29
|
return false
|
|
30
30
|
}
|
|
31
|
-
normalized := filepath.ToSlash(file.FileName())
|
|
31
|
+
normalized := filepath.ToSlash(string(file.FileName()))
|
|
32
32
|
return !strings.Contains("/"+strings.TrimPrefix(normalized, "/"), "/node_modules/")
|
|
33
33
|
}
|
|
@@ -73,12 +73,12 @@ export const config = { a: 1 } satisfies Config;
|
|
|
73
73
|
graph := Build(prog)
|
|
74
74
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
75
75
|
|
|
76
|
-
settingsShape := nodeID(path, "SettingsShape", NodeTypeAlias)
|
|
77
|
-
settings := nodeID(path, "settings", NodeVariable)
|
|
78
|
-
coerce := nodeID(path, "coerce", NodeFunction)
|
|
79
|
-
target := nodeID(path, "Target", NodeInterface)
|
|
80
|
-
config := nodeID(path, "config", NodeVariable)
|
|
81
|
-
configType := nodeID(path, "Config", NodeInterface)
|
|
76
|
+
settingsShape := nodeID(string(path), "SettingsShape", NodeTypeAlias)
|
|
77
|
+
settings := nodeID(string(path), "settings", NodeVariable)
|
|
78
|
+
coerce := nodeID(string(path), "coerce", NodeFunction)
|
|
79
|
+
target := nodeID(string(path), "Target", NodeInterface)
|
|
80
|
+
config := nodeID(string(path), "config", NodeVariable)
|
|
81
|
+
configType := nodeID(string(path), "Config", NodeInterface)
|
|
82
82
|
|
|
83
83
|
if !hasEdge(graph, settingsShape, settings, EdgeTypeRef) {
|
|
84
84
|
t.Errorf("missing type-ref edge SettingsShape -> settings (typeof query)")
|
|
@@ -86,7 +86,7 @@ export const config = { a: 1 } satisfies Config;
|
|
|
86
86
|
if !hasEdge(graph, coerce, target, EdgeTypeRef) {
|
|
87
87
|
t.Errorf("missing type-ref edge coerce -> Target (as assertion)")
|
|
88
88
|
}
|
|
89
|
-
if !hasEdge(graph, nodeID(path, "assertionOnly", NodeFunction), target, EdgeTypeRef) {
|
|
89
|
+
if !hasEdge(graph, nodeID(string(path), "assertionOnly", NodeFunction), target, EdgeTypeRef) {
|
|
90
90
|
t.Errorf("missing type-ref edge assertionOnly -> Target without a return annotation")
|
|
91
91
|
}
|
|
92
92
|
if !hasEdge(graph, config, configType, EdgeTypeRef) {
|
|
@@ -45,8 +45,8 @@ export function use(c: Config): string {
|
|
|
45
45
|
defer func() { _ = prog.Close() }()
|
|
46
46
|
|
|
47
47
|
graph := Build(prog)
|
|
48
|
-
use := nodeID(sourceFile(t, prog, "main.ts").FileName(), "use", NodeFunction)
|
|
49
|
-
config := nodeID(sourceFile(t, prog, "types.ts").FileName(), "Config", NodeInterface)
|
|
48
|
+
use := nodeID(string(sourceFile(t, prog, "main.ts").FileName()), "use", NodeFunction)
|
|
49
|
+
config := nodeID(string(sourceFile(t, prog, "types.ts").FileName()), "Config", NodeInterface)
|
|
50
50
|
|
|
51
51
|
if !hasEdge(graph, use, config, EdgeTypeRef) {
|
|
52
52
|
t.Fatalf("missing type-ref edge use -> Config; edges: %v", graph.Edges)
|
|
@@ -68,11 +68,11 @@ export class Store {
|
|
|
68
68
|
|
|
69
69
|
graph := Build(prog)
|
|
70
70
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
71
|
-
read := nodeID(path, "Store.read", NodeMethod)
|
|
72
|
-
write := nodeID(path, "Store.write", NodeMethod)
|
|
73
|
-
count := nodeID(path, "Store.count", NodeMethod)
|
|
74
|
-
items := nodeID(path, "Store.items", NodeVariable)
|
|
75
|
-
seed := nodeID(path, "seed", NodeFunction)
|
|
71
|
+
read := nodeID(string(path), "Store.read", NodeMethod)
|
|
72
|
+
write := nodeID(string(path), "Store.write", NodeMethod)
|
|
73
|
+
count := nodeID(string(path), "Store.count", NodeMethod)
|
|
74
|
+
items := nodeID(string(path), "Store.items", NodeVariable)
|
|
75
|
+
seed := nodeID(string(path), "seed", NodeFunction)
|
|
76
76
|
|
|
77
77
|
if _, ok := graph.Nodes[items]; !ok {
|
|
78
78
|
t.Fatalf("Build did not record Store.items; have %v", nodeIDSet(graph))
|
|
@@ -51,13 +51,13 @@ export function install(inst: Service): void {
|
|
|
51
51
|
graph := Build(prog)
|
|
52
52
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
53
53
|
|
|
54
|
-
run := nodeID(path, "Service.run", NodeMethod)
|
|
55
|
-
helper := nodeID(path, "helper", NodeFunction)
|
|
54
|
+
run := nodeID(string(path), "Service.run", NodeMethod)
|
|
55
|
+
helper := nodeID(string(path), "helper", NodeFunction)
|
|
56
56
|
|
|
57
57
|
if !hasEdge(graph, run, helper, EdgeValueCall) {
|
|
58
58
|
t.Fatalf("missing value-call edge Service.run -> helper (assigned implementation); edges: %v", graph.Edges)
|
|
59
59
|
}
|
|
60
|
-
if graph.Nodes[run].ImplementationFile != path ||
|
|
60
|
+
if graph.Nodes[run].ImplementationFile != string(path) ||
|
|
61
61
|
graph.Nodes[run].ImplementationPos <= 0 ||
|
|
62
62
|
graph.Nodes[run].ImplementationEnd <= graph.Nodes[run].ImplementationPos {
|
|
63
63
|
t.Fatalf("Service.run missing assigned implementation span: %+v", graph.Nodes[run])
|
|
@@ -66,8 +66,8 @@ export function Parent(): JSX.Element {
|
|
|
66
66
|
graph := Build(prog)
|
|
67
67
|
path := sourceFile(t, prog, "main.tsx").FileName()
|
|
68
68
|
|
|
69
|
-
parent := nodeID(path, "Parent", NodeFunction)
|
|
70
|
-
child := nodeID(path, "Child", NodeFunction)
|
|
69
|
+
parent := nodeID(string(path), "Parent", NodeFunction)
|
|
70
|
+
child := nodeID(string(path), "Child", NodeFunction)
|
|
71
71
|
|
|
72
72
|
if !hasEdge(graph, parent, child, EdgeValueCall) {
|
|
73
73
|
t.Fatalf("missing value-call edge Parent -> Child (JSX component use); edges: %v", graph.Edges)
|
|
@@ -54,9 +54,9 @@ export class Controller {
|
|
|
54
54
|
graph := Build(prog)
|
|
55
55
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
56
56
|
|
|
57
|
-
handle := nodeID(path, "Controller.handle", NodeMethod)
|
|
58
|
-
run := nodeID(path, "Service.run", NodeMethod)
|
|
59
|
-
service := nodeID(path, "Service", NodeClass)
|
|
57
|
+
handle := nodeID(string(path), "Controller.handle", NodeMethod)
|
|
58
|
+
run := nodeID(string(path), "Service.run", NodeMethod)
|
|
59
|
+
service := nodeID(string(path), "Service", NodeClass)
|
|
60
60
|
|
|
61
61
|
// The callee method node both endpoints need must exist as a real node.
|
|
62
62
|
if _, ok := graph.Nodes[run]; !ok {
|
|
@@ -43,8 +43,8 @@ export const handler = (): void => {
|
|
|
43
43
|
graph := Build(prog)
|
|
44
44
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
45
45
|
|
|
46
|
-
handler := nodeID(path, "handler", NodeVariable)
|
|
47
|
-
helper := nodeID(path, "helper", NodeFunction)
|
|
46
|
+
handler := nodeID(string(path), "handler", NodeVariable)
|
|
47
|
+
helper := nodeID(string(path), "helper", NodeFunction)
|
|
48
48
|
|
|
49
49
|
if !hasEdge(graph, handler, helper, EdgeValueCall) {
|
|
50
50
|
t.Fatalf("missing value-call edge handler -> helper (variable-bound callable body); edges: %v", graph.Edges)
|
|
@@ -56,10 +56,10 @@ func TestValueCallEdgesDoNotDoubleRecordInvokedMemberAccess(t *testing.T) {
|
|
|
56
56
|
|
|
57
57
|
graph := Build(prog)
|
|
58
58
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
59
|
-
handle := nodeID(path, "handle", NodeFunction)
|
|
60
|
-
run := nodeID(path, "Providers.Service.run", NodeMethod)
|
|
61
|
-
service := nodeID(path, "Providers.Service", NodeClass)
|
|
62
|
-
html := nodeID(path, "Tags.html", NodeFunction)
|
|
59
|
+
handle := nodeID(string(path), "handle", NodeFunction)
|
|
60
|
+
run := nodeID(string(path), "Providers.Service.run", NodeMethod)
|
|
61
|
+
service := nodeID(string(path), "Providers.Service", NodeClass)
|
|
62
|
+
html := nodeID(string(path), "Tags.html", NodeFunction)
|
|
63
63
|
|
|
64
64
|
for _, target := range []string{run, service, html} {
|
|
65
65
|
if !hasEdge(graph, handle, target, EdgeValueCall) {
|
|
@@ -53,9 +53,9 @@ export class Controller {
|
|
|
53
53
|
graph := Build(prog)
|
|
54
54
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
55
55
|
|
|
56
|
-
handle := nodeID(path, "Controller.handle", NodeMethod)
|
|
57
|
-
run := nodeID(path, "Service.run", NodeMethod)
|
|
58
|
-
service := nodeID(path, "Service", NodeClass)
|
|
56
|
+
handle := nodeID(string(path), "Controller.handle", NodeMethod)
|
|
57
|
+
run := nodeID(string(path), "Service.run", NodeMethod)
|
|
58
|
+
service := nodeID(string(path), "Service", NodeClass)
|
|
59
59
|
|
|
60
60
|
if got := edgeOrigin(graph, handle, run, EdgeValueCall); got != "call" {
|
|
61
61
|
t.Fatalf("Controller.handle -> Service.run: want Origin \"call\", got %q; edges: %v", got, graph.Edges)
|
|
@@ -47,8 +47,8 @@ export function caller(): number {
|
|
|
47
47
|
defer func() { _ = prog.Close() }()
|
|
48
48
|
|
|
49
49
|
graph := Build(prog)
|
|
50
|
-
caller := nodeID(sourceFile(t, prog, "main.ts").FileName(), "caller", NodeFunction)
|
|
51
|
-
helper := nodeID(sourceFile(t, prog, "util.ts").FileName(), "helper", NodeFunction)
|
|
50
|
+
caller := nodeID(string(sourceFile(t, prog, "main.ts").FileName()), "caller", NodeFunction)
|
|
51
|
+
helper := nodeID(string(sourceFile(t, prog, "util.ts").FileName()), "helper", NodeFunction)
|
|
52
52
|
|
|
53
53
|
count := 0
|
|
54
54
|
for _, edge := range graph.Edges {
|
|
@@ -55,10 +55,10 @@ export function dynamic(host: any): void {
|
|
|
55
55
|
graph := Build(prog)
|
|
56
56
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
57
57
|
|
|
58
|
-
rec := nodeID(path, "rec", NodeFunction)
|
|
59
|
-
helper := nodeID(path, "helper", NodeFunction)
|
|
60
|
-
caller := nodeID(path, "caller", NodeFunction)
|
|
61
|
-
dynamic := nodeID(path, "dynamic", NodeFunction)
|
|
58
|
+
rec := nodeID(string(path), "rec", NodeFunction)
|
|
59
|
+
helper := nodeID(string(path), "helper", NodeFunction)
|
|
60
|
+
caller := nodeID(string(path), "caller", NodeFunction)
|
|
61
|
+
dynamic := nodeID(string(path), "dynamic", NodeFunction)
|
|
62
62
|
|
|
63
63
|
for _, id := range []string{rec, helper, caller, dynamic} {
|
|
64
64
|
if graph.Nodes[id] == nil {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
package graph
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"path/filepath"
|
|
5
|
+
"testing"
|
|
6
|
+
|
|
7
|
+
"github.com/samchon/ttsc/packages/ttsc/driver"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// Verifies named value uses survive their expression position.
|
|
11
|
+
//
|
|
12
|
+
// 1. Load isolated readers, destructuring and JSX properties with invocation and type-only controls.
|
|
13
|
+
// 2. Build checker-resolved relations from one TSX Program.
|
|
14
|
+
// 3. Require each actual reader and reject type-only, label and declaration-name dependencies.
|
|
15
|
+
//
|
|
16
|
+
// @evidence contracts/testing.md#behavioral-verification Build must record accesses to num, Props.label and Color from every authored reader, while preserving call edges without duplicate accesses and excluding type-only syntax.
|
|
17
|
+
// @evidence contracts/testing.md#independent-expectations Each literal function body independently determines whether it reads the named module value or property. Expected relationships are authored pairs rather than a snapshot of the extractor's output.
|
|
18
|
+
// @evidence contracts/testing.md#distinguishing-cases Return, arithmetic, condition, array, object, shorthand, template, assignment, anonymous closure, destructured aliases/defaults/parameters, JSX and enum uses contrast declaration names, labels, shadowed locals, type queries and direct calls. Existing tests own ordinary dotted and bracket access, dispatch and external leaves.
|
|
19
|
+
// @evidence contracts/testing.md#execution-ownership This Go unit owns a temporary TSX project, loads and closes its compiler Program and calls Build directly; no native binary, installed consumer or agent query is launched.
|
|
20
|
+
func TestValueReadsCoverExpressionPositions(t *testing.T) {
|
|
21
|
+
t.Setenv(driver.LinkedPluginsEnv, "")
|
|
22
|
+
root := t.TempDir()
|
|
23
|
+
writeFile(t, filepath.Join(root, "tsconfig.json"), `{"compilerOptions":{"strict":true,"target":"ES2022","module":"commonjs","jsx":"preserve"},"include":["src"]}`)
|
|
24
|
+
writeFile(t, filepath.Join(root, "src", "main.tsx"), "declare global { namespace JSX { type Element = unknown; interface IntrinsicElements {} } }\n"+`export const num = 1;
|
|
25
|
+
export enum Color { Red }
|
|
26
|
+
export interface Props { label: number }
|
|
27
|
+
export function Badge(props: Props) { return null; }
|
|
28
|
+
export function asArgument() { return String(num); }
|
|
29
|
+
export function returned() { return num; }
|
|
30
|
+
export function added() { return num + 1; }
|
|
31
|
+
export function tested() { if (num) return 1; return 0; }
|
|
32
|
+
export function inArray() { return [num]; }
|
|
33
|
+
export function inObject() { return { key: num }; }
|
|
34
|
+
export function shorthand() { return { num }; }
|
|
35
|
+
export function inTemplate() { return `+"`${num}`"+`; }
|
|
36
|
+
export function assigned() { const copy = num; return copy; }
|
|
37
|
+
export function closure() { return () => num; }
|
|
38
|
+
export function dotted(props: Props) { return props.label; }
|
|
39
|
+
export function destructured(props: Props) { const { label } = props; return label; }
|
|
40
|
+
export function renamed(props: Props) { const { label: renamed = num } = props; return renamed; }
|
|
41
|
+
export function parameter({ label }: Props) { return label; }
|
|
42
|
+
export function jsxAttribute() { return <Badge label={1} />; }
|
|
43
|
+
export function enumMember() { return Color.Red; }
|
|
44
|
+
export function enumBracket() { return Color["Red"]; }
|
|
45
|
+
export function invoked() { return Badge({ label: 1 }); }
|
|
46
|
+
export function onlyTypes(value: typeof num): Props { return { label: value }; }
|
|
47
|
+
export type OnlyType = { [num]: typeof num };
|
|
48
|
+
export function shadowed() { const num = 2; return num; }
|
|
49
|
+
export function labels() { num: for (;;) { break num; } }
|
|
50
|
+
`)
|
|
51
|
+
prog, diags, err := driver.LoadProgram(root, "tsconfig.json", driver.LoadProgramOptions{})
|
|
52
|
+
if err != nil {
|
|
53
|
+
t.Fatal(err)
|
|
54
|
+
}
|
|
55
|
+
defer func() { _ = prog.Close() }()
|
|
56
|
+
if len(diags) != 0 {
|
|
57
|
+
t.Fatalf("unexpected diagnostics: %v", diags)
|
|
58
|
+
}
|
|
59
|
+
g := Build(prog)
|
|
60
|
+
file := sourceFile(t, prog, "main.tsx").FileName()
|
|
61
|
+
for _, reader := range []string{"asArgument", "returned", "added", "tested", "inArray", "inObject", "shorthand", "inTemplate", "assigned", "closure", "renamed"} {
|
|
62
|
+
if !hasEdge(g, nodeID(string(file), reader, NodeFunction), nodeID(string(file), "num", NodeVariable), EdgeValueAccess) {
|
|
63
|
+
t.Errorf("%s lost num read", reader)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for _, reader := range []string{"dotted", "destructured", "renamed", "parameter", "jsxAttribute"} {
|
|
67
|
+
if !hasEdge(g, nodeID(string(file), reader, NodeFunction), nodeID(string(file), "Props.label", NodeVariable), EdgeValueAccess) {
|
|
68
|
+
t.Errorf("%s lost Props.label read", reader)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for _, reader := range []string{"enumMember", "enumBracket"} {
|
|
72
|
+
if !hasEdge(g, nodeID(string(file), reader, NodeFunction), nodeID(string(file), "Color", NodeEnum), EdgeValueAccess) {
|
|
73
|
+
t.Errorf("%s lost enum read", reader)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for _, reader := range []string{"onlyTypes", "shadowed", "labels"} {
|
|
77
|
+
if hasEdge(g, nodeID(string(file), reader, NodeFunction), nodeID(string(file), "num", NodeVariable), EdgeValueAccess) {
|
|
78
|
+
t.Errorf("%s invented num read", reader)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if hasEdge(g, nodeID(string(file), "OnlyType", NodeTypeAlias), nodeID(string(file), "num", NodeVariable), EdgeValueAccess) {
|
|
82
|
+
t.Error("type-literal computed name invented a runtime read")
|
|
83
|
+
}
|
|
84
|
+
from, to := nodeID(string(file), "invoked", NodeFunction), nodeID(string(file), "Badge", NodeFunction)
|
|
85
|
+
if !hasEdge(g, from, to, EdgeValueCall) || hasEdge(g, from, to, EdgeValueAccess) {
|
|
86
|
+
t.Error("direct invocation must retain only its call edge")
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
* the in-memory API compilation paths (`compileProjectInMemory`,
|
|
4
4
|
* `transformProjectInMemory`).
|
|
5
5
|
*
|
|
6
|
-
* The host is the `cmd/ttsc` Go entrypoint compiled with `buildSourcePlugin
|
|
6
|
+
* The host is the `cmd/ttsc` Go entrypoint compiled with `buildSourcePlugin`
|
|
7
|
+
* against the compiler target of the project's TypeScript line. The 7.0 host
|
|
8
|
+
* builds from the ttsc module alone, whose own go.mod replaces the 7.0 shims;
|
|
9
|
+
* the 7.1 host overlays its bridges and facades and carries the 7.1 build tag.
|
|
7
10
|
* The cache key incorporates the ttsc package version and the full `go.mod`
|
|
8
11
|
* contents as supplemental cache tokens. Actual source and selected toolchain
|
|
9
12
|
* identity are established by the owning builder; metadata labels alone do not
|
|
10
13
|
* certify every toolchain upgrade.
|
|
11
14
|
*
|
|
12
15
|
* @returns Absolute path to the compiled host executable.
|
|
13
|
-
* @evidence contracts/common.md#principled-implementation The compiler host is the package's cmd/ttsc Go source built by the same source-plugin artifact owner; package version and full module text supplement that owner's source and environment identity.
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation The compiler host is the package's cmd/ttsc Go source built by the same source-plugin artifact owner against the project's compiler target, so in-memory compilation checks with the compiler the project's tsc runs; package version and full module text supplement that owner's source and environment identity, and the target's tag and overlays enter it.
|
|
14
17
|
* @evidence contracts/common.md#clear-and-simple-design This adapter supplies the host source, cache anchor and version tokens while buildSourcePlugin owns compilation, locking and artifact admission.
|
|
15
18
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Version read fallbacks label unavailable metadata; they do not replace the owning builder's actual source/environment proof or synthesize a binary path.
|
|
16
19
|
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the compiler consumers and version-token inputs; separated option members distinguish project cache base, optional override and package source root.
|
|
@@ -6,20 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.buildNativeCompiler = buildNativeCompiler;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const CompilerTarget_1 = require("../../plugin/internal/source/CompilerTarget");
|
|
10
|
+
const SourcePluginWorkspace_1 = require("../../plugin/internal/source/SourcePluginWorkspace");
|
|
9
11
|
const buildSourcePlugin_1 = require("../../plugin/internal/source/buildSourcePlugin");
|
|
12
|
+
const SidecarEnvironment_1 = require("./sharedHost/SidecarEnvironment");
|
|
10
13
|
/**
|
|
11
14
|
* Build (or retrieve from cache) the native ttsc compiler host binary used by
|
|
12
15
|
* the in-memory API compilation paths (`compileProjectInMemory`,
|
|
13
16
|
* `transformProjectInMemory`).
|
|
14
17
|
*
|
|
15
|
-
* The host is the `cmd/ttsc` Go entrypoint compiled with `buildSourcePlugin
|
|
18
|
+
* The host is the `cmd/ttsc` Go entrypoint compiled with `buildSourcePlugin`
|
|
19
|
+
* against the compiler target of the project's TypeScript line. The 7.0 host
|
|
20
|
+
* builds from the ttsc module alone, whose own go.mod replaces the 7.0 shims;
|
|
21
|
+
* the 7.1 host overlays its bridges and facades and carries the 7.1 build tag.
|
|
16
22
|
* The cache key incorporates the ttsc package version and the full `go.mod`
|
|
17
23
|
* contents as supplemental cache tokens. Actual source and selected toolchain
|
|
18
24
|
* identity are established by the owning builder; metadata labels alone do not
|
|
19
25
|
* certify every toolchain upgrade.
|
|
20
26
|
*
|
|
21
27
|
* @returns Absolute path to the compiled host executable.
|
|
22
|
-
* @evidence contracts/common.md#principled-implementation The compiler host is the package's cmd/ttsc Go source built by the same source-plugin artifact owner; package version and full module text supplement that owner's source and environment identity.
|
|
28
|
+
* @evidence contracts/common.md#principled-implementation The compiler host is the package's cmd/ttsc Go source built by the same source-plugin artifact owner against the project's compiler target, so in-memory compilation checks with the compiler the project's tsc runs; package version and full module text supplement that owner's source and environment identity, and the target's tag and overlays enter it.
|
|
23
29
|
* @evidence contracts/common.md#clear-and-simple-design This adapter supplies the host source, cache anchor and version tokens while buildSourcePlugin owns compilation, locking and artifact admission.
|
|
24
30
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Version read fallbacks label unavailable metadata; they do not replace the owning builder's actual source/environment proof or synthesize a binary path.
|
|
25
31
|
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the compiler consumers and version-token inputs; separated option members distinguish project cache base, optional override and package source root.
|
|
@@ -31,12 +37,14 @@ const buildSourcePlugin_1 = require("../../plugin/internal/source/buildSourcePlu
|
|
|
31
37
|
* @evidence contracts/portability.md#os-neutral-implementation Node path joining selects the package source directory and the owning builder selects native executable/toolchain behavior; no shell command or fixed platform executable name is constructed here.
|
|
32
38
|
*/
|
|
33
39
|
function buildNativeCompiler(options) {
|
|
40
|
+
const callerEnv = SidecarEnvironment_1.SidecarEnvironment.merge(options.env ?? process.env);
|
|
41
|
+
const line = CompilerTarget_1.CompilerTarget.resolve(options.cacheBaseDir, callerEnv);
|
|
34
42
|
return (0, buildSourcePlugin_1.buildSourcePlugin)({
|
|
35
43
|
baseDir: options.cacheBaseDir,
|
|
36
44
|
cacheDir: options.cacheDir,
|
|
37
|
-
env: options.
|
|
45
|
+
env: CompilerTarget_1.CompilerTarget.buildEnv(callerEnv, line, options.cacheBaseDir),
|
|
38
46
|
label: "compiler host",
|
|
39
|
-
overlayDirs: [],
|
|
47
|
+
overlayDirs: line === "7.0" ? [] : SourcePluginWorkspace_1.SourcePluginWorkspace.findTtscOverlayDirs(line),
|
|
40
48
|
pluginName: "ttsc",
|
|
41
49
|
quiet: true,
|
|
42
50
|
source: node_path_1.default.join(options.packageRoot, "cmd", "ttsc"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildNativeCompiler.js","sourceRoot":"","sources":["../../../src/compiler/internal/buildNativeCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,sFAAmF;
|
|
1
|
+
{"version":3,"file":"buildNativeCompiler.js","sourceRoot":"","sources":["../../../src/compiler/internal/buildNativeCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,gFAA6E;AAC7E,8FAA2F;AAC3F,sFAAmF;AACnF,wEAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,6BAAoC,OAYnC;IACC,MAAM,SAAS,GAAG,uCAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,+BAAc,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACrE,OAAO,IAAA,qCAAiB,EAAC;QACvB,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,EAAE,+BAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC;QACnE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6CAAqB,CAAC,mBAAmB,CAAC,IAAI,CAAC;QACvE,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC;QACrD,WAAW,EAAE,qBAAqB,CAAC,OAAO,CAAC,WAAW,CAAC;QACvD,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAAC,WAAmB;IAChD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,iBAAE,CAAC,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACvC,CAAC;QAC3B,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,IAAI,CAAC;QACH,OAAO,iBAAE,CAAC,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by packages/ttsc/scripts/gen-flags.mts. DO NOT EDIT.
|
|
3
|
-
// Source of truth: pinned
|
|
3
|
+
// Source of truth: pinned TypeScript 7.0 and 7.1 OptionsDeclarations and OptionsForWatch.
|
|
4
4
|
// Regenerate with: pnpm format
|
|
5
5
|
// Verify in CI with: node packages/ttsc/scripts/check-flags.cjs
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"COMPILER_ENUM_WHITESPACE.js","sourceRoot":"","sources":["../../src/flags/COMPILER_ENUM_WHITESPACE.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"COMPILER_ENUM_WHITESPACE.js","sourceRoot":"","sources":["../../src/flags/COMPILER_ENUM_WHITESPACE.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,0FAA0F;AAC1F,+BAA+B;AAC/B,gEAAgE;;;AAEhE,wEAAwE;AAC3D,QAAA,wBAAwB,GAAwB,IAAI,GAAG,CAAS;IAC3E,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH;CACD;IACC;CACD;IACC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC,CAAC"}
|