ttsc 0.33.1 → 0.34.1
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 +580 -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
|
@@ -40,7 +40,7 @@ func TestServeShardsDeleteRemovedSource(t *testing.T) {
|
|
|
40
40
|
}
|
|
41
41
|
removedKeyFile := removedSource.FileName()
|
|
42
42
|
keepKeyFile := keepSource.FileName()
|
|
43
|
-
removedKey := session.graphStore.sourceKeys[removedKeyFile]
|
|
43
|
+
removedKey := session.graphStore.sourceKeys[string(removedKeyFile)]
|
|
44
44
|
if removedKey == "" {
|
|
45
45
|
t.Fatal("initial generation omitted removable source shard")
|
|
46
46
|
}
|
|
@@ -58,10 +58,10 @@ func TestServeShardsDeleteRemovedSource(t *testing.T) {
|
|
|
58
58
|
if !containsString(replacement.Deletes, removedKey) {
|
|
59
59
|
t.Fatalf("replacement did not delete removed source shard %q: %v", removedKey, replacement.Deletes)
|
|
60
60
|
}
|
|
61
|
-
if _, exists := session.graphStore.sourceKeys[removedKeyFile]; exists {
|
|
61
|
+
if _, exists := session.graphStore.sourceKeys[string(removedKeyFile)]; exists {
|
|
62
62
|
t.Fatal("committed store retained removed source identity")
|
|
63
63
|
}
|
|
64
|
-
if session.graphStore.sourceKeys[keepKeyFile] == "" {
|
|
64
|
+
if session.graphStore.sourceKeys[string(keepKeyFile)] == "" {
|
|
65
65
|
t.Fatal("replacement generation dropped remaining source")
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -39,7 +39,7 @@ func TestServeShardsPruneUnreferencedExternalEndpoints(t *testing.T) {
|
|
|
39
39
|
if source == nil {
|
|
40
40
|
t.Fatal("fixture source was absent from resident program")
|
|
41
41
|
}
|
|
42
|
-
sourceKey := session.graphStore.sourceKeys[source.FileName()]
|
|
42
|
+
sourceKey := session.graphStore.sourceKeys[string(source.FileName())]
|
|
43
43
|
if sourceKey == "" || len(session.graphStore.sourceExternal[sourceKey]) != 1 {
|
|
44
44
|
t.Fatalf("fixture source must own one external endpoint: key=%q targets=%v", sourceKey, session.graphStore.sourceExternal[sourceKey])
|
|
45
45
|
}
|
|
@@ -48,7 +48,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
|
|
|
48
48
|
t.Fatal("fixture source was absent from resident program")
|
|
49
49
|
}
|
|
50
50
|
consumerKeyFile := consumerSource.FileName()
|
|
51
|
-
initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
|
|
51
|
+
initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
|
|
52
52
|
if initialConsumerKey == "" {
|
|
53
53
|
t.Fatal("initial generation omitted the dependent source shard")
|
|
54
54
|
}
|
|
@@ -67,7 +67,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
|
|
|
67
67
|
if createdSource == nil {
|
|
68
68
|
t.Fatal("created source did not enter the resident program")
|
|
69
69
|
}
|
|
70
|
-
createdKey := session.graphStore.sourceKeys[createdSource.FileName()]
|
|
70
|
+
createdKey := session.graphStore.sourceKeys[string(createdSource.FileName())]
|
|
71
71
|
if createdKey == "" {
|
|
72
72
|
t.Fatal("created source did not acquire a committed shard identity")
|
|
73
73
|
}
|
|
@@ -76,7 +76,7 @@ func TestServeShardsPublishCreatedSource(t *testing.T) {
|
|
|
76
76
|
}
|
|
77
77
|
// The unchanged consumer text must acquire a different published shard key;
|
|
78
78
|
// the call-edge contents are not independently checked here.
|
|
79
|
-
nextConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
|
|
79
|
+
nextConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
|
|
80
80
|
if nextConsumerKey == "" || nextConsumerKey == initialConsumerKey {
|
|
81
81
|
t.Fatalf("dependent shard identity %q survived a newly resolved import", nextConsumerKey)
|
|
82
82
|
}
|
|
@@ -43,7 +43,7 @@ func TestServeShardsRefreshCrossFileImplementation(t *testing.T) {
|
|
|
43
43
|
if serviceSource == nil {
|
|
44
44
|
t.Fatal("service source was absent from resident program")
|
|
45
45
|
}
|
|
46
|
-
serviceKey := session.graphStore.sourceKeys[serviceSource.FileName()]
|
|
46
|
+
serviceKey := session.graphStore.sourceKeys[string(serviceSource.FileName())]
|
|
47
47
|
initialService, exists := session.graphStore.shards[serviceKey]
|
|
48
48
|
if serviceKey == "" || !exists || initialService.digest == "" {
|
|
49
49
|
t.Fatal("initial Service shard has no committed identity or digest")
|
|
@@ -73,7 +73,7 @@ func TestServeShardsRefreshCrossFileImplementation(t *testing.T) {
|
|
|
73
73
|
if session.graphStore.shards[serviceKey].digest == before {
|
|
74
74
|
t.Fatal("declaration shard retained its cross-file implementation evidence")
|
|
75
75
|
}
|
|
76
|
-
currentServiceKey := session.graphStore.sourceKeys[serviceSource.FileName()]
|
|
76
|
+
currentServiceKey := session.graphStore.sourceKeys[string(serviceSource.FileName())]
|
|
77
77
|
currentService, exists := session.graphStore.shards[currentServiceKey]
|
|
78
78
|
if currentServiceKey == "" || !exists || currentService.digest == "" || currentService.digest == before {
|
|
79
79
|
t.Fatalf("current Service shard was not replaced with a changed digest: key=%q shard=%#v", currentServiceKey, currentService)
|
|
@@ -42,7 +42,7 @@ func TestServeShardsRefreshDependentDiagnostics(t *testing.T) {
|
|
|
42
42
|
if consumerSource == nil {
|
|
43
43
|
t.Fatal("consumer source was absent from resident program")
|
|
44
44
|
}
|
|
45
|
-
consumerKey := session.graphStore.sourceKeys[consumerSource.FileName()]
|
|
45
|
+
consumerKey := session.graphStore.sourceKeys[string(consumerSource.FileName())]
|
|
46
46
|
initialConsumer, exists := session.graphStore.shards[consumerKey]
|
|
47
47
|
if consumerKey == "" || !exists || initialConsumer.digest == "" {
|
|
48
48
|
t.Fatal("initial consumer shard has no committed identity or digest")
|
|
@@ -90,8 +90,8 @@ func TestServeShardsRefreshDependentDiagnostics(t *testing.T) {
|
|
|
90
90
|
valueKeyFile := session.compiler.Program().SourceFile(value).FileName()
|
|
91
91
|
consumerKeyFile := consumerSource.FileName()
|
|
92
92
|
if len(session.graphStore.extractedFiles) != 2 ||
|
|
93
|
-
session.graphStore.extractedFiles[0] != consumerKeyFile ||
|
|
94
|
-
session.graphStore.extractedFiles[1] != valueKeyFile {
|
|
93
|
+
session.graphStore.extractedFiles[0] != string(consumerKeyFile) ||
|
|
94
|
+
session.graphStore.extractedFiles[1] != string(valueKeyFile) {
|
|
95
95
|
t.Fatalf(
|
|
96
96
|
"public API edit extracted %v, want reverse closure [%s %s]",
|
|
97
97
|
session.graphStore.extractedFiles,
|
|
@@ -52,8 +52,8 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
|
|
|
52
52
|
}
|
|
53
53
|
originalKeyFile := originalSource.FileName()
|
|
54
54
|
consumerKeyFile := consumerSource.FileName()
|
|
55
|
-
originalKey := session.graphStore.sourceKeys[originalKeyFile]
|
|
56
|
-
initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
|
|
55
|
+
originalKey := session.graphStore.sourceKeys[string(originalKeyFile)]
|
|
56
|
+
initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
|
|
57
57
|
if originalKey == "" || initialConsumerKey == "" {
|
|
58
58
|
t.Fatal("initial generation omitted a fixture source shard")
|
|
59
59
|
}
|
|
@@ -74,14 +74,14 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
|
|
|
74
74
|
if !containsString(next.Deletes, originalKey) {
|
|
75
75
|
t.Fatalf("rename did not delete the superseded shard %q: %v", originalKey, next.Deletes)
|
|
76
76
|
}
|
|
77
|
-
if _, exists := session.graphStore.sourceKeys[originalKeyFile]; exists {
|
|
77
|
+
if _, exists := session.graphStore.sourceKeys[string(originalKeyFile)]; exists {
|
|
78
78
|
t.Fatal("committed store retained the pre-rename source identity")
|
|
79
79
|
}
|
|
80
80
|
renamedSource := session.compiler.Program().SourceFile(renamed)
|
|
81
81
|
if renamedSource == nil {
|
|
82
82
|
t.Fatal("renamed source did not enter the resident program")
|
|
83
83
|
}
|
|
84
|
-
renamedKey := session.graphStore.sourceKeys[renamedSource.FileName()]
|
|
84
|
+
renamedKey := session.graphStore.sourceKeys[string(renamedSource.FileName())]
|
|
85
85
|
if renamedKey == "" {
|
|
86
86
|
t.Fatal("renamed source did not acquire a committed shard identity")
|
|
87
87
|
}
|
|
@@ -91,7 +91,7 @@ func TestServeShardsRenameMovesSourceIdentity(t *testing.T) {
|
|
|
91
91
|
if !containsUpsertedShardKey(next, renamedKey) {
|
|
92
92
|
t.Fatalf("generation did not publish the renamed source shard %q", renamedKey)
|
|
93
93
|
}
|
|
94
|
-
nextConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
|
|
94
|
+
nextConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
|
|
95
95
|
if nextConsumerKey == "" || nextConsumerKey == initialConsumerKey {
|
|
96
96
|
t.Fatalf("dependent shard identity %q survived a repointed import", nextConsumerKey)
|
|
97
97
|
}
|
|
@@ -55,16 +55,16 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
|
|
|
55
55
|
valueKeyFile := valueSource.FileName()
|
|
56
56
|
consumerKeyFile := consumerSource.FileName()
|
|
57
57
|
unrelatedKeyFile := unrelatedSource.FileName()
|
|
58
|
-
initialValueKey := session.graphStore.sourceKeys[valueKeyFile]
|
|
59
|
-
initialConsumerKey := session.graphStore.sourceKeys[consumerKeyFile]
|
|
60
|
-
initialUnrelatedKey := session.graphStore.sourceKeys[unrelatedKeyFile]
|
|
58
|
+
initialValueKey := session.graphStore.sourceKeys[string(valueKeyFile)]
|
|
59
|
+
initialConsumerKey := session.graphStore.sourceKeys[string(consumerKeyFile)]
|
|
60
|
+
initialUnrelatedKey := session.graphStore.sourceKeys[string(unrelatedKeyFile)]
|
|
61
61
|
if initialValueKey == "" || initialConsumerKey == "" || initialUnrelatedKey == "" {
|
|
62
62
|
t.Fatal("initial generation omitted a fixture source key")
|
|
63
63
|
}
|
|
64
|
-
unrelatedWireFile := session.graphStore.wireSources[unrelatedKeyFile]
|
|
64
|
+
unrelatedWireFile := session.graphStore.wireSources[string(unrelatedKeyFile)]
|
|
65
65
|
alteredUnrelatedProvenance := false
|
|
66
66
|
for index := range session.graphStore.provenance.Sources {
|
|
67
|
-
if session.graphStore.provenance.Sources[index].File != unrelatedKeyFile {
|
|
67
|
+
if session.graphStore.provenance.Sources[index].File != string(unrelatedKeyFile) {
|
|
68
68
|
continue
|
|
69
69
|
}
|
|
70
70
|
if runtime.GOOS == "windows" {
|
|
@@ -92,7 +92,7 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
|
|
|
92
92
|
if delta == nil || mode != serveModeIncremental || !changed || delta.BaseSequence != initial.Sequence || delta.BaseGeneration != initial.Generation {
|
|
93
93
|
t.Fatalf("incremental coordinates: snapshot=%#v mode=%q changed=%v", delta, mode, changed)
|
|
94
94
|
}
|
|
95
|
-
nextValueKey := session.graphStore.sourceKeys[valueKeyFile]
|
|
95
|
+
nextValueKey := session.graphStore.sourceKeys[string(valueKeyFile)]
|
|
96
96
|
if nextValueKey == "" || nextValueKey == initialValueKey {
|
|
97
97
|
t.Fatal("changed source retained its content-addressed shard key")
|
|
98
98
|
}
|
|
@@ -102,10 +102,10 @@ func TestServeShardsReuseUnaffectedSources(t *testing.T) {
|
|
|
102
102
|
if !containsString(delta.Deletes, initialValueKey) {
|
|
103
103
|
t.Fatalf("delta did not delete superseded source shard %q: %v", initialValueKey, delta.Deletes)
|
|
104
104
|
}
|
|
105
|
-
if session.graphStore.sourceKeys[consumerKeyFile] != initialConsumerKey || session.graphStore.sourceKeys[unrelatedKeyFile] != initialUnrelatedKey {
|
|
105
|
+
if session.graphStore.sourceKeys[string(consumerKeyFile)] != initialConsumerKey || session.graphStore.sourceKeys[string(unrelatedKeyFile)] != initialUnrelatedKey {
|
|
106
106
|
t.Fatal("body edit moved an unchanged source shard identity")
|
|
107
107
|
}
|
|
108
|
-
if len(session.graphStore.extractedFiles) != 1 || session.graphStore.extractedFiles[0] != valueKeyFile {
|
|
108
|
+
if len(session.graphStore.extractedFiles) != 1 || session.graphStore.extractedFiles[0] != string(valueKeyFile) {
|
|
109
109
|
t.Fatalf("private body edit extracted %v, want only %s", session.graphStore.extractedFiles, valueKeyFile)
|
|
110
110
|
}
|
|
111
111
|
wireFilePreserved := false
|
|
@@ -106,10 +106,10 @@ func TestServeSourceEncodingKeepsRawIdentityAndDecodedResidentText(t *testing.T)
|
|
|
106
106
|
t.Errorf("%s %s decoded text=%q want=%q", stage, name, source.Text(), text(name, suffix))
|
|
107
107
|
}
|
|
108
108
|
rawHash := sha256.Sum256(bytesOf(name, text(name, suffix)))
|
|
109
|
-
if hashes[source.FileName()] != rawHash {
|
|
109
|
+
if hashes[string(source.FileName())] != rawHash {
|
|
110
110
|
t.Errorf("%s %s invalidation identity differs from raw bytes", stage, name)
|
|
111
111
|
}
|
|
112
|
-
if digests[source.FileName()] != graph.Digest(rawHash) {
|
|
112
|
+
if digests[string(source.FileName())] != graph.Digest(rawHash) {
|
|
113
113
|
t.Errorf("%s %s disk digest differs from raw bytes", stage, name)
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -9,6 +9,7 @@ import (
|
|
|
9
9
|
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
10
10
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
11
11
|
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
12
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
// TestBuildInformationUsesSelectedOutputIdentity Verifies incremental metadata
|
|
@@ -76,11 +77,11 @@ func TestBuildInformationUsesSelectedOutputIdentity(t *testing.T) {
|
|
|
76
77
|
state = "tsconfig.tsbuildinfo"
|
|
77
78
|
}
|
|
78
79
|
expected := filepath.ToSlash(filepath.Join(root, state))
|
|
79
|
-
if escaped := p.outputEscapesOutDir(expected); escaped == c.incremental {
|
|
80
|
+
if escaped := p.outputEscapesOutDir(shimtspath.RootedFilePathFromAbsolute(expected)); escaped == c.incremental {
|
|
80
81
|
t.Errorf("selected state containment: escaped=%v incremental=%v", escaped, c.incremental)
|
|
81
82
|
}
|
|
82
83
|
for _, decoy := range []string{"cache/unrelated.tsbuildinfo", "cache/unrelated.map"} {
|
|
83
|
-
if !p.outputEscapesOutDir(filepath.ToSlash(filepath.Join(root, decoy))) {
|
|
84
|
+
if !p.outputEscapesOutDir(shimtspath.RootedFilePathFromAbsolute(filepath.ToSlash(filepath.Join(root, decoy)))) {
|
|
84
85
|
t.Errorf("unselected output escaped containment: %s", decoy)
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -105,8 +106,8 @@ func TestBuildInformationUsesSelectedOutputIdentity(t *testing.T) {
|
|
|
105
106
|
for _, lane := range []string{"raw", "rewrite", "plugin"} {
|
|
106
107
|
t.Run(lane, func(t *testing.T) {
|
|
107
108
|
writes := map[string]string{}
|
|
108
|
-
writer := func(file, text string, _ *shimcompiler.WriteFileData) error {
|
|
109
|
-
writes[filepath.ToSlash(file)] = text
|
|
109
|
+
writer := func(file shimtspath.RootedFilePath, text string, _ *shimcompiler.WriteFileData) error {
|
|
110
|
+
writes[filepath.ToSlash(string(file))] = text
|
|
110
111
|
return nil
|
|
111
112
|
}
|
|
112
113
|
var emitted []Diagnostic
|
|
@@ -41,7 +41,7 @@ func WriteCheckObservationsJSON(fileName string, program *Program) error {
|
|
|
41
41
|
}
|
|
42
42
|
if program != nil {
|
|
43
43
|
if program.TSProgram != nil {
|
|
44
|
-
graph = NewTransformGraph(program, program.TSProgram.GetCurrentDirectory())
|
|
44
|
+
graph = NewTransformGraph(program, string(program.TSProgram.GetCurrentDirectory()))
|
|
45
45
|
}
|
|
46
46
|
if recorded := program.PluginHostInputs(); recorded != nil {
|
|
47
47
|
inputs = recorded
|
|
@@ -4,6 +4,7 @@ import (
|
|
|
4
4
|
"os"
|
|
5
5
|
"path/filepath"
|
|
6
6
|
|
|
7
|
+
"github.com/microsoft/typescript-go/shim/tspath"
|
|
7
8
|
"github.com/microsoft/typescript-go/shim/vfs/osvfs"
|
|
8
9
|
)
|
|
9
10
|
|
|
@@ -159,7 +160,10 @@ func ReportRejectedConfigCandidates(candidates []ConfigCandidate, hashReporter,
|
|
|
159
160
|
// conflict and leave every persistent consumer unable to reuse.
|
|
160
161
|
before, beforeErr := os.Stat(resolved)
|
|
161
162
|
if beforeErr == nil && before.IsDir() {
|
|
162
|
-
physical :=
|
|
163
|
+
physical := resolved
|
|
164
|
+
if rooted, ok := tspath.TryRootedPathFromAbsolute(resolved); ok {
|
|
165
|
+
physical = string(osvfs.FS().Realpath(rooted))
|
|
166
|
+
}
|
|
163
167
|
// Realpath returns its argument if the native resolver fails. An
|
|
164
168
|
// unchanged spelling is proof only when no component is an alias or
|
|
165
169
|
// unknown reparse entry; SameFile alone cannot prove its spelling.
|
|
@@ -34,23 +34,21 @@ func (p *Program) DeclarationShapeDigest(file *ast.SourceFile) (string, error) {
|
|
|
34
34
|
}
|
|
35
35
|
var signature strings.Builder
|
|
36
36
|
emitted := false
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
// The forced declaration mode is upstream's declaration emit for
|
|
38
|
+
// incremental signatures; declarationShapeEmitOptions names each target's.
|
|
39
|
+
p.TSProgram.Emit(context.Background(), declarationShapeEmitOptions(file, func(_ shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
40
|
+
emitted = true
|
|
41
|
+
if data != nil && data.SourceMapUrlPos >= 0 && data.SourceMapUrlPos <= len(text) {
|
|
42
|
+
text = text[:data.SourceMapUrlPos]
|
|
43
|
+
}
|
|
44
|
+
signature.WriteString(text)
|
|
45
|
+
if data != nil {
|
|
46
|
+
for _, diagnostic := range data.Diagnostics {
|
|
47
|
+
appendDeclarationShapeDiagnostic(&signature, file, diagnostic)
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
appendDeclarationShapeDiagnostic(&signature, file, diagnostic)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return nil
|
|
52
|
-
},
|
|
53
|
-
})
|
|
49
|
+
}
|
|
50
|
+
return nil
|
|
51
|
+
}))
|
|
54
52
|
if !emitted {
|
|
55
53
|
// Mirrors tsgo's incremental fallback to the file version when forced
|
|
56
54
|
// declaration emit has no output. This is conservative: any body movement
|
|
@@ -68,11 +66,7 @@ func appendDeclarationShapeDiagnostic(builder *strings.Builder, source *ast.Sour
|
|
|
68
66
|
builder.WriteString("\n")
|
|
69
67
|
diagnosticFile := diagnostic.File()
|
|
70
68
|
if diagnosticFile != nil && diagnosticFile != source {
|
|
71
|
-
builder
|
|
72
|
-
shimtspath.GetDirectoryPath(string(source.Path())),
|
|
73
|
-
string(diagnosticFile.Path()),
|
|
74
|
-
shimtspath.ComparePathsOptions{},
|
|
75
|
-
)))
|
|
69
|
+
writeDeclarationShapeDiagnosticFile(builder, source, diagnosticFile)
|
|
76
70
|
}
|
|
77
71
|
if diagnosticFile != nil {
|
|
78
72
|
builder.WriteString(fmt.Sprintf("(%d,%d): ", diagnostic.Pos(), diagnostic.Len()))
|
|
@@ -157,7 +157,7 @@ func (m *preambleMapper) viewOf(file *ast.SourceFile) *preambleView {
|
|
|
157
157
|
// anchor against — an uncorrected position is still better than a nil file.
|
|
158
158
|
func newPreambleView(file *ast.SourceFile, preamble string) *preambleView {
|
|
159
159
|
text := file.Text()
|
|
160
|
-
start, length, ok := sourcePreambleRegion(file.FileName(), text, preamble)
|
|
160
|
+
start, length, ok := sourcePreambleRegion(string(file.FileName()), text, preamble)
|
|
161
161
|
if !ok {
|
|
162
162
|
return nil
|
|
163
163
|
}
|
|
@@ -253,7 +253,7 @@ func unanchoredPreambleDiagnostic(d *ast.Diagnostic) Diagnostic {
|
|
|
253
253
|
Severity: SeverityError,
|
|
254
254
|
}
|
|
255
255
|
if file := d.File(); file != nil {
|
|
256
|
-
out.File = file.FileName()
|
|
256
|
+
out.File = string(file.FileName())
|
|
257
257
|
}
|
|
258
258
|
return out
|
|
259
259
|
}
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
// same way tsc treats node_modules externals (no emit, no error).
|
|
16
16
|
package driver
|
|
17
17
|
|
|
18
|
-
import
|
|
18
|
+
import (
|
|
19
|
+
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
20
|
+
"github.com/microsoft/typescript-go/shim/tspath"
|
|
21
|
+
)
|
|
19
22
|
|
|
20
23
|
// isBuildInfoOutput identifies the metadata artifact selected by this compiler
|
|
21
24
|
// generation. Its configured extension does not determine its kind, and an
|
|
@@ -27,19 +30,16 @@ import "github.com/microsoft/typescript-go/shim/tspath"
|
|
|
27
30
|
// Common: Clear and simple design: One artifact predicate serves containment and source-map correction rather than independent suffix rules.
|
|
28
31
|
// Common: Prohibited implementation shortcuts: The real compiler-selected path replaces the suffix exception; no API-specific filename or consumer exemption compensates for output loss.
|
|
29
32
|
// Common: Meaningful documentation: Native prose distinguishes selected artifact identity from filename extension and explains why unrelated metadata-looking paths remain ordinary outputs.
|
|
30
|
-
// Portability: OS-neutral implementation: Native compiler path comparison uses the loaded Program's
|
|
33
|
+
// Portability: OS-neutral implementation: Native compiler path comparison of rooted paths uses the loaded Program's actual case policy, without assuming case behavior from the operating system.
|
|
31
34
|
// Performance: Efficient algorithms: Upstream destination inference and lexical comparison process a bounded number of path strings with costs proportional to their text; no directory traversal or file read is added.
|
|
32
35
|
// Performance: Reuse equivalent work: The current compiler generation owns destination selection; this predicate introduces no result cache or independent producer.
|
|
33
36
|
// Performance: Bound retention and release resources: The predicate returns a boolean and retains no compiler generation, path history or external resource.
|
|
34
|
-
func (p *Program) isBuildInfoOutput(fileName
|
|
37
|
+
func (p *Program) isBuildInfoOutput(fileName tspath.RootedFilePath) bool {
|
|
35
38
|
if p == nil || p.TSProgram == nil {
|
|
36
39
|
return false
|
|
37
40
|
}
|
|
38
41
|
buildInfo := p.TSProgram.CommandLine().GetBuildInfoFileName()
|
|
39
|
-
return buildInfo != "" && tspath.
|
|
40
|
-
UseCaseSensitiveFileNames: p.TSProgram.UseCaseSensitiveFileNames(),
|
|
41
|
-
CurrentDirectory: p.TSProgram.GetCurrentDirectory(),
|
|
42
|
-
}) == 0
|
|
42
|
+
return buildInfo != "" && tspath.CompareFilePaths(shimcompiler.ProgramCaseSensitivity(p.TSProgram), buildInfo, fileName) == 0
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// outputEscapesOutDir reports whether fileName — an emit output path tsgo
|
|
@@ -48,7 +48,7 @@ func (p *Program) isBuildInfoOutput(fileName string) bool {
|
|
|
48
48
|
// next to their sources by design, so the guard only applies when `outDir`
|
|
49
49
|
// gives the project an output boundary. The compiler-selected build-information
|
|
50
50
|
// artifact is exempt because its location can legitimately be outside outDir.
|
|
51
|
-
func (p *Program) outputEscapesOutDir(fileName
|
|
51
|
+
func (p *Program) outputEscapesOutDir(fileName tspath.RootedFilePath) bool {
|
|
52
52
|
if p == nil || p.TSProgram == nil {
|
|
53
53
|
return false
|
|
54
54
|
}
|
|
@@ -59,14 +59,11 @@ func (p *Program) outputEscapesOutDir(fileName string) bool {
|
|
|
59
59
|
if p.isBuildInfoOutput(fileName) {
|
|
60
60
|
return false
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
CurrentDirectory: p.TSProgram.GetCurrentDirectory(),
|
|
65
|
-
}
|
|
66
|
-
if tspath.ContainsPath(options.OutDir, fileName, cmp) {
|
|
62
|
+
caseSensitivity := shimcompiler.ProgramCaseSensitivity(p.TSProgram)
|
|
63
|
+
if tspath.ContainsPathWith(caseSensitivity, options.OutDir, tspath.RootedPath(fileName)) {
|
|
67
64
|
return false
|
|
68
65
|
}
|
|
69
|
-
if options.DeclarationDir != "" && tspath.
|
|
66
|
+
if options.DeclarationDir != "" && tspath.ContainsPathWith(caseSensitivity, options.DeclarationDir, tspath.RootedPath(fileName)) {
|
|
70
67
|
return false
|
|
71
68
|
}
|
|
72
69
|
return true
|
package/driver/emit_plugin.go
CHANGED
|
@@ -7,6 +7,7 @@ import (
|
|
|
7
7
|
"sync"
|
|
8
8
|
|
|
9
9
|
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
10
|
+
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
10
11
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
11
12
|
shimcore "github.com/microsoft/typescript-go/shim/core"
|
|
12
13
|
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
@@ -15,31 +16,32 @@ import (
|
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
// pluginEmitHost implements printer.EmitHost (and, structurally,
|
|
18
|
-
// SourceFileMayBeEmittedHost
|
|
19
|
-
//
|
|
20
|
-
//
|
|
19
|
+
// SourceFileMayBeEmittedHost, OutputPathsHost and, on TypeScript 7.1,
|
|
20
|
+
// SourceMapHost — their methods are a subset) by delegating to the driver
|
|
21
|
+
// Program, exactly like tsgo's internal emitHost. Its emit resolver comes from
|
|
22
|
+
// the program's single checker, guarded to the program's original member
|
|
23
|
+
// accesses. The methods whose names or types differ between compiler targets
|
|
24
|
+
// live in target_ts70.go and target_ts71.go.
|
|
21
25
|
type pluginEmitHost struct {
|
|
22
|
-
program
|
|
23
|
-
|
|
26
|
+
program *shimcompiler.Program
|
|
27
|
+
checker *shimchecker.Checker
|
|
28
|
+
originalMembers map[*shimast.Node]struct{}
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
func (h *pluginEmitHost) Options() *shimcore.CompilerOptions { return h.program.Options() }
|
|
27
32
|
func (h *pluginEmitHost) SourceFiles() []*shimast.SourceFile { return h.program.SourceFiles() }
|
|
28
|
-
func (h *pluginEmitHost)
|
|
29
|
-
return h.program.
|
|
33
|
+
func (h *pluginEmitHost) CommonSourceDirectory() shimtspath.RootedDirectoryPath {
|
|
34
|
+
return h.program.CommonSourceDirectory()
|
|
35
|
+
}
|
|
36
|
+
func (h *pluginEmitHost) IsEmitBlocked(file shimtspath.RootedFilePath) bool {
|
|
37
|
+
return h.program.IsEmitBlocked(file)
|
|
30
38
|
}
|
|
31
|
-
func (h *pluginEmitHost)
|
|
32
|
-
func (h *pluginEmitHost) CommonSourceDirectory() string { return h.program.CommonSourceDirectory() }
|
|
33
|
-
func (h *pluginEmitHost) IsEmitBlocked(file string) bool { return h.program.IsEmitBlocked(file) }
|
|
34
|
-
func (h *pluginEmitHost) WriteFile(fileName string, text string) error {
|
|
39
|
+
func (h *pluginEmitHost) WriteFile(fileName shimtspath.RootedFilePath, text string) error {
|
|
35
40
|
return h.program.Host().FS().WriteFile(fileName, text)
|
|
36
41
|
}
|
|
37
42
|
func (h *pluginEmitHost) GetEmitModuleFormatOfFile(file shimast.HasFileName) shimcore.ModuleKind {
|
|
38
43
|
return h.program.GetEmitModuleFormatOfFile(file)
|
|
39
44
|
}
|
|
40
|
-
func (h *pluginEmitHost) GetEmitResolver() shimprinter.EmitResolver {
|
|
41
|
-
return h.emitResolver
|
|
42
|
-
}
|
|
43
45
|
|
|
44
46
|
// guardedEmitResolver only resolves member accesses from the program's input
|
|
45
47
|
// trees. ParseNode follows original links but trusts the synthesized flag:
|
|
@@ -67,7 +69,7 @@ func collectOriginalMembers(node *shimast.Node, members map[*shimast.Node]struct
|
|
|
67
69
|
return false
|
|
68
70
|
})
|
|
69
71
|
}
|
|
70
|
-
func (h *pluginEmitHost) GetProjectReferenceFromSource(path shimtspath.
|
|
72
|
+
func (h *pluginEmitHost) GetProjectReferenceFromSource(path shimtspath.PathKey) *shimtsoptions.SourceOutputAndProjectReference {
|
|
71
73
|
return h.program.GetProjectReferenceFromSource(path)
|
|
72
74
|
}
|
|
73
75
|
func (h *pluginEmitHost) IsSourceFileFromExternalLibrary(file *shimast.SourceFile) bool {
|
|
@@ -79,8 +81,12 @@ func (h *pluginEmitHost) IsSourceFileFromExternalLibrary(file *shimast.SourceFil
|
|
|
79
81
|
// used by builtin transforms; they do not make every arbitrary constructed tree
|
|
80
82
|
// valid. Injected bindings must use the supported generated-name policy and
|
|
81
83
|
// preserve the original links needed by the particular transformation.
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
+
// Build returned nodes with ec.Factory, or with a factory created inside the
|
|
85
|
+
// call. A package-global or retained factory shares one node arena across files
|
|
86
|
+
// and Programs, so once distinct Programs emit at the same time its nodes race
|
|
87
|
+
// and can print under another file. Returning nil leaves the file unchanged.
|
|
88
|
+
// This is the AST-integration contract that replaces text-splice: a plugin
|
|
89
|
+
// returns AST, not text. The shape mirrors a
|
|
84
90
|
// classic source-file transformer, with EmitContext supplied on each call;
|
|
85
91
|
// adapting an existing transformer still requires the native AST and context
|
|
86
92
|
// APIs rather than only changing its function signature.
|
|
@@ -88,7 +94,7 @@ func (h *pluginEmitHost) IsSourceFileFromExternalLibrary(file *shimast.SourceFil
|
|
|
88
94
|
// @evidence contracts/common.md#principled-implementation Generated AST identity belongs to the shared emit context, allowing builtin import and module transforms to interpret plugin nodes.
|
|
89
95
|
// @evidence contracts/common.md#clear-and-simple-design A per-source callback returns an optional replacement; the host owns ordering and printing.
|
|
90
96
|
// @evidence contracts/common.md#prohibited-implementation-shortcuts The supported AST factory and original links replace textual alias guesses or patched compiler methods.
|
|
91
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose specifies context identity, nil behavior, and source transformation following the documentation skill.
|
|
97
|
+
// @evidence contracts/common.md#meaningful-documentation Native prose specifies context identity, the per-file factory requirement and its concurrency consequence, nil behavior, and source transformation following the documentation skill.
|
|
92
98
|
// @evidenceExclude contracts/portability.md#os-neutral-implementation The callback signature defines AST work rather than native path or process operations.
|
|
93
99
|
// @evidenceExclude contracts/performance.md#efficient-algorithms Concrete callbacks select their algorithms; the signature performs no traversal.
|
|
94
100
|
// @evidenceExclude contracts/performance.md#reuse-equivalent-work The signature owns no shared-work coordinator.
|
|
@@ -239,7 +245,9 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
239
245
|
}
|
|
240
246
|
return p.pluginEmitDiagnostics("analysis-only emit", result.Diagnostics)
|
|
241
247
|
}
|
|
242
|
-
|
|
248
|
+
// noEmit returned above, so this applies exactly noEmitOnError's
|
|
249
|
+
// whole-program diagnostic gate.
|
|
250
|
+
if result := handleNoEmit(context.Background(), p.TSProgram); result != nil {
|
|
243
251
|
return p.pluginEmitDiagnostics("pre-emit checking", result.Diagnostics)
|
|
244
252
|
}
|
|
245
253
|
hasTransform := false
|
|
@@ -251,15 +259,15 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
251
259
|
}
|
|
252
260
|
if !hasTransform {
|
|
253
261
|
correctSourceMap := p.NewSourceMapCorrector()
|
|
254
|
-
result, diagnostics, err := p.EmitAllRaw(func(fileName, text string, data *shimcompiler.WriteFileData) error {
|
|
255
|
-
corrected, err := correctSourceMap(fileName, text)
|
|
262
|
+
result, diagnostics, err := p.EmitAllRaw(func(fileName shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
263
|
+
corrected, err := correctSourceMap(string(fileName), text)
|
|
256
264
|
if err != nil {
|
|
257
265
|
return err
|
|
258
266
|
}
|
|
259
267
|
if writeFile != nil {
|
|
260
268
|
return writeFile(fileName, corrected, data)
|
|
261
269
|
}
|
|
262
|
-
return DefaultWriteFile(fileName, corrected)
|
|
270
|
+
return DefaultWriteFile(string(fileName), corrected)
|
|
263
271
|
})
|
|
264
272
|
if err != nil || result == nil {
|
|
265
273
|
return diagnostics, err
|
|
@@ -276,15 +284,15 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
276
284
|
for _, sf := range p.TSProgram.SourceFiles() {
|
|
277
285
|
collectOriginalMembers(sf.AsNode(), members)
|
|
278
286
|
}
|
|
279
|
-
host := &pluginEmitHost{program: p.TSProgram,
|
|
287
|
+
host := &pluginEmitHost{program: p.TSProgram, checker: p.Checker, originalMembers: members}
|
|
280
288
|
|
|
281
289
|
// noEmitOnError applies to the whole build. The JS lane runs before the
|
|
282
290
|
// declaration lane, so defer callbacks until both have succeeded. Outside
|
|
283
291
|
// that option keep upstream's emit-despite-errors behavior.
|
|
284
292
|
output := newPluginEmitOutput(writeFile, options.NoEmitOnError.IsTrue())
|
|
285
293
|
correctSourceMap := p.NewSourceMapCorrector()
|
|
286
|
-
for _, sf := range shimcompiler.
|
|
287
|
-
paths := shimcompiler.
|
|
294
|
+
for _, sf := range shimcompiler.SourceFilesToEmit(host) {
|
|
295
|
+
paths := shimcompiler.OutputPathsFor(sf, options, host)
|
|
288
296
|
if paths.JsFilePath() != "" && !p.outputEscapesOutDir(paths.JsFilePath()) {
|
|
289
297
|
ec := shimprinter.NewEmitContext()
|
|
290
298
|
out := sf
|
|
@@ -330,9 +338,7 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
330
338
|
// Marks accumulate on the checker and are never cleared, so marking one
|
|
331
339
|
// fixed tree per file also stops a second emit on the same Program from
|
|
332
340
|
// inheriting the first pass's plugin-tree marks.
|
|
333
|
-
|
|
334
|
-
out = tr.TransformSourceFile(out)
|
|
335
|
-
}
|
|
341
|
+
out = applyScriptTransformers(ec, host, sf, out)
|
|
336
342
|
// Print through the source-map-aware helper for an external sourceMap or
|
|
337
343
|
// an inlineSourceMap trailer, and an emitBOM leading mark: the hand-assembled
|
|
338
344
|
// emit pipeline does not run tsgo's emitter, so everything printSourceFile
|
|
@@ -346,26 +352,24 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
346
352
|
// the external `.js.map` and an inline base64 map embedded in the JS.
|
|
347
353
|
if p.SourcePreamble != "" {
|
|
348
354
|
var err error
|
|
349
|
-
if printed.JS, err = correctSourceMap(paths.JsFilePath(), printed.JS); err != nil {
|
|
355
|
+
if printed.JS, err = correctSourceMap(string(paths.JsFilePath()), printed.JS); err != nil {
|
|
350
356
|
return nil, err
|
|
351
357
|
}
|
|
352
358
|
if printed.MapPath != "" {
|
|
353
|
-
if printed.MapText, err = correctSourceMap(printed.MapPath, printed.MapText); err != nil {
|
|
359
|
+
if printed.MapText, err = correctSourceMap(string(printed.MapPath), printed.MapText); err != nil {
|
|
354
360
|
return nil, err
|
|
355
361
|
}
|
|
356
362
|
}
|
|
357
363
|
}
|
|
358
364
|
// The emitter hands its writeFile callback a WriteFileData for the
|
|
359
|
-
// JavaScript and
|
|
360
|
-
// `writeText
|
|
361
|
-
// same. See writePluginEmitOutput for what the struct
|
|
362
|
-
// why the remaining fields stay zero.
|
|
363
|
-
if err := p.writePluginEmitOutput(paths.JsFilePath(), printed.JS,
|
|
364
|
-
SourceMapUrlPos: printed.SourceMapUrlPos,
|
|
365
|
-
}, output.write); err != nil {
|
|
365
|
+
// JavaScript and, for the map, nil on TypeScript 7.0 or one carrying only
|
|
366
|
+
// the emitted source file on 7.1 (printSourceFile's `writeText` call), so
|
|
367
|
+
// this lane does the same. See writePluginEmitOutput for what the struct
|
|
368
|
+
// carries here and why the remaining fields stay zero.
|
|
369
|
+
if err := p.writePluginEmitOutput(paths.JsFilePath(), printed.JS, scriptWriteFileData(sf, printed.SourceMapUrlPos), output.write); err != nil {
|
|
366
370
|
return nil, fmt.Errorf("driver: native plugin JavaScript emit failed: %w", err)
|
|
367
371
|
}
|
|
368
|
-
if err := p.writePluginEmitOutput(printed.MapPath, printed.MapText,
|
|
372
|
+
if err := p.writePluginEmitOutput(printed.MapPath, printed.MapText, sourceMapWriteFileData(sf), output.write); err != nil {
|
|
369
373
|
return nil, fmt.Errorf("driver: native plugin source map emit failed: %w", err)
|
|
370
374
|
}
|
|
371
375
|
}
|
|
@@ -374,7 +378,7 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
374
378
|
// so it also runs for a JavaScript-only `incremental` / `composite` project
|
|
375
379
|
// that has no declarations to write at all.
|
|
376
380
|
if !options.GetEmitDeclarations() && !p.emitsBuildInfo() {
|
|
377
|
-
if result :=
|
|
381
|
+
if result := handleNoEmit(context.Background(), p.TSProgram); result != nil {
|
|
378
382
|
return p.pluginEmitDiagnostics("JavaScript emit", result.Diagnostics)
|
|
379
383
|
}
|
|
380
384
|
return nil, output.flush()
|
|
@@ -398,7 +402,7 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
398
402
|
var wfMu sync.Mutex
|
|
399
403
|
result := p.emitProgram(shimcompiler.EmitOptions{
|
|
400
404
|
EmitOnly: shimcompiler.EmitOnlyDts,
|
|
401
|
-
WriteFile: func(fileName
|
|
405
|
+
WriteFile: func(fileName shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData) error {
|
|
402
406
|
wfMu.Lock()
|
|
403
407
|
defer wfMu.Unlock()
|
|
404
408
|
if p.outputEscapesOutDir(fileName) {
|
|
@@ -407,7 +411,7 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
407
411
|
}
|
|
408
412
|
return nil
|
|
409
413
|
}
|
|
410
|
-
corrected, err := correctSourceMap(fileName, text)
|
|
414
|
+
corrected, err := correctSourceMap(string(fileName), text)
|
|
411
415
|
if err != nil {
|
|
412
416
|
return err
|
|
413
417
|
}
|
|
@@ -435,6 +439,10 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
435
439
|
// when none was written. PrintFileWithSourceMap records it exactly where
|
|
436
440
|
// printSourceFile does, so a consumer that relocates or rewrites the trailer
|
|
437
441
|
// works the same on both lanes.
|
|
442
|
+
// - SourceFile, on TypeScript 7.1: the program source file the artifact was
|
|
443
|
+
// emitted from, the file as parsed rather than the transformed tree,
|
|
444
|
+
// exactly as the emitter's own field names its input file. The map carries
|
|
445
|
+
// only this; on 7.0, where the field does not exist, the map gets nil.
|
|
438
446
|
// - Diagnostics: always empty. The emitter's field carries its accumulated
|
|
439
447
|
// emitterDiagnostics, which on the JavaScript lane are its own write
|
|
440
448
|
// failures; here a write failure is returned as an `error` from
|
|
@@ -450,12 +458,12 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
450
458
|
// Nothing on this lane reads the struct back afterwards: unlike tsgo's emitter,
|
|
451
459
|
// EmitWithPluginTransformers builds no EmitResult, so there is no EmittedFiles
|
|
452
460
|
// list for a callee-set SkippedDtsWrite to keep a file out of.
|
|
453
|
-
func (p *Program) writePluginEmitOutput(fileName, text string, data *shimcompiler.WriteFileData, writeFile shimcompiler.WriteFile) error {
|
|
461
|
+
func (p *Program) writePluginEmitOutput(fileName shimtspath.RootedFilePath, text string, data *shimcompiler.WriteFileData, writeFile shimcompiler.WriteFile) error {
|
|
454
462
|
if fileName == "" || p.outputEscapesOutDir(fileName) {
|
|
455
463
|
return nil
|
|
456
464
|
}
|
|
457
465
|
if writeFile != nil {
|
|
458
466
|
return writeFile(fileName, text, data)
|
|
459
467
|
}
|
|
460
|
-
return DefaultWriteFile(fileName, text)
|
|
468
|
+
return DefaultWriteFile(string(fileName), text)
|
|
461
469
|
}
|