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/driver/rewrite.go
CHANGED
|
@@ -27,6 +27,7 @@ import (
|
|
|
27
27
|
shimcore "github.com/microsoft/typescript-go/shim/core"
|
|
28
28
|
shimparser "github.com/microsoft/typescript-go/shim/parser"
|
|
29
29
|
shimscanner "github.com/microsoft/typescript-go/shim/scanner"
|
|
30
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
// Rewrite describes one emit-time patch: the replacement JS fragment a linked
|
|
@@ -97,7 +98,7 @@ func (rs *RewriteSet) Add(r Rewrite) {
|
|
|
97
98
|
if r.File == nil {
|
|
98
99
|
return
|
|
99
100
|
}
|
|
100
|
-
path := filepath.ToSlash(r.File.FileName())
|
|
101
|
+
path := filepath.ToSlash(string(r.File.FileName()))
|
|
101
102
|
rs.byPath[path] = append(rs.byPath[path], r)
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -184,7 +185,7 @@ func (p *Program) EmitAllRaw(writeFile shimcompiler.WriteFile) (*shimcompiler.Em
|
|
|
184
185
|
// lock contention are included in emission cost; this does not change the
|
|
185
186
|
// native generation threading policy.
|
|
186
187
|
var wfMu sync.Mutex
|
|
187
|
-
wf := func(fileName, text string, data *shimcompiler.WriteFileData) error {
|
|
188
|
+
wf := func(fileName shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
188
189
|
wfMu.Lock()
|
|
189
190
|
defer wfMu.Unlock()
|
|
190
191
|
if p.outputEscapesOutDir(fileName) {
|
|
@@ -198,7 +199,7 @@ func (p *Program) EmitAllRaw(writeFile shimcompiler.WriteFile) (*shimcompiler.Em
|
|
|
198
199
|
if writeFile != nil {
|
|
199
200
|
return writeFile(fileName, text, data)
|
|
200
201
|
}
|
|
201
|
-
return DefaultWriteFile(fileName, text)
|
|
202
|
+
return DefaultWriteFile(string(fileName), text)
|
|
202
203
|
}
|
|
203
204
|
result := p.emitProgram(shimcompiler.EmitOptions{
|
|
204
205
|
WriteFile: wf,
|
|
@@ -242,7 +243,7 @@ func (p *Program) emit(rs *RewriteSet, target *ast.SourceFile, writeFile shimcom
|
|
|
242
243
|
// output map) must likewise see one writer at a time. Rewriting, destination
|
|
243
244
|
// work and lock contention remain part of this emission's cost.
|
|
244
245
|
var wfMu sync.Mutex
|
|
245
|
-
wf := func(fileName, text string, data *shimcompiler.WriteFileData) error {
|
|
246
|
+
wf := func(fileName shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
246
247
|
wfMu.Lock()
|
|
247
248
|
defer wfMu.Unlock()
|
|
248
249
|
if p.outputEscapesOutDir(fileName) {
|
|
@@ -258,7 +259,7 @@ func (p *Program) emit(rs *RewriteSet, target *ast.SourceFile, writeFile shimcom
|
|
|
258
259
|
patched := text
|
|
259
260
|
if !p.isBuildInfoOutput(fileName) {
|
|
260
261
|
var err error
|
|
261
|
-
patched, err = applyRewrites(fileName, text, rs, cursors)
|
|
262
|
+
patched, err = applyRewrites(string(fileName), text, rs, cursors)
|
|
262
263
|
if err != nil {
|
|
263
264
|
return err
|
|
264
265
|
}
|
|
@@ -266,13 +267,10 @@ func (p *Program) emit(rs *RewriteSet, target *ast.SourceFile, writeFile shimcom
|
|
|
266
267
|
if writeFile != nil {
|
|
267
268
|
return writeFile(fileName, patched, data)
|
|
268
269
|
}
|
|
269
|
-
return DefaultWriteFile(fileName, patched)
|
|
270
|
+
return DefaultWriteFile(string(fileName), patched)
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
result := p.emitProgram(shimcompiler.
|
|
273
|
-
TargetSourceFile: target,
|
|
274
|
-
WriteFile: wf,
|
|
275
|
-
})
|
|
273
|
+
result := p.emitProgram(shimcompiler.TargetedEmitOptions(target, wf))
|
|
276
274
|
return result, p.convertProgramDiagnostics(result.Diagnostics), nil
|
|
277
275
|
}
|
|
278
276
|
|
|
@@ -290,11 +288,11 @@ func (p *Program) emit(rs *RewriteSet, target *ast.SourceFile, writeFile shimcom
|
|
|
290
288
|
//
|
|
291
289
|
// A single-file emit stays on the plain lane. Build information describes a
|
|
292
290
|
// whole program, and tsgo's incremental program returns early on a
|
|
293
|
-
//
|
|
291
|
+
// single-file request without writing any, so routing it there would
|
|
294
292
|
// only add a snapshot computation nothing reads.
|
|
295
293
|
func (p *Program) emitProgram(options shimcompiler.EmitOptions) *shimcompiler.EmitResult {
|
|
296
294
|
ctx := context.Background()
|
|
297
|
-
if options
|
|
295
|
+
if shimcompiler.EmitsWholeProgram(options) && p.emitsBuildInfo() {
|
|
298
296
|
return shimcompiler.EmitFreshWithBuildInfo(ctx, p.TSProgram, options)
|
|
299
297
|
}
|
|
300
298
|
return p.TSProgram.Emit(ctx, options)
|
|
@@ -359,7 +357,7 @@ func parseRewriteOutput(outputName, text string) *ast.SourceFile {
|
|
|
359
357
|
if strings.EqualFold(filepath.Ext(outputName), ".jsx") {
|
|
360
358
|
kind = shimcore.ScriptKindJSX
|
|
361
359
|
}
|
|
362
|
-
return shimparser.ParseSourceFile(ast.SourceFileParseOptions{FileName: parseName}, text, kind)
|
|
360
|
+
return shimparser.ParseSourceFile(ast.SourceFileParseOptions{FileName: shimtspath.RootedFilePathFromAbsolute(parseName)}, text, kind)
|
|
363
361
|
}
|
|
364
362
|
|
|
365
363
|
// rewriteHeaderStart preserves the byte-order mark and interpreter directive.
|
package/driver/session.go
CHANGED
|
@@ -3,6 +3,7 @@ package driver
|
|
|
3
3
|
import (
|
|
4
4
|
"context"
|
|
5
5
|
|
|
6
|
+
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
6
7
|
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
7
8
|
"github.com/samchon/ttsc/packages/ttsc/internal/e2etrace"
|
|
8
9
|
)
|
|
@@ -76,7 +77,7 @@ func NewSession(cwd, tsconfig string, options LoadProgramOptions) (*Session, []D
|
|
|
76
77
|
// @evidence contracts/common.md#clear-and-simple-design One operation owns buffer update, incremental compiler update and checker-lease replacement.
|
|
77
78
|
// @evidence contracts/common.md#prohibited-implementation-shortcuts The compiler's update result determines reuse, with no filename-specific bypass or invented success.
|
|
78
79
|
// @evidence contracts/common.md#meaningful-documentation Native prose explains true and false reuse results following the documentation skill.
|
|
79
|
-
// @evidence contracts/portability.md#os-neutral-implementation Resident member spelling,
|
|
80
|
+
// @evidence contracts/portability.md#os-neutral-implementation Resident member spelling, the Program's base directory and its case policy produce the native path key; these are lexical compiler keys, not independent physical-alias or directory capability proofs.
|
|
80
81
|
// @evidence contracts/performance.md#efficient-algorithms Overlay/key setup processes path bytes; SourceFile may run pending linked hooks before indexed lookup. Native update reads/parses the edited member and either clones file collections and initializes a new checker pool while sharing eligible data, or performs full reconstruction. File/reference/source populations and native host work therefore remain costs even on a reused-data result.
|
|
81
82
|
// @evidence contracts/performance.md#reuse-equivalent-work Under the caller's existing-member/single-change contract, native parse options, import/reference/augmentation/ambient-name compatibility and package-redirect checks determine data reuse. Every successful result is a new Program generation; transformed mutable AST reuse is not supported by this type-check session contract.
|
|
82
83
|
// @evidence contracts/performance.md#bound-retention-and-release-resources A returned replacement releases the old checker lease before acquiring/installing the new checker and host. Current native data and uncapped overlay text remain session-owned, with earlier generation data possibly shared or retained by other aliases; lease replacement does not bound bytes or reclaim all old state. Close and caller ownership govern later release.
|
|
@@ -84,11 +85,15 @@ func (s *Session) Apply(absPath, content string) bool {
|
|
|
84
85
|
s.overlay.Set(absPath, content)
|
|
85
86
|
name := absPath
|
|
86
87
|
if file := s.prog.SourceFile(absPath); file != nil {
|
|
87
|
-
name = file.FileName()
|
|
88
|
+
name = string(file.FileName())
|
|
88
89
|
}
|
|
89
|
-
changed :=
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
changed := shimcompiler.ProgramPathKey(s.prog.TSProgram, shimtspath.ToRootedFilePath(name, s.prog.TSProgram.GetCurrentDirectory()))
|
|
91
|
+
// The new host keeps the Program's content mappers, so a mapped file is
|
|
92
|
+
// still transformed by the processes the first generation started.
|
|
93
|
+
newHost := projectHost(s.prog.hosts, s.cwd, s.prog.FS)
|
|
94
|
+
// The second result is the changed file as newHost parsed it, returned so a
|
|
95
|
+
// host with a parse cache can release it; this host parses without one.
|
|
96
|
+
newProg, _, reused := shimcompiler.UpdateProgram(s.prog.TSProgram, changed, newHost)
|
|
92
97
|
if newProg != nil {
|
|
93
98
|
e2etrace.Program("program-construction", "driver-update", "constructor-returned", reused, newProg)
|
|
94
99
|
if s.prog.checkerRelease != nil {
|
|
@@ -142,8 +147,9 @@ func (s *Session) SourceText(absPath string) (string, bool) {
|
|
|
142
147
|
return file.Text(), true
|
|
143
148
|
}
|
|
144
149
|
|
|
145
|
-
// Close releases the current Program's checker lease
|
|
146
|
-
// resident Program or overlay, dispose all
|
|
150
|
+
// Close releases the current Program's checker lease and content-mapper
|
|
151
|
+
// processes. It does not clear the resident Program or overlay, dispose all
|
|
152
|
+
// native data, or forbid later calls.
|
|
147
153
|
//
|
|
148
154
|
// @evidence contracts/common.md#principled-implementation Closing the current Program releases its checker lease; an absent Program has no lease to release.
|
|
149
155
|
// @evidence contracts/common.md#clear-and-simple-design Session cleanup delegates lease ownership to Program.Close without a second release ledger.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//go:build !ttsc_typescript_7_1
|
|
2
|
+
|
|
3
|
+
package driver
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"context"
|
|
7
|
+
"strings"
|
|
8
|
+
|
|
9
|
+
ast "github.com/microsoft/typescript-go/shim/ast"
|
|
10
|
+
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
11
|
+
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
12
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
// TypeScript 7.0 compiler target.
|
|
16
|
+
//
|
|
17
|
+
// The driver's emit and diagnostic glue calls compiler APIs whose signatures
|
|
18
|
+
// and semantics differ between the 7.0 and 7.1 compilers. Each function here
|
|
19
|
+
// keeps the call the driver made on 7.0; target_ts71.go declares the same
|
|
20
|
+
// functions over the 7.1 compiler. The ttsc_typescript_7_1 build tag selects
|
|
21
|
+
// 7.1, and its absence selects this file.
|
|
22
|
+
|
|
23
|
+
// UseCaseSensitiveFileNames is the 7.0 EmitHost case policy.
|
|
24
|
+
func (h *pluginEmitHost) UseCaseSensitiveFileNames() bool {
|
|
25
|
+
return h.program.UseCaseSensitiveFileNames()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// GetCurrentDirectory is the 7.0 EmitHost working directory.
|
|
29
|
+
func (h *pluginEmitHost) GetCurrentDirectory() string { return h.program.GetCurrentDirectory() }
|
|
30
|
+
|
|
31
|
+
// GetEmitResolver is the 7.0 EmitHost resolver: the checker's single resolver,
|
|
32
|
+
// guarded to the program's original member accesses.
|
|
33
|
+
func (h *pluginEmitHost) GetEmitResolver() shimprinter.EmitResolver {
|
|
34
|
+
return guardedEmitResolver{h.checker.GetEmitResolver(), h.originalMembers}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// handleNoEmit applies noEmitOnError's whole-program diagnostic gate. A nil
|
|
38
|
+
// result means emit may proceed.
|
|
39
|
+
func handleNoEmit(ctx context.Context, program *shimcompiler.Program) *shimcompiler.EmitResult {
|
|
40
|
+
return shimcompiler.HandleNoEmitOnError(ctx, program, nil)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// applyScriptTransformers runs the compiler's script transformers for source
|
|
44
|
+
// over tree, resolving through host's guarded emit resolver, and returns the
|
|
45
|
+
// transformed tree.
|
|
46
|
+
func applyScriptTransformers(emitContext *shimprinter.EmitContext, host *pluginEmitHost, source *ast.SourceFile, tree *ast.SourceFile) *ast.SourceFile {
|
|
47
|
+
for _, transformer := range shimcompiler.GetScriptTransformers(emitContext, host, source) {
|
|
48
|
+
tree = transformer.TransformSourceFile(tree)
|
|
49
|
+
}
|
|
50
|
+
return tree
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// scriptWriteFileData is the WriteFileData the 7.0 emitter passes with a
|
|
54
|
+
// JavaScript output: only its source-map URL position.
|
|
55
|
+
func scriptWriteFileData(source *ast.SourceFile, sourceMapURLPos int) *shimcompiler.WriteFileData {
|
|
56
|
+
return &shimcompiler.WriteFileData{SourceMapUrlPos: sourceMapURLPos}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// sourceMapWriteFileData is the WriteFileData the 7.0 emitter passes with a
|
|
60
|
+
// source map: none.
|
|
61
|
+
func sourceMapWriteFileData(source *ast.SourceFile) *shimcompiler.WriteFileData {
|
|
62
|
+
return nil
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// declarationShapeEmitOptions returns the forced declaration emit of one file
|
|
66
|
+
// that the declaration-shape digest reads.
|
|
67
|
+
func declarationShapeEmitOptions(file *ast.SourceFile, writeFile shimcompiler.WriteFile) shimcompiler.EmitOptions {
|
|
68
|
+
return shimcompiler.EmitOptions{TargetSourceFile: file, EmitOnly: shimcompiler.EmitOnlyForcedDts, WriteFile: writeFile}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// writeDeclarationShapeDiagnosticFile writes how upstream incremental names a
|
|
72
|
+
// diagnostic's file relative to the file whose signature it belongs to.
|
|
73
|
+
func writeDeclarationShapeDiagnosticFile(builder *strings.Builder, source *ast.SourceFile, diagnosticFile *ast.SourceFile) {
|
|
74
|
+
builder.WriteString(shimtspath.EnsurePathIsNonModuleName(shimtspath.GetRelativePathFromDirectory(
|
|
75
|
+
shimtspath.GetDirectoryPath(string(source.Path())),
|
|
76
|
+
string(diagnosticFile.Path()),
|
|
77
|
+
shimtspath.ComparePathsOptions{},
|
|
78
|
+
)))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// fileDiagnostics returns the bind and semantic diagnostics of one file under
|
|
82
|
+
// the compiler's any-program diagnostic rules.
|
|
83
|
+
func fileDiagnostics(ctx context.Context, program *shimcompiler.Program, file *ast.SourceFile) []*ast.Diagnostic {
|
|
84
|
+
return shimcompiler.GetDiagnosticsOfAnyProgram(ctx, program, file, false, program.GetBindDiagnostics, program.GetSemanticDiagnostics)
|
|
85
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//go:build ttsc_typescript_7_1
|
|
2
|
+
|
|
3
|
+
package driver
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"context"
|
|
7
|
+
"strings"
|
|
8
|
+
|
|
9
|
+
ast "github.com/microsoft/typescript-go/shim/ast"
|
|
10
|
+
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
11
|
+
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
12
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
// TypeScript 7.1 compiler target.
|
|
16
|
+
//
|
|
17
|
+
// The driver's emit and diagnostic glue calls compiler APIs whose signatures
|
|
18
|
+
// and semantics differ between the 7.0 and 7.1 compilers. Each function here
|
|
19
|
+
// makes the 7.1 call; target_ts70.go declares the same functions over the 7.0
|
|
20
|
+
// compiler. The ttsc_typescript_7_1 build tag selects this file.
|
|
21
|
+
|
|
22
|
+
// CaseSensitivity is the 7.1 EmitHost case policy.
|
|
23
|
+
func (h *pluginEmitHost) CaseSensitivity() shimtspath.CaseSensitivity {
|
|
24
|
+
return shimcompiler.ProgramCaseSensitivity(h.program)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// BaseDirectory is the 7.1 EmitHost project directory.
|
|
28
|
+
func (h *pluginEmitHost) BaseDirectory() shimtspath.RootedDirectoryPath {
|
|
29
|
+
return h.program.BaseDirectory()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ContentMapperExtensions is the 7.1 EmitHost list of content-mapper extensions.
|
|
33
|
+
func (h *pluginEmitHost) ContentMapperExtensions() []string {
|
|
34
|
+
return h.program.ContentMapperExtensions()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ContentMapperExtensionRewrites is the 7.1 EmitHost list of content-mapper
|
|
38
|
+
// output extension rewrites.
|
|
39
|
+
func (h *pluginEmitHost) ContentMapperExtensionRewrites() []shimtspath.ExtensionRewrite {
|
|
40
|
+
return h.program.ContentMapperExtensionRewrites()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// NewEmitResolver is the 7.1 EmitHost resolver for one emit context, guarded
|
|
44
|
+
// to the program's original member accesses.
|
|
45
|
+
func (h *pluginEmitHost) NewEmitResolver(emitContext *shimprinter.EmitContext) shimprinter.EmitResolver {
|
|
46
|
+
return guardedEmitResolver{h.checker.NewEmitResolver(emitContext), h.originalMembers}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// handleNoEmit applies noEmitOnError's whole-program diagnostic gate. A nil
|
|
50
|
+
// result means emit may proceed.
|
|
51
|
+
func handleNoEmit(ctx context.Context, program *shimcompiler.Program) *shimcompiler.EmitResult {
|
|
52
|
+
return shimcompiler.HandleNoEmitOptions(ctx, program, nil, nil)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// applyScriptTransformers runs the compiler's script transformers for source
|
|
56
|
+
// over tree, resolving through host's guarded emit resolver, and returns the
|
|
57
|
+
// transformed tree.
|
|
58
|
+
func applyScriptTransformers(emitContext *shimprinter.EmitContext, host *pluginEmitHost, source *ast.SourceFile, tree *ast.SourceFile) *ast.SourceFile {
|
|
59
|
+
for _, transformer := range shimcompiler.GetScriptTransformers(host.NewEmitResolver(emitContext), host, source) {
|
|
60
|
+
tree = transformer.TransformSourceFile(tree)
|
|
61
|
+
}
|
|
62
|
+
return tree
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// scriptWriteFileData is the WriteFileData the 7.1 emitter passes with a
|
|
66
|
+
// JavaScript output: its source-map URL position and its source file.
|
|
67
|
+
func scriptWriteFileData(source *ast.SourceFile, sourceMapURLPos int) *shimcompiler.WriteFileData {
|
|
68
|
+
return &shimcompiler.WriteFileData{SourceMapUrlPos: sourceMapURLPos, SourceFile: source}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// sourceMapWriteFileData is the WriteFileData the 7.1 emitter passes with a
|
|
72
|
+
// source map: only its source file.
|
|
73
|
+
func sourceMapWriteFileData(source *ast.SourceFile) *shimcompiler.WriteFileData {
|
|
74
|
+
return &shimcompiler.WriteFileData{SourceFile: source}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// declarationShapeEmitOptions returns the forced declaration emit of one file
|
|
78
|
+
// that the declaration-shape digest reads.
|
|
79
|
+
func declarationShapeEmitOptions(file *ast.SourceFile, writeFile shimcompiler.WriteFile) shimcompiler.EmitOptions {
|
|
80
|
+
return shimcompiler.EmitOptions{TargetSourceFiles: []*ast.SourceFile{file}, EmitOnly: shimcompiler.EmitOnlyBuilderSignature, WriteFile: writeFile}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// writeDeclarationShapeDiagnosticFile writes how upstream incremental names a
|
|
84
|
+
// diagnostic's file relative to the file whose signature it belongs to.
|
|
85
|
+
func writeDeclarationShapeDiagnosticFile(builder *strings.Builder, source *ast.SourceFile, diagnosticFile *ast.SourceFile) {
|
|
86
|
+
if relative, ok := shimtspath.CaseInsensitive.RelativePathFromFile(source.FileName(), diagnosticFile.FileName()); ok {
|
|
87
|
+
builder.WriteString(string(relative.AsModuleSpecifier()))
|
|
88
|
+
} else {
|
|
89
|
+
builder.WriteString(string(diagnosticFile.FileName()))
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// fileDiagnostics returns the bind and semantic diagnostics of one file under
|
|
94
|
+
// the compiler's any-program diagnostic rules.
|
|
95
|
+
func fileDiagnostics(ctx context.Context, program *shimcompiler.Program, file *ast.SourceFile) []*ast.Diagnostic {
|
|
96
|
+
return shimcompiler.GetDiagnosticsOfAnyProgram(ctx, program, []*ast.SourceFile{file}, false, program.GetBindDiagnostics, program.GetSemanticDiagnostics)
|
|
97
|
+
}
|
|
@@ -93,7 +93,7 @@ func (p *Program) TransformDependenciesFor(cwd string) TransformDependencies {
|
|
|
93
93
|
files := p.sourceFilesRaw()
|
|
94
94
|
keys := make([]string, 0, len(files))
|
|
95
95
|
for _, file := range files {
|
|
96
|
-
keys = append(keys, TransformOutputKey(cwd, file.FileName()))
|
|
96
|
+
keys = append(keys, TransformOutputKey(cwd, string(file.FileName())))
|
|
97
97
|
}
|
|
98
98
|
return p.plugins.transformDependencies(keys)
|
|
99
99
|
}
|
|
@@ -4,7 +4,6 @@ import (
|
|
|
4
4
|
"encoding/base64"
|
|
5
5
|
"encoding/json"
|
|
6
6
|
"fmt"
|
|
7
|
-
"path"
|
|
8
7
|
"strings"
|
|
9
8
|
"unicode/utf16"
|
|
10
9
|
|
|
@@ -45,20 +44,20 @@ func (p *Program) AuthoredSourceMap(file *ast.SourceFile, sourceMap string) (aut
|
|
|
45
44
|
return file.Text(), sourceMap, true
|
|
46
45
|
}
|
|
47
46
|
authored = file.Text()
|
|
48
|
-
if start, length, found := sourcePreambleRegion(file.FileName(), authored, p.SourcePreamble); found {
|
|
47
|
+
if start, length, found := sourcePreambleRegion(string(file.FileName()), authored, p.SourcePreamble); found {
|
|
49
48
|
authored = authored[:start] + authored[start+length:]
|
|
50
49
|
}
|
|
51
|
-
directory :=
|
|
50
|
+
directory := shimtspath.FileDirectory(file.FileName())
|
|
52
51
|
corrected, ok = correctAuthoredSourceMap(sourceMap, func(source string) *authoredRegion {
|
|
53
52
|
name := sourceMapFileName(source, directory)
|
|
54
53
|
target := file
|
|
55
|
-
if name != file.FileName() {
|
|
54
|
+
if name != string(file.FileName()) {
|
|
56
55
|
target = p.SourceFile(name)
|
|
57
56
|
}
|
|
58
57
|
if target == nil {
|
|
59
58
|
return nil
|
|
60
59
|
}
|
|
61
|
-
return newAuthoredRegion(target.FileName(), target.Text(), p.SourcePreamble)
|
|
60
|
+
return newAuthoredRegion(string(target.FileName()), target.Text(), p.SourcePreamble)
|
|
62
61
|
})
|
|
63
62
|
return authored, corrected, ok
|
|
64
63
|
}
|
|
@@ -99,40 +98,42 @@ func (p *Program) NewSourceMapCorrector() func(fileName, text string) (string, e
|
|
|
99
98
|
if !options.SourceMap.IsTrue() && !options.InlineSourceMap.IsTrue() && !options.GetAreDeclarationMapsEnabled() {
|
|
100
99
|
return func(_ string, text string) (string, error) { return text, nil }
|
|
101
100
|
}
|
|
102
|
-
directories := map[shimtspath.
|
|
103
|
-
|
|
104
|
-
return shimtspath.ToPath(name, program.GetCurrentDirectory(), program.UseCaseSensitiveFileNames())
|
|
105
|
-
}
|
|
106
|
-
register := func(output, mapOutput string, source *ast.SourceFile) {
|
|
101
|
+
directories := map[shimtspath.PathKey]shimtspath.RootedDirectoryPath{}
|
|
102
|
+
register := func(output, mapOutput shimtspath.RootedFilePath, source *ast.SourceFile) {
|
|
107
103
|
if output == "" {
|
|
108
104
|
return
|
|
109
105
|
}
|
|
110
106
|
directory := shimcompiler.SourceMapDirectory(options, host, output, source)
|
|
111
|
-
directories[
|
|
107
|
+
directories[shimcompiler.ProgramPathKey(program, output)] = directory
|
|
112
108
|
if mapOutput != "" {
|
|
113
|
-
directories[
|
|
109
|
+
directories[shimcompiler.ProgramPathKey(program, mapOutput)] = directory
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
|
-
for _, source := range shimcompiler.
|
|
117
|
-
outputs := shimcompiler.
|
|
112
|
+
for _, source := range shimcompiler.SourceFilesToEmit(host) {
|
|
113
|
+
outputs := shimcompiler.OutputPathsFor(source, options, host)
|
|
118
114
|
register(outputs.JsFilePath(), outputs.SourceMapFilePath(), source)
|
|
119
115
|
register(outputs.DeclarationFilePath(), outputs.DeclarationMapPath(), source)
|
|
120
116
|
}
|
|
121
117
|
regions := map[*ast.SourceFile]*authoredRegion{}
|
|
122
|
-
resolve := func(source, directory
|
|
123
|
-
|
|
118
|
+
resolve := func(source string, directory shimtspath.RootedDirectoryPath) *authoredRegion {
|
|
119
|
+
name, rooted := shimtspath.TryRootedFilePathFromAbsolute(sourceMapFileName(source, directory))
|
|
120
|
+
if !rooted {
|
|
121
|
+
return nil
|
|
122
|
+
}
|
|
123
|
+
target := program.GetSourceFile(name)
|
|
124
124
|
if target == nil {
|
|
125
125
|
return nil
|
|
126
126
|
}
|
|
127
127
|
region, found := regions[target]
|
|
128
128
|
if !found {
|
|
129
|
-
region = newAuthoredRegionWithText(target.FileName(), target.Text(), preamble, options.InlineSources.IsTrue())
|
|
129
|
+
region = newAuthoredRegionWithText(string(target.FileName()), target.Text(), preamble, options.InlineSources.IsTrue())
|
|
130
130
|
regions[target] = region
|
|
131
131
|
}
|
|
132
132
|
return region
|
|
133
133
|
}
|
|
134
134
|
return func(fileName, text string) (string, error) {
|
|
135
|
-
|
|
135
|
+
output := shimtspath.ToRootedFilePath(fileName, program.GetCurrentDirectory())
|
|
136
|
+
if p.isBuildInfoOutput(output) {
|
|
136
137
|
return text, nil
|
|
137
138
|
}
|
|
138
139
|
lower := strings.ToLower(fileName)
|
|
@@ -140,7 +141,7 @@ func (p *Program) NewSourceMapCorrector() func(fileName, text string) (string, e
|
|
|
140
141
|
if !external && !isInlineSourceMapCarrier(lower) {
|
|
141
142
|
return text, nil
|
|
142
143
|
}
|
|
143
|
-
directory, known := directories[
|
|
144
|
+
directory, known := directories[shimcompiler.ProgramPathKey(program, output)]
|
|
144
145
|
if !known {
|
|
145
146
|
return "", fmt.Errorf("driver: source map output has no compiler source directory: %s", fileName)
|
|
146
147
|
}
|
|
@@ -176,7 +177,7 @@ func (p *Program) NewSourceMapCorrector() func(fileName, text string) (string, e
|
|
|
176
177
|
// sourceMapFileName reverses the pinned generator's raw file-URL spelling.
|
|
177
178
|
// GetRelativePathToDirectoryOrUrl does not percent-encode source names, so a
|
|
178
179
|
// literal '%' remains filename data and must not undergo URL unescaping.
|
|
179
|
-
func sourceMapFileName(source, directory
|
|
180
|
+
func sourceMapFileName(source string, directory shimtspath.RootedDirectoryPath) string {
|
|
180
181
|
name := shimtspath.GetNormalizedAbsolutePath(source, directory)
|
|
181
182
|
if strings.HasPrefix(name, "file:///") {
|
|
182
183
|
drive := strings.TrimPrefix(name, "file:///")
|
package/go.mod
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module github.com/samchon/ttsc/packages/ttsc
|
|
2
2
|
|
|
3
|
-
go 1.
|
|
3
|
+
go 1.27
|
|
4
4
|
|
|
5
5
|
// Maintained shim sub-modules are resolved by these package-local replacements.
|
|
6
6
|
// Their pinned typescript-go dependency is resolved through the Go module cache;
|
|
@@ -45,9 +45,9 @@ require (
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
require (
|
|
48
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
48
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 // indirect
|
|
49
49
|
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
|
50
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
50
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b // indirect
|
|
51
51
|
github.com/zeebo/xxh3 v1.1.0 // indirect
|
|
52
52
|
golang.org/x/sync v0.21.0 // indirect
|
|
53
53
|
golang.org/x/text v0.38.0 // indirect
|
package/go.sum
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
2
|
-
github.com/go-json-experiment/json v0.0.0-
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 h1:KZaTBSyshWX3MP5jukJcNSuXDQTO+rNpt0J564dX/eg=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
3
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
4
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
5
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
|
6
6
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
|
7
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
8
|
-
github.com/microsoft/typescript-go v0.0.0-
|
|
7
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b h1:IgfPOv9pzPZ1sbyRHOKu3UCvhaTS0IyrkTcs6JLPqhY=
|
|
8
|
+
github.com/microsoft/typescript-go v0.0.0-20260708042240-2bd066d87f5b/go.mod h1:gV4G6M8xxLNqQSRHiFOgKHlY+5YJgYPM6QwFLWllC+8=
|
|
9
9
|
github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
|
|
10
10
|
github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
|
|
11
11
|
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
|
@@ -89,16 +89,16 @@ export namespace Names {
|
|
|
89
89
|
{"Names.read", "Names.Props.nested.deep", NodeVariable, EdgeValueAccess},
|
|
90
90
|
{"Names.read", "Names.Widget.render", NodeMethod, EdgeValueCall},
|
|
91
91
|
} {
|
|
92
|
-
target := nodeID(file, item.member, item.kind)
|
|
92
|
+
target := nodeID(string(file), item.member, item.kind)
|
|
93
93
|
if node := g.Nodes[target]; node == nil || node.End <= node.Pos || node.Name != item.member {
|
|
94
94
|
t.Errorf("missing member %s", item.member)
|
|
95
95
|
}
|
|
96
|
-
if !hasEdge(g, nodeID(file, item.caller, NodeFunction), target, item.edge) {
|
|
96
|
+
if !hasEdge(g, nodeID(string(file), item.caller, NodeFunction), target, item.edge) {
|
|
97
97
|
t.Errorf("missing %s -> %s", item.caller, item.member)
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
for member, kind := range map[string]NodeKind{"Widget.render": NodeMethod, "Widget.field": NodeVariable, "Sale.secret": NodeVariable} {
|
|
101
|
-
if !hasEdge(g, nodeID(file, member, kind), nodeID(file, "helper", NodeFunction), EdgeValueCall) {
|
|
101
|
+
if !hasEdge(g, nodeID(string(file), member, kind), nodeID(string(file), "helper", NodeFunction), EdgeValueCall) {
|
|
102
102
|
t.Errorf("%s lost helper call", member)
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -106,10 +106,10 @@ export namespace Names {
|
|
|
106
106
|
name string
|
|
107
107
|
kind NodeKind
|
|
108
108
|
}{{"Base", NodeClass}, {"Drawable", NodeInterface}} {
|
|
109
|
-
if !hasEdge(g, nodeID(file, "Widget", NodeVariable), nodeID(file, target.name, target.kind), EdgeHeritage) {
|
|
109
|
+
if !hasEdge(g, nodeID(string(file), "Widget", NodeVariable), nodeID(string(file), target.name, target.kind), EdgeHeritage) {
|
|
110
110
|
t.Errorf("Widget lost heritage to %s", target.name)
|
|
111
111
|
}
|
|
112
|
-
if !hasEdge(g, nodeID(file, "Widget.render", NodeMethod), nodeID(file, target.name+".render", NodeMethod), EdgeMemberRelation) {
|
|
112
|
+
if !hasEdge(g, nodeID(string(file), "Widget.render", NodeMethod), nodeID(string(file), target.name+".render", NodeMethod), EdgeMemberRelation) {
|
|
113
113
|
t.Errorf("Widget.render lost relation to %s.render", target.name)
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -117,19 +117,19 @@ export namespace Names {
|
|
|
117
117
|
member string
|
|
118
118
|
kind EdgeKind
|
|
119
119
|
}{{"Widget.create", EdgeValueCall}, {"Widget.identity", EdgeValueAccess}} {
|
|
120
|
-
if !hasEdge(g, nodeID(file, item.member, NodeMethod), nodeID(file, "Widget", NodeVariable), item.kind) {
|
|
120
|
+
if !hasEdge(g, nodeID(string(file), item.member, NodeMethod), nodeID(string(file), "Widget", NodeVariable), item.kind) {
|
|
121
121
|
t.Errorf("%s lost its bound class identity", item.member)
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
if hasEdge(g, nodeID(file, "draw", NodeFunction), nodeID(file, "Other.render", NodeMethod), EdgeValueCall) ||
|
|
125
|
-
hasEdge(g, nodeID(file, "other", NodeFunction), nodeID(file, "Widget.render", NodeMethod), EdgeValueCall) {
|
|
124
|
+
if hasEdge(g, nodeID(string(file), "draw", NodeFunction), nodeID(string(file), "Other.render", NodeMethod), EdgeValueCall) ||
|
|
125
|
+
hasEdge(g, nodeID(string(file), "other", NodeFunction), nodeID(string(file), "Widget.render", NodeMethod), EdgeValueCall) {
|
|
126
126
|
t.Error("class-expression calls crossed their lexical owners")
|
|
127
127
|
}
|
|
128
128
|
for _, item := range []struct {
|
|
129
129
|
caller, target string
|
|
130
130
|
kind NodeKind
|
|
131
131
|
}{{"localClass", "Widget", NodeVariable}, {"localClass", "Widget.create", NodeMethod}, {"localObject", "api.run", NodeMethod}} {
|
|
132
|
-
if hasEdge(g, nodeID(file, item.caller, NodeFunction), nodeID(file, item.target, item.kind), EdgeValueCall) {
|
|
132
|
+
if hasEdge(g, nodeID(string(file), item.caller, NodeFunction), nodeID(string(file), item.target, item.kind), EdgeValueCall) {
|
|
133
133
|
t.Errorf("%s borrowed unrelated top-level target %s", item.caller, item.target)
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -74,8 +74,8 @@ patched = (message: string): void => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
module := moduleID(mainPath)
|
|
78
|
-
helper := nodeID(mainPath, "helper", NodeFunction)
|
|
77
|
+
module := moduleID(string(mainPath))
|
|
78
|
+
helper := nodeID(string(mainPath), "helper", NodeFunction)
|
|
79
79
|
if !hasEdge(graph, module, helper, EdgeValueCall) {
|
|
80
80
|
t.Fatalf("the assigned body's call to helper is not owned by the running module; edges: %v", graph.Edges)
|
|
81
81
|
}
|
package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go
CHANGED
|
@@ -83,8 +83,8 @@ patched = (message: string): void => {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
module := moduleID(mainPath)
|
|
87
|
-
helper := nodeID(mainPath, "helper", NodeFunction)
|
|
86
|
+
module := moduleID(string(mainPath))
|
|
87
|
+
helper := nodeID(string(mainPath), "helper", NodeFunction)
|
|
88
88
|
if !hasEdge(graph, module, helper, EdgeValueCall) {
|
|
89
89
|
t.Fatalf("the assigned body's call to helper is not owned by the running module; edges: %v", graph.Edges)
|
|
90
90
|
}
|