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
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ A `typescript-go` toolchain for compiler-powered plugins and type-safe execution
|
|
|
21
21
|
npm install -D ttsc typescript
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
`ttsc` runs the native TypeScript compiler installed beside it, so the project needs `typescript` 7.0 or later.
|
|
25
|
+
|
|
24
26
|
```bash
|
|
25
27
|
npx ttsx src/index.ts # run a file, type-checked first
|
|
26
28
|
npx ttsc # build
|
package/cmd/ttsc/api_compile.go
CHANGED
|
@@ -13,6 +13,7 @@ import (
|
|
|
13
13
|
"os"
|
|
14
14
|
|
|
15
15
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
16
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
16
17
|
|
|
17
18
|
"github.com/samchon/ttsc/packages/ttsc/driver"
|
|
18
19
|
cwdutil "github.com/samchon/ttsc/packages/ttsc/internal/cwd"
|
|
@@ -114,8 +115,8 @@ func writeCompiledProgramResponse(prog *driver.Program, diags []driver.Diagnosti
|
|
|
114
115
|
// Capture WriteFile output in a map keyed by project-relative paths. This
|
|
115
116
|
// gives the JS API a deterministic object and avoids touching outDir.
|
|
116
117
|
writeFile := shimcompiler.WriteFile(
|
|
117
|
-
func(fileName, text string, _ *shimcompiler.WriteFileData) error {
|
|
118
|
-
output[apiOutputKey(cwd, fileName)] = text
|
|
118
|
+
func(fileName shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
|
|
119
|
+
output[apiOutputKey(cwd, string(fileName))] = text
|
|
119
120
|
return nil
|
|
120
121
|
},
|
|
121
122
|
)
|
|
@@ -117,7 +117,7 @@ func writeTransformedProgramResponse(prog *driver.Program, diags []driver.Diagno
|
|
|
117
117
|
// not the mutated output.
|
|
118
118
|
graph = driver.NewTransformGraph(prog, cwd)
|
|
119
119
|
for _, file := range prog.SourceFiles() {
|
|
120
|
-
typescript[apiOutputKey(cwd, file.FileName())] = file.Text()
|
|
120
|
+
typescript[apiOutputKey(cwd, string(file.FileName()))] = file.Text()
|
|
121
121
|
}
|
|
122
122
|
diags = append(diags, prog.Diagnostics()...)
|
|
123
123
|
dependencies = prog.TransformDependenciesFor(cwd)
|
package/cmd/ttsc/build.go
CHANGED
|
@@ -15,6 +15,7 @@ import (
|
|
|
15
15
|
"path/filepath"
|
|
16
16
|
|
|
17
17
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
18
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
18
19
|
|
|
19
20
|
"github.com/samchon/ttsc/packages/ttsc/driver"
|
|
20
21
|
)
|
|
@@ -92,8 +93,8 @@ func writeBuildProgramResponse(prog *driver.Program, diags []driver.Diagnostic,
|
|
|
92
93
|
// wraps only the final WriteFile step so native rewrites and custom output
|
|
93
94
|
// capture share the same path.
|
|
94
95
|
writeFile := shimcompiler.WriteFile(
|
|
95
|
-
func(fileName, text string, _ *shimcompiler.WriteFileData) error {
|
|
96
|
-
return driver.DefaultWriteFile(fileName, text)
|
|
96
|
+
func(fileName shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
|
|
97
|
+
return driver.DefaultWriteFile(string(fileName), text)
|
|
97
98
|
},
|
|
98
99
|
)
|
|
99
100
|
var snapshot func() map[string][]string
|
|
@@ -130,8 +131,8 @@ func writeBuildProgramResponse(prog *driver.Program, diags []driver.Diagnostic,
|
|
|
130
131
|
if !request.quiet {
|
|
131
132
|
fmt.Fprintf(stdout, "// ttsc: emitted=%d files\n", len(res.EmittedFiles))
|
|
132
133
|
for _, f := range res.EmittedFiles {
|
|
133
|
-
rel := f
|
|
134
|
-
if abs, err := filepath.Rel(request.cwd, f); err == nil {
|
|
134
|
+
rel := string(f)
|
|
135
|
+
if abs, err := filepath.Rel(request.cwd, string(f)); err == nil {
|
|
135
136
|
rel = abs
|
|
136
137
|
}
|
|
137
138
|
fmt.Fprintln(stdout, " +", rel)
|
|
@@ -4,6 +4,7 @@ import (
|
|
|
4
4
|
"errors"
|
|
5
5
|
"fmt"
|
|
6
6
|
"io"
|
|
7
|
+
"io/fs"
|
|
7
8
|
"os"
|
|
8
9
|
"path/filepath"
|
|
9
10
|
)
|
|
@@ -21,6 +22,12 @@ type artifactAccounting struct {
|
|
|
21
22
|
// accountArtifactStore reads bounded rooted metadata for every retained cache
|
|
22
23
|
// population. The byte totals are logical file lengths, not free-space or
|
|
23
24
|
// physical allocated-byte claims; concurrent writers can change them later.
|
|
25
|
+
//
|
|
26
|
+
// A concurrent preparation of the same store removes its staging lock, and
|
|
27
|
+
// cleanup removes staged files, while this walks. An entry or directory that
|
|
28
|
+
// no longer exists when it is reached is therefore skipped as absent rather
|
|
29
|
+
// than failing the accounting; the depth, count, size and alias policies
|
|
30
|
+
// still apply to everything that does exist.
|
|
24
31
|
func accountArtifactStore(store *artifactStore) (artifactAccounting, error) {
|
|
25
32
|
var result artifactAccounting
|
|
26
33
|
var entries int
|
|
@@ -30,12 +37,18 @@ func accountArtifactStore(store *artifactStore) (artifactAccounting, error) {
|
|
|
30
37
|
return errors.New("artifact storage exceeds directory depth policy")
|
|
31
38
|
}
|
|
32
39
|
opened, err := store.root.Open(directory)
|
|
40
|
+
if errors.Is(err, fs.ErrNotExist) {
|
|
41
|
+
return nil
|
|
42
|
+
}
|
|
33
43
|
if err != nil {
|
|
34
44
|
return err
|
|
35
45
|
}
|
|
36
46
|
defer opened.Close()
|
|
37
47
|
for {
|
|
38
48
|
batch, readErr := opened.ReadDir(256)
|
|
49
|
+
if len(batch) != 0 && store.accountingListed != nil {
|
|
50
|
+
store.accountingListed(directory)
|
|
51
|
+
}
|
|
39
52
|
for _, entry := range batch {
|
|
40
53
|
entries++
|
|
41
54
|
if entries > 100000 {
|
|
@@ -43,6 +56,9 @@ func accountArtifactStore(store *artifactStore) (artifactAccounting, error) {
|
|
|
43
56
|
}
|
|
44
57
|
child := filepath.ToSlash(filepath.Join(directory, entry.Name()))
|
|
45
58
|
info, err := store.root.Lstat(child)
|
|
59
|
+
if errors.Is(err, fs.ErrNotExist) {
|
|
60
|
+
continue
|
|
61
|
+
}
|
|
46
62
|
if err != nil {
|
|
47
63
|
return err
|
|
48
64
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"os"
|
|
5
|
+
"path/filepath"
|
|
6
|
+
"strings"
|
|
7
|
+
"testing"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// TestAccountArtifactStore verifies that accounting skips entries a concurrent preparation removes while it walks.
|
|
11
|
+
//
|
|
12
|
+
// Verifies: a staging lock or staged directory removed between listing and stat is omitted from a successful accounting, while existing entries are still counted and still bound by policy.
|
|
13
|
+
// 1. Account a populated store without interference, as the baseline.
|
|
14
|
+
// 2. Remove a staging lock and a staged directory after their directories are listed, and require success without them.
|
|
15
|
+
// 3. Exceed the depth policy beside a removed entry, and require the policy failure.
|
|
16
|
+
//
|
|
17
|
+
// @evidence contracts/testing.md#behavioral-verification Calls the production accountArtifactStore over real files in an owned store and compares the returned totals; removals happen through the store's accountingListed seam at the exact listing-to-stat window of the race.
|
|
18
|
+
// @evidence contracts/testing.md#independent-expectations Totals are the literal byte lengths written by the test: 7 pack bytes, 5 + 9 staging bytes with the lock and the staged file present, and only the 5-byte staged body once they are removed.
|
|
19
|
+
// @evidence contracts/testing.md#distinguishing-cases The undisturbed baseline contrasts with a vanished file and a vanished directory, and the depth case shows the absence rule does not excuse an entry that exists and breaks policy.
|
|
20
|
+
// @evidence contracts/testing.md#execution-ownership This Go unit test owns a temporary directory and calls accounting directly; it starts no preparation, transfer or external process.
|
|
21
|
+
func TestAccountArtifactStore(t *testing.T) {
|
|
22
|
+
populate := func(t *testing.T) *artifactStore {
|
|
23
|
+
store, err := openArtifactStore(t.TempDir(), nil)
|
|
24
|
+
if err != nil {
|
|
25
|
+
t.Fatal(err)
|
|
26
|
+
}
|
|
27
|
+
t.Cleanup(func() { store.close() })
|
|
28
|
+
for name, body := range map[string]string{
|
|
29
|
+
"base/packs/base.pack": "packbin",
|
|
30
|
+
"base/staging/base-0123.lock": "lockowner",
|
|
31
|
+
"base/staging/keep.bin": "kept!",
|
|
32
|
+
"overlay/staging/transient/partial.bin": "gone",
|
|
33
|
+
} {
|
|
34
|
+
file := filepath.Join(store.path, filepath.FromSlash(name))
|
|
35
|
+
if err := os.MkdirAll(filepath.Dir(file), 0700); err != nil {
|
|
36
|
+
t.Fatal(err)
|
|
37
|
+
}
|
|
38
|
+
if err := os.WriteFile(file, []byte(body), 0600); err != nil {
|
|
39
|
+
t.Fatal(err)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return store
|
|
43
|
+
}
|
|
44
|
+
removeOnce := func(t *testing.T, store *artifactStore, removals map[string]string) {
|
|
45
|
+
store.accountingListed = func(directory string) {
|
|
46
|
+
target, ok := removals[directory]
|
|
47
|
+
if !ok {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
delete(removals, directory)
|
|
51
|
+
if err := os.RemoveAll(filepath.Join(store.path, filepath.FromSlash(target))); err != nil {
|
|
52
|
+
t.Fatal(err)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
baseline, err := accountArtifactStore(populate(t))
|
|
58
|
+
if err != nil {
|
|
59
|
+
t.Fatal(err)
|
|
60
|
+
}
|
|
61
|
+
if baseline.BaseBytes != 7 || baseline.BaseFiles != 1 || baseline.StagingBytes != 5+9+4 || baseline.StagingFiles != 3 {
|
|
62
|
+
t.Fatalf("baseline accounting: %+v", baseline)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
store := populate(t)
|
|
66
|
+
removals := map[string]string{
|
|
67
|
+
"base/staging": "base/staging/base-0123.lock",
|
|
68
|
+
"overlay/staging": "overlay/staging/transient",
|
|
69
|
+
}
|
|
70
|
+
removeOnce(t, store, removals)
|
|
71
|
+
vanished, err := accountArtifactStore(store)
|
|
72
|
+
if err != nil {
|
|
73
|
+
t.Fatalf("accounting failed on removed entries: %v", err)
|
|
74
|
+
}
|
|
75
|
+
if len(removals) != 0 {
|
|
76
|
+
t.Fatalf("removals not reached: %v", removals)
|
|
77
|
+
}
|
|
78
|
+
if vanished.BaseBytes != 7 || vanished.BaseFiles != 1 || vanished.StagingBytes != 5 || vanished.StagingFiles != 1 {
|
|
79
|
+
t.Fatalf("accounting kept removed entries: %+v", vanished)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
store = populate(t)
|
|
83
|
+
deep := filepath.Join(store.path, "overlay", "staging", filepath.FromSlash(strings.Repeat("d/", 5)))
|
|
84
|
+
if err := os.MkdirAll(deep, 0700); err != nil {
|
|
85
|
+
t.Fatal(err)
|
|
86
|
+
}
|
|
87
|
+
removeOnce(t, store, map[string]string{"base/staging": "base/staging/base-0123.lock"})
|
|
88
|
+
if _, err := accountArtifactStore(store); err == nil || !strings.Contains(err.Error(), "directory depth policy") {
|
|
89
|
+
t.Fatalf("depth policy not enforced beside a removed entry: %v", err)
|
|
90
|
+
}
|
|
91
|
+
}
|
package/cmd/ttsc-cache/main.go
CHANGED
|
@@ -187,7 +187,7 @@ func serve(source io.Reader, destination io.Writer, store *artifactStore) error
|
|
|
187
187
|
if len(current.ActionID) != 32 || len(current.OutputID) != 32 || current.BodySize < 0 || current.BodySize > 512<<20 {
|
|
188
188
|
return errors.New("invalid full Go cache put identity or body size")
|
|
189
189
|
}
|
|
190
|
-
// Go 1.26
|
|
190
|
+
// Go 1.26 and 1.27 write an extra newline after the encoded request.
|
|
191
191
|
separator, err := input.ReadByte()
|
|
192
192
|
if err != nil || separator != '\n' {
|
|
193
193
|
return errors.New("missing Go cache request separator")
|
|
@@ -12,7 +12,7 @@ import (
|
|
|
12
12
|
"testing"
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
// TestCacheProtocol verifies the Go 1.26 request framing and response contract.
|
|
15
|
+
// TestCacheProtocol verifies the Go 1.26 and 1.27 request framing and response contract.
|
|
16
16
|
//
|
|
17
17
|
// Verifies: the helper advertises capabilities, echoes IDs, returns local hits and misses, writes a bounded usage receipt, and refuses malformed body transport.
|
|
18
18
|
// 1. Send real Go-style request headers and separate base64 body values through the in-process server.
|
|
@@ -20,7 +20,7 @@ import (
|
|
|
20
20
|
// 3. Break JSON, base64 and body framing independently and require terminal failure.
|
|
21
21
|
//
|
|
22
22
|
// @evidence contracts/testing.md#behavioral-verification Calls the production protocol loop against an actual temporary store, parses its public JSON responses and reads the post-close local usage receipt.
|
|
23
|
-
// @evidence contracts/testing.md#independent-expectations The
|
|
23
|
+
// @evidence contracts/testing.md#independent-expectations The cacheprog Request and Response fields, identical in Go 1.26 and 1.27, the extra request separator, and SHA-256 of literal bytes define expected framing and identities.
|
|
24
24
|
// @evidence contracts/testing.md#distinguishing-cases Covers startup, two misses, a large put/hit, empty body, unknown command, close, malformed JSON, bad base64 and truncated body; stock Go subprocess interoperability is a separate installed-boundary check.
|
|
25
25
|
// @evidence contracts/testing.md#execution-ownership This Go unit test calls serve directly without compiling a helper or launching a Go client; each case owns a temporary store.
|
|
26
26
|
func TestCacheProtocol(t *testing.T) {
|
|
@@ -28,7 +28,7 @@ import (
|
|
|
28
28
|
// @evidence contracts/testing.md#execution-ownership This discoverable Go integration test builds a local helper and two private modules, serves one loopback pack, and removes all files through t.TempDir; no consumer install or external network is involved.
|
|
29
29
|
func TestPublisherSeal(t *testing.T) {
|
|
30
30
|
if !supportedGoVersion.MatchString(runtime.Version()) {
|
|
31
|
-
t.Skip("publisher protocol requires a stock Go 1.26 patch release")
|
|
31
|
+
t.Skip("publisher protocol requires a stock Go 1.26 or 1.27 patch release")
|
|
32
32
|
}
|
|
33
33
|
goBinary, err := exec.LookPath("go")
|
|
34
34
|
if err != nil {
|
|
@@ -25,7 +25,7 @@ import (
|
|
|
25
25
|
// @evidence contracts/testing.md#execution-ownership This narrow Go subprocess test uses a temporary helper and tiny local module; it never installs a consumer or runs the product E2E suite.
|
|
26
26
|
func TestStockGoCacheFailures(t *testing.T) {
|
|
27
27
|
if !supportedGoVersion.MatchString(runtime.Version()) {
|
|
28
|
-
t.Skip("the helper protocol requires a stock Go 1.26 patch release")
|
|
28
|
+
t.Skip("the helper protocol requires a stock Go 1.26 or 1.27 patch release")
|
|
29
29
|
}
|
|
30
30
|
root := t.TempDir()
|
|
31
31
|
helperSource := filepath.Join(root, "broken-helper.go")
|
|
@@ -24,11 +24,11 @@ import (
|
|
|
24
24
|
//
|
|
25
25
|
// @evidence contracts/testing.md#behavioral-verification Runs stock go build with GOCACHEPROG through the production helper executable, then observes compiler commands and archive bytes.
|
|
26
26
|
// @evidence contracts/testing.md#independent-expectations Identical source and dependency bytes under -trimpath should request the same actions; a changed dependency version must change the archive and require compilation.
|
|
27
|
-
// @evidence contracts/testing.md#distinguishing-cases Exercises stock Go 1.26 protocol startup, put/get, path quoting, source and module-cache relocation, and a changed dependency version.
|
|
27
|
+
// @evidence contracts/testing.md#distinguishing-cases Exercises stock Go 1.26 or 1.27 protocol startup, put/get, path quoting, source and module-cache relocation, and a changed dependency version.
|
|
28
28
|
// @evidence contracts/testing.md#execution-ownership The test runs stock Go in temporary directories with a private file proxy and never contacts the network or publishes a release artifact.
|
|
29
29
|
func TestStockGoCacheClient(t *testing.T) {
|
|
30
30
|
if !supportedGoVersion.MatchString(runtime.Version()) {
|
|
31
|
-
t.Skip("the helper protocol requires a stock Go 1.26 patch release")
|
|
31
|
+
t.Skip("the helper protocol requires a stock Go 1.26 or 1.27 patch release")
|
|
32
32
|
}
|
|
33
33
|
root := filepath.Join(t.TempDir(), "native artifact path with spaces")
|
|
34
34
|
if err := os.MkdirAll(root, 0700); err != nil {
|
package/cmd/ttsc-cache/store.go
CHANGED
|
@@ -29,6 +29,11 @@ type artifactStore struct {
|
|
|
29
29
|
pinned map[string]bool
|
|
30
30
|
verified map[string]bool
|
|
31
31
|
receiptName string
|
|
32
|
+
|
|
33
|
+
// accountingListed is told each directory batch accounting has listed,
|
|
34
|
+
// before it stats the batch's entries. Nil outside tests, which use it to
|
|
35
|
+
// remove an entry the way a concurrent preparation does.
|
|
36
|
+
accountingListed func(directory string)
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
func openArtifactStore(directory string, manifest *packageartifacts.Manifest) (*artifactStore, error) {
|
package/cmd/ttsc-cache/tuple.go
CHANGED
|
@@ -50,7 +50,7 @@ func readGoTuple(goBinary string) (packageartifacts.Tuple, error) {
|
|
|
50
50
|
return tuple, errors.New("publisher artifacts require effective CGO_ENABLED=0 and no GOFLAGS")
|
|
51
51
|
}
|
|
52
52
|
if !supportedGoVersion.MatchString(values["GOVERSION"]) {
|
|
53
|
-
return tuple, errors.New("publisher cache protocol requires a stock Go 1.26 patch release")
|
|
53
|
+
return tuple, errors.New("publisher cache protocol requires a stock Go 1.26 or 1.27 patch release")
|
|
54
54
|
}
|
|
55
55
|
if values["GOVERSION"] == "" || values["GOOS"] == "" || values["GOARCH"] == "" {
|
|
56
56
|
return tuple, errors.New("Go did not report a complete artifact tuple")
|
|
@@ -78,7 +78,11 @@ func readGoTuple(goBinary string) (packageartifacts.Tuple, error) {
|
|
|
78
78
|
}, nil
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
// supportedGoVersion admits the stock Go releases whose GOCACHEPROG framing and
|
|
82
|
+
// ActionID semantics the helper was checked against. Go 1.27 keeps Go 1.26's
|
|
83
|
+
// request and response wire format; its changes fix client-side lock and
|
|
84
|
+
// error handling, so publisher packs stay valid within each release line.
|
|
85
|
+
var supportedGoVersion = regexp.MustCompile(`^go1\.2[67]\.(0|[1-9][0-9]*)$`)
|
|
82
86
|
|
|
83
87
|
func runGoProbe(goBinary string, arguments ...string) ([]byte, error) {
|
|
84
88
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
|
@@ -23,7 +23,7 @@ import (
|
|
|
23
23
|
// @evidence contracts/testing.md#execution-ownership Runs bounded local Go identity probes without building source modules, downloading packages or writing repository files.
|
|
24
24
|
func TestReadGoTuple(t *testing.T) {
|
|
25
25
|
if !supportedGoVersion.MatchString(runtime.Version()) {
|
|
26
|
-
t.Skip("the artifact tuple requires a stock Go 1.26 patch release")
|
|
26
|
+
t.Skip("the artifact tuple requires a stock Go 1.26 or 1.27 patch release")
|
|
27
27
|
}
|
|
28
28
|
goBinary, err := exec.LookPath("go")
|
|
29
29
|
if err != nil {
|
package/cmd/ttscgraph/main.go
CHANGED
|
@@ -10,6 +10,8 @@ import (
|
|
|
10
10
|
"os"
|
|
11
11
|
"runtime"
|
|
12
12
|
"strings"
|
|
13
|
+
|
|
14
|
+
"github.com/samchon/ttsc/packages/ttsc/internal/graph"
|
|
13
15
|
)
|
|
14
16
|
|
|
15
17
|
// Build metadata; overwritten via -ldflags in release builds.
|
|
@@ -55,13 +57,16 @@ func run(args []string) int {
|
|
|
55
57
|
return 2
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
// printVersion names the build and the TypeScript compiler it links, which is
|
|
61
|
+
// how a platform package's per-target producers tell themselves apart.
|
|
58
62
|
func printVersion(w io.Writer) {
|
|
59
63
|
fmt.Fprintf(
|
|
60
64
|
w,
|
|
61
|
-
"ttscgraph %s (commit %s, built %s, %s/%s, go %s)\n",
|
|
65
|
+
"ttscgraph %s (commit %s, built %s, typescript %s, %s/%s, go %s)\n",
|
|
62
66
|
version,
|
|
63
67
|
commit,
|
|
64
68
|
date,
|
|
69
|
+
graph.TypescriptVersion(),
|
|
65
70
|
runtime.GOOS,
|
|
66
71
|
runtime.GOARCH,
|
|
67
72
|
runtime.Version(),
|
|
@@ -5,6 +5,8 @@ import (
|
|
|
5
5
|
"errors"
|
|
6
6
|
"strings"
|
|
7
7
|
"testing"
|
|
8
|
+
|
|
9
|
+
"github.com/samchon/ttsc/packages/ttsc/internal/graph"
|
|
8
10
|
)
|
|
9
11
|
|
|
10
12
|
// TestRunHelpVersionAndBadFlagsExitCodes verifies the top-level run dispatcher
|
|
@@ -24,7 +26,7 @@ import (
|
|
|
24
26
|
// 4. With getwd forced to fail, run dump and run serve exit 2 and explain why.
|
|
25
27
|
//
|
|
26
28
|
// @evidence contracts/testing.md#behavioral-verification Calls the actual top-level dispatcher in-process. Help and version require status zero and their named text, unknown command requires status two and Usage:, dump/serve bad flags require status two only, and both failing cwd branches require status two plus could not resolve working directory. These are returned statuses, not OS exit transport assertions.
|
|
27
|
-
// @evidence contracts/testing.md#independent-expectations The expected exit codes (0 for help and version, 2 for an unknown command, a bad dump or serve flag, and a failed working-directory lookup) and message fragments (ttscgraph, Usage:, could not resolve working directory) are literals from the documented command surface, written independently of run. The version check compares with the package's own version variable, so it
|
|
29
|
+
// @evidence contracts/testing.md#independent-expectations The expected exit codes (0 for help and version, 2 for an unknown command, a bad dump or serve flag, and a failed working-directory lookup) and message fragments (ttscgraph, Usage:, could not resolve working directory) are literals from the documented command surface, written independently of run. The version check compares with the package's own version variable and the linked compiler's own version, so it proves those strings are printed, not that they are correct.
|
|
28
30
|
// @evidence contracts/testing.md#distinguishing-cases run --help and run --version exit 0, printing the command name / version; run --bogus (unknown command) exits 2 and prints usage; run dump --nope and run serve --nope exit 2 (flag parse failure). 4. With getwd forced to fail, run dump and run serve exit 2 and explain why.
|
|
29
31
|
// @evidence contracts/testing.md#execution-ownership TestRunHelpVersionAndBadFlagsExitCodes is a Go source-unit entry. It calls the package's top-level run dispatcher in-process with stdout, stderr and the getwd seam replaced; every case returns before a Program is loaded or a serve session starts, so nothing is installed, built or launched.
|
|
30
32
|
func TestRunHelpVersionAndBadFlagsExitCodes(t *testing.T) {
|
|
@@ -50,6 +52,9 @@ func TestRunHelpVersionAndBadFlagsExitCodes(t *testing.T) {
|
|
|
50
52
|
if got := versionOut.String(); !strings.Contains(got, "ttscgraph") || !strings.Contains(got, version) {
|
|
51
53
|
t.Fatalf("run --version did not print a version string:\n%s", got)
|
|
52
54
|
}
|
|
55
|
+
if got, want := versionOut.String(), "typescript "+graph.TypescriptVersion()+","; !strings.Contains(got, want) {
|
|
56
|
+
t.Fatalf("run --version did not name the linked compiler %q:\n%s", want, got)
|
|
57
|
+
}
|
|
53
58
|
|
|
54
59
|
// An unknown command is an invalid invocation: print usage and exit 2.
|
|
55
60
|
var badErr bytes.Buffer
|
package/cmd/ttscgraph/serve.go
CHANGED
|
@@ -632,8 +632,8 @@ func missingRootInputs(configs []*shimtsoptions.ParsedCommandLine, sourceHashes
|
|
|
632
632
|
missing := []string{}
|
|
633
633
|
for _, parsed := range configs {
|
|
634
634
|
for _, file := range parsed.FileNames() {
|
|
635
|
-
if _, tracked := sourceHashes[file]; !tracked {
|
|
636
|
-
missing = append(missing, file)
|
|
635
|
+
if _, tracked := sourceHashes[string(file)]; !tracked {
|
|
636
|
+
missing = append(missing, string(file))
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
}
|
|
@@ -678,8 +678,10 @@ func serveProducer() graph.Producer {
|
|
|
678
678
|
func configFiles(configs []*shimtsoptions.ParsedCommandLine) []string {
|
|
679
679
|
files := []string{}
|
|
680
680
|
for _, parsed := range configs {
|
|
681
|
-
files = append(files, parsed.ConfigName())
|
|
682
|
-
|
|
681
|
+
files = append(files, string(parsed.ConfigName()))
|
|
682
|
+
for _, extended := range parsed.ExtendedSourceFiles() {
|
|
683
|
+
files = append(files, string(extended))
|
|
684
|
+
}
|
|
683
685
|
}
|
|
684
686
|
return compactSortedStrings(files)
|
|
685
687
|
}
|
|
@@ -699,9 +701,9 @@ func projectRootFilesFromConfigs(configs []*shimtsoptions.ParsedCommandLine, rel
|
|
|
699
701
|
if reload {
|
|
700
702
|
current = parsed.ReloadFileNamesOfParsedCommandLine(driver.DefaultFS())
|
|
701
703
|
}
|
|
702
|
-
config := current.ConfigName()
|
|
704
|
+
config := string(current.ConfigName())
|
|
703
705
|
for _, file := range current.FileNames() {
|
|
704
|
-
roots = append(roots, config+"\x00"+file)
|
|
706
|
+
roots = append(roots, config+"\x00"+string(file))
|
|
705
707
|
}
|
|
706
708
|
}
|
|
707
709
|
return compactSortedStrings(roots)
|
|
@@ -714,7 +716,7 @@ func parsedConfigs(program *driver.Program) ([]*shimtsoptions.ParsedCommandLine,
|
|
|
714
716
|
resolved := make(map[string]*shimtsoptions.ParsedCommandLine)
|
|
715
717
|
for _, parsed := range program.TSProgram.GetResolvedProjectReferences() {
|
|
716
718
|
if parsed != nil {
|
|
717
|
-
resolved[shimtspath.ResolvePath(parsed.ConfigName())] = parsed
|
|
719
|
+
resolved[shimtspath.ResolvePath(string(parsed.ConfigName()))] = parsed
|
|
718
720
|
}
|
|
719
721
|
}
|
|
720
722
|
configs := []*shimtsoptions.ParsedCommandLine{}
|
|
@@ -723,14 +725,14 @@ func parsedConfigs(program *driver.Program) ([]*shimtsoptions.ParsedCommandLine,
|
|
|
723
725
|
for len(pending) > 0 {
|
|
724
726
|
parsed := pending[0]
|
|
725
727
|
pending = pending[1:]
|
|
726
|
-
config := shimtspath.ResolvePath(parsed.ConfigName())
|
|
728
|
+
config := shimtspath.ResolvePath(string(parsed.ConfigName()))
|
|
727
729
|
if _, exists := seen[config]; exists {
|
|
728
730
|
continue
|
|
729
731
|
}
|
|
730
732
|
seen[config] = struct{}{}
|
|
731
733
|
configs = append(configs, parsed)
|
|
732
|
-
for _,
|
|
733
|
-
reference
|
|
734
|
+
for _, referencePath := range parsed.ResolvedProjectReferencePaths() {
|
|
735
|
+
reference := shimtspath.ResolvePath(string(referencePath))
|
|
734
736
|
child := resolved[reference]
|
|
735
737
|
if child == nil {
|
|
736
738
|
fs := program.FS
|
|
@@ -783,23 +785,23 @@ func hashProgramSources(program *driver.Program) (map[string][sha256.Size]byte,
|
|
|
783
785
|
for _, source := range program.TSProgram.SourceFiles() {
|
|
784
786
|
// Virtual sources (tsgo's `bundled:///` libs) have no on-disk identity;
|
|
785
787
|
// real project files always carry an absolute path.
|
|
786
|
-
if source == nil || !filepath.IsAbs(source.FileName()) {
|
|
788
|
+
if source == nil || !filepath.IsAbs(string(source.FileName())) {
|
|
787
789
|
continue
|
|
788
790
|
}
|
|
789
|
-
info, err := os.Stat(source.FileName())
|
|
791
|
+
info, err := os.Stat(string(source.FileName()))
|
|
790
792
|
if err != nil {
|
|
791
793
|
if errors.Is(err, os.ErrNotExist) {
|
|
792
794
|
// The file vanished while the compiler session was loading. Hash the
|
|
793
795
|
// resident text so the next snapshot revisits the path, observes the
|
|
794
796
|
// deletion, and reloads instead of serving the vanished file forever.
|
|
795
|
-
hashes[source.FileName()] = sha256.Sum256([]byte(source.Text()))
|
|
797
|
+
hashes[string(source.FileName())] = sha256.Sum256([]byte(source.Text()))
|
|
796
798
|
}
|
|
797
799
|
continue
|
|
798
800
|
}
|
|
799
801
|
if info.IsDir() {
|
|
800
802
|
continue
|
|
801
803
|
}
|
|
802
|
-
content, err := os.ReadFile(source.FileName())
|
|
804
|
+
content, err := os.ReadFile(string(source.FileName()))
|
|
803
805
|
if err != nil {
|
|
804
806
|
return nil, nil, fmt.Errorf("ttscgraph: read %s: %w", source.FileName(), err)
|
|
805
807
|
}
|
|
@@ -807,22 +809,22 @@ func hashProgramSources(program *driver.Program) (map[string][sha256.Size]byte,
|
|
|
807
809
|
// The bytes were read, so their digest is a fact regardless of whether they
|
|
808
810
|
// match what the checker holds. When they do not, the manifest's text and
|
|
809
811
|
// disk digests disagree, which is precisely what a consumer needs to see.
|
|
810
|
-
digests[source.FileName()] = graph.Digest(rawHash)
|
|
812
|
+
digests[string(source.FileName())] = graph.Digest(rawHash)
|
|
811
813
|
// Disk identity and checker text come from the same captured bytes. The
|
|
812
814
|
// compiler filesystem strips BOMs and decodes UTF-16 before parsing.
|
|
813
815
|
decoded, ok := shimvfs.DecodeBytes(string(content))
|
|
814
816
|
if !ok {
|
|
815
817
|
return nil, nil, fmt.Errorf("ttscgraph: decode %s", source.FileName())
|
|
816
818
|
}
|
|
817
|
-
expected := driver.ApplySourcePreambleToFile(source.FileName(), decoded, program.SourcePreamble)
|
|
819
|
+
expected := driver.ApplySourcePreambleToFile(string(source.FileName()), decoded, program.SourcePreamble)
|
|
818
820
|
if source.Text() == expected {
|
|
819
|
-
hashes[source.FileName()] = rawHash
|
|
821
|
+
hashes[string(source.FileName())] = rawHash
|
|
820
822
|
} else {
|
|
821
823
|
// Force the next snapshot to revisit a file that changed while the
|
|
822
824
|
// compiler session was loading instead of blessing mismatched disk text.
|
|
823
825
|
mismatchHash := rawHash
|
|
824
826
|
mismatchHash[0] ^= 0xff
|
|
825
|
-
hashes[source.FileName()] = mismatchHash
|
|
827
|
+
hashes[string(source.FileName())] = mismatchHash
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
830
|
return hashes, digests, nil
|
|
@@ -962,10 +964,10 @@ func auxiliaryInputs(program *driver.Program, cwd string) []auxiliaryInput {
|
|
|
962
964
|
}
|
|
963
965
|
for _, source := range program.TSProgram.SourceFiles() {
|
|
964
966
|
file := source.FileName()
|
|
965
|
-
if file == "" || strings.HasPrefix(file, "bundled:///") {
|
|
967
|
+
if file == "" || strings.HasPrefix(string(file), "bundled:///") {
|
|
966
968
|
continue
|
|
967
969
|
}
|
|
968
|
-
directory := filepath.Dir(file)
|
|
970
|
+
directory := filepath.Dir(string(file))
|
|
969
971
|
for _, path := range appendAncestorInputs(nil, directory, cwd) {
|
|
970
972
|
inputs = append(inputs, auxiliaryInput{path: path})
|
|
971
973
|
}
|
|
@@ -1213,16 +1213,16 @@ func advanceServeGraphProvenance(
|
|
|
1213
1213
|
return graph.Provenance{}, graph.Provenance{}, false
|
|
1214
1214
|
}
|
|
1215
1215
|
physical := source.FileName()
|
|
1216
|
-
index, ok := positions[physical]
|
|
1216
|
+
index, ok := positions[string(physical)]
|
|
1217
1217
|
if !ok {
|
|
1218
1218
|
return graph.Provenance{}, graph.Provenance{}, false
|
|
1219
1219
|
}
|
|
1220
1220
|
updated := graph.SourceDigest{
|
|
1221
|
-
File: physical,
|
|
1221
|
+
File: string(physical),
|
|
1222
1222
|
Checker: graph.Digest(sha256.Sum256([]byte(source.Text()))),
|
|
1223
|
-
Disk: diskDigests[physical],
|
|
1223
|
+
Disk: diskDigests[string(physical)],
|
|
1224
1224
|
}
|
|
1225
|
-
wireFile, ok := wireSources[physical]
|
|
1225
|
+
wireFile, ok := wireSources[string(physical)]
|
|
1226
1226
|
if !ok {
|
|
1227
1227
|
return graph.Provenance{}, graph.Provenance{}, false
|
|
1228
1228
|
}
|
|
@@ -1344,7 +1344,7 @@ func authoredGraphFiles(program *driver.Program) map[string]bool {
|
|
|
1344
1344
|
if !graph.IsWorkspaceSourceFile(file) {
|
|
1345
1345
|
continue
|
|
1346
1346
|
}
|
|
1347
|
-
authored[file.FileName()] = true
|
|
1347
|
+
authored[string(file.FileName())] = true
|
|
1348
1348
|
}
|
|
1349
1349
|
return authored
|
|
1350
1350
|
}
|
|
@@ -1357,8 +1357,8 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
|
|
|
1357
1357
|
if !graph.IsWorkspaceSourceFile(file) {
|
|
1358
1358
|
continue
|
|
1359
1359
|
}
|
|
1360
|
-
authored[file.FileName()] = true
|
|
1361
|
-
authoredByPath[string(
|
|
1360
|
+
authored[string(file.FileName())] = true
|
|
1361
|
+
authoredByPath[string(shimast.SourceFilePathKey(file))] = string(file.FileName())
|
|
1362
1362
|
}
|
|
1363
1363
|
add := func(target, dependent string) {
|
|
1364
1364
|
if !authored[target] || target == dependent {
|
|
@@ -1376,8 +1376,8 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
|
|
|
1376
1376
|
continue
|
|
1377
1377
|
}
|
|
1378
1378
|
for _, referencedPath := range shimcompiler.GetReferencedFilePaths(program.TSProgram, source) {
|
|
1379
|
-
if target, ok := authoredByPath[referencedPath]; ok {
|
|
1380
|
-
add(target, source.FileName())
|
|
1379
|
+
if target, ok := authoredByPath[string(referencedPath)]; ok {
|
|
1380
|
+
add(target, string(source.FileName()))
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
@@ -1393,25 +1393,36 @@ func reverseGraphDependencies(program *driver.Program) map[string][]string {
|
|
|
1393
1393
|
return reverse
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
1396
|
+
// serveGraphResolutionDigests digests each source's resolved references.
|
|
1397
|
+
// Projecting a target resolves its symlinks on disk, and a widely imported
|
|
1398
|
+
// file is the target of many references, so each target is projected once per
|
|
1399
|
+
// call rather than once per import.
|
|
1396
1400
|
func serveGraphResolutionDigests(program *driver.Program, project string) (map[string]string, error) {
|
|
1397
1401
|
digests := map[string]string{}
|
|
1402
|
+
projected := map[string]string{}
|
|
1398
1403
|
for _, source := range program.TSProgram.SourceFiles() {
|
|
1399
1404
|
raw := shimcompiler.GetReferencedFilePaths(program.TSProgram, source)
|
|
1400
1405
|
references := make([]string, 0, len(raw))
|
|
1401
1406
|
for _, reference := range raw {
|
|
1402
|
-
target := program.TSProgram.GetSourceFileByPath(shimtspath.
|
|
1407
|
+
target := program.TSProgram.GetSourceFileByPath(shimtspath.PathKey(reference))
|
|
1403
1408
|
if target == nil {
|
|
1404
1409
|
continue
|
|
1405
1410
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1411
|
+
name := string(target.FileName())
|
|
1412
|
+
file, ok := projected[name]
|
|
1413
|
+
if !ok {
|
|
1414
|
+
var err error
|
|
1415
|
+
file, err = serveGraphFile(project, name, program.TSProgram.UseCaseSensitiveFileNames())
|
|
1416
|
+
if err != nil {
|
|
1417
|
+
return nil, err
|
|
1418
|
+
}
|
|
1419
|
+
projected[name] = file
|
|
1409
1420
|
}
|
|
1410
1421
|
references = append(references, file)
|
|
1411
1422
|
}
|
|
1412
1423
|
sort.Strings(references)
|
|
1413
1424
|
digest, _ := digestJSON(references)
|
|
1414
|
-
digests[source.FileName()] = digest
|
|
1425
|
+
digests[string(source.FileName())] = digest
|
|
1415
1426
|
}
|
|
1416
1427
|
return digests, nil
|
|
1417
1428
|
}
|
|
@@ -1421,7 +1432,7 @@ func serveGraphResolutionDigests(program *driver.Program, project string) (map[s
|
|
|
1421
1432
|
// spelling and authored-source boundary remain the shard ownership coordinates.
|
|
1422
1433
|
func graphSourceFile(program *driver.Program, file string) *shimast.SourceFile {
|
|
1423
1434
|
source := program.SourceFile(file)
|
|
1424
|
-
if graph.IsWorkspaceSourceFile(source) && source.FileName() == file {
|
|
1435
|
+
if graph.IsWorkspaceSourceFile(source) && string(source.FileName()) == file {
|
|
1425
1436
|
return source
|
|
1426
1437
|
}
|
|
1427
1438
|
return nil
|
|
@@ -55,7 +55,7 @@ func TestServeShardsAbandonedGenerationConvergesOnRetry(t *testing.T) {
|
|
|
55
55
|
if abandoned.Sequence != committed.Sequence+1 {
|
|
56
56
|
t.Fatalf("abandoned sequence = %d, want %d", abandoned.Sequence, committed.Sequence+1)
|
|
57
57
|
}
|
|
58
|
-
abandonedKey := session.graphStore.sourceKeys[indexKeyFile]
|
|
58
|
+
abandonedKey := session.graphStore.sourceKeys[string(indexKeyFile)]
|
|
59
59
|
if abandonedKey == "" {
|
|
60
60
|
t.Fatal("abandoned source has no committed shard key")
|
|
61
61
|
}
|
|
@@ -83,7 +83,7 @@ func TestServeShardsAbandonedGenerationConvergesOnRetry(t *testing.T) {
|
|
|
83
83
|
if converged.Sequence != abandoned.Sequence+1 {
|
|
84
84
|
t.Fatalf("converged sequence = %d, want %d", converged.Sequence, abandoned.Sequence+1)
|
|
85
85
|
}
|
|
86
|
-
convergedKey := session.graphStore.sourceKeys[indexKeyFile]
|
|
86
|
+
convergedKey := session.graphStore.sourceKeys[string(indexKeyFile)]
|
|
87
87
|
if convergedKey == "" || convergedKey == abandonedKey {
|
|
88
88
|
t.Fatalf("edited source kept the abandoned shard identity %q", convergedKey)
|
|
89
89
|
}
|