ttsc 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/cmd/ttsc/api_compile.go +3 -2
- package/cmd/ttsc/api_transform.go +1 -1
- package/cmd/ttsc/build.go +5 -4
- package/cmd/ttsc-cache/account.go +16 -0
- package/cmd/ttsc-cache/account_test.go +91 -0
- package/cmd/ttsc-cache/main.go +1 -1
- package/cmd/ttsc-cache/protocol_test.go +2 -2
- package/cmd/ttsc-cache/publisher_seal_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_failure_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_test.go +2 -2
- package/cmd/ttsc-cache/store.go +5 -0
- package/cmd/ttsc-cache/tuple.go +6 -2
- package/cmd/ttsc-cache/tuple_test.go +1 -1
- package/cmd/ttscgraph/main.go +6 -1
- package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +6 -1
- package/cmd/ttscgraph/serve.go +22 -20
- package/cmd/ttscgraph/serve_alternative_members_and_reads_refresh_test.go +95 -0
- package/cmd/ttscgraph/serve_shards.go +26 -15
- package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +1 -1
- package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +5 -5
- package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +8 -8
- package/cmd/ttscgraph/serve_source_encoding_test.go +2 -2
- package/driver/build_information_uses_selected_output_identity_test.go +5 -4
- package/driver/check_observations.go +1 -1
- package/driver/config_discovery.go +5 -1
- package/driver/declaration_shape.go +15 -21
- package/driver/diagnostics_preamble.go +2 -2
- package/driver/emit_containment.go +11 -14
- package/driver/emit_plugin.go +51 -43
- package/driver/emit_plugin_output.go +6 -5
- package/driver/emit_provenance.go +12 -15
- package/driver/graph.go +8 -8
- package/driver/host.go +15 -5
- package/driver/input_observation.go +22 -21
- package/driver/input_observation_test.go +11 -10
- package/driver/overlay.go +11 -11
- package/driver/program.go +102 -51
- package/driver/resolution_candidates.go +50 -32
- package/driver/resolution_candidates_test.go +18 -5
- package/driver/rewrite.go +11 -13
- package/driver/session.go +13 -7
- package/driver/target_ts70.go +85 -0
- package/driver/target_ts71.go +97 -0
- package/driver/transform_dependencies.go +1 -1
- package/driver/transform_source_map.go +21 -20
- package/go.mod +3 -3
- package/go.sum +4 -4
- package/internal/graph/alternative_member_declarations_resolve_uses_test.go +145 -0
- package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/build.go +75 -33
- package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +4 -4
- package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +1 -1
- package/internal/graph/declaration_members.go +143 -0
- package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +3 -3
- package/internal/graph/doc_tags.go +2 -2
- package/internal/graph/dump_paths.go +6 -5
- package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +1 -1
- package/internal/graph/edges.go +151 -68
- package/internal/graph/edges_cover_class_level_references_test.go +5 -5
- package/internal/graph/enum_initializer_calls_are_edges_test.go +2 -2
- package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +6 -6
- package/internal/graph/exports.go +6 -6
- package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +2 -2
- package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +1 -1
- package/internal/graph/function_locals_do_not_collide_test.go +3 -3
- package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +5 -5
- package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +2 -2
- package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +3 -3
- package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +3 -3
- package/internal/graph/literals.go +3 -3
- package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +2 -2
- package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +4 -4
- package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +2 -2
- package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +1 -1
- package/internal/graph/literals_resolve_through_alias_indirection_test.go +3 -3
- package/internal/graph/member_relation_edges_follow_checker_validity_test.go +7 -7
- package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +19 -19
- package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +11 -11
- package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +2 -2
- package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +7 -7
- package/internal/graph/namespace_private_declarations_keep_lexical_identity_test.go +85 -0
- package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +2 -2
- package/internal/graph/object_literal_declarations_resolve_calls_test.go +9 -9
- package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +1 -1
- package/internal/graph/overload_implementation_replaces_signature_test.go +2 -2
- package/internal/graph/property_member_edges_remain_owner_visible_test.go +6 -6
- package/internal/graph/resolve.go +37 -12
- package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +6 -6
- package/internal/graph/source.go +1 -1
- package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +7 -7
- package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +2 -2
- package/internal/graph/value_access_edges_cover_properties_test.go +5 -5
- package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +3 -3
- package/internal/graph/value_call_edges_cover_jsx_components_test.go +2 -2
- package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +3 -3
- package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +2 -2
- package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +4 -4
- package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +3 -3
- package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +2 -2
- package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +4 -4
- package/internal/graph/value_reads_cover_expression_positions_test.go +88 -0
- package/lib/compiler/internal/buildNativeCompiler.d.ts +5 -2
- package/lib/compiler/internal/buildNativeCompiler.js +12 -4
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -1
- package/lib/flags/COMPILER_OPTIONS.js +1079 -149
- package/lib/flags/COMPILER_OPTIONS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -1
- package/lib/flags/CompilerOptionSpec.d.ts +9 -2
- package/lib/internal/pluginSource.d.ts +1 -0
- package/lib/internal/pluginSource.js +1 -0
- package/lib/internal/pluginSource.js.map +1 -1
- package/lib/launcher/internal/TypeScriptSyncApi.d.ts +140 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js +99 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootInMemory.d.ts +80 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js +253 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootProject.d.ts +22 -18
- package/lib/launcher/internal/buildSingleRootProject.js +27 -18
- package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
- package/lib/launcher/internal/compilerArgsAsConfigOptions.d.ts +39 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js +115 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js.map +1 -0
- package/lib/plugin/CapabilityPluginResolver.js +3 -0
- package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +6 -2
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/source/CompilerTarget.d.ts +127 -0
- package/lib/plugin/internal/source/CompilerTarget.js +231 -0
- package/lib/plugin/internal/source/CompilerTarget.js.map +1 -0
- package/lib/plugin/internal/source/NativeSourcePackages.js +6 -5
- package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +18 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.js +24 -2
- package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +6 -3
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +31 -13
- package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js +3 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +9 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
- package/package.json +14 -9
- package/shim/ast/enums_gen.go +1 -0
- package/shim/ast/go.mod +2 -2
- package/shim/ast/go.sum +4 -4
- package/shim/ast/neutral.go +141 -0
- package/shim/astnav/go.mod +2 -2
- package/shim/astnav/go.sum +4 -4
- package/shim/bundled/go.mod +2 -2
- package/shim/bundled/go.sum +4 -4
- package/shim/checker/go.mod +2 -2
- package/shim/checker/go.sum +4 -4
- package/shim/compiler/go.mod +2 -2
- package/shim/compiler/go.sum +4 -4
- package/shim/compiler/neutral.go +213 -0
- package/shim/core/go.mod +2 -2
- package/shim/core/go.sum +4 -4
- package/shim/diagnosticwriter/go.mod +2 -2
- package/shim/diagnosticwriter/go.sum +4 -4
- package/shim/lsp/go.mod +2 -2
- package/shim/lsp/go.sum +4 -4
- package/shim/parser/go.mod +2 -2
- package/shim/parser/go.sum +4 -4
- package/shim/printer/go.mod +2 -2
- package/shim/printer/go.sum +4 -4
- package/shim/scanner/go.mod +2 -2
- package/shim/scanner/go.sum +4 -4
- package/shim/stringutil/go.mod +1 -1
- package/shim/stringutil/go.sum +2 -2
- package/shim/stringutil/shim.go +15 -0
- package/shim/transformers/go.mod +2 -2
- package/shim/transformers/go.sum +4 -4
- package/shim/tsoptions/go.mod +2 -2
- package/shim/tsoptions/go.sum +4 -4
- package/shim/tsoptions/neutral.go +56 -0
- package/shim/tspath/go.mod +1 -1
- package/shim/tspath/go.sum +2 -2
- package/shim/tspath/neutral.go +150 -0
- package/shim/tspath/typed_paths.go +266 -0
- package/shim/vfs/cachedvfs/go.mod +2 -2
- package/shim/vfs/cachedvfs/go.sum +4 -4
- package/shim/vfs/go.mod +2 -2
- package/shim/vfs/go.sum +4 -4
- package/shim/vfs/neutral.go +20 -0
- package/shim/vfs/osvfs/go.mod +2 -2
- package/shim/vfs/osvfs/go.sum +4 -4
- package/src/compiler/internal/buildNativeCompiler.ts +13 -4
- package/src/flags/COMPILER_ENUM_WHITESPACE.ts +1 -1
- package/src/flags/COMPILER_OPTIONS.ts +1080 -150
- package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +1 -1
- package/src/flags/COMPILER_OPTION_KINDS.ts +1 -1
- package/src/flags/CompilerOptionSpec.ts +11 -2
- package/src/internal/pluginSource.ts +1 -0
- package/src/launcher/internal/TypeScriptSyncApi.ts +186 -0
- package/src/launcher/internal/buildSingleRootInMemory.ts +319 -0
- package/src/launcher/internal/buildSingleRootProject.ts +26 -18
- package/src/launcher/internal/compilerArgsAsConfigOptions.ts +112 -0
- package/src/plugin/CapabilityPluginResolver.ts +4 -1
- package/src/plugin/internal/load/loadProjectPlugins.ts +12 -2
- package/src/plugin/internal/source/CompilerTarget.ts +249 -0
- package/src/plugin/internal/source/NativeSourcePackages.ts +10 -4
- package/src/plugin/internal/source/SourcePluginAdmission.ts +28 -2
- package/src/plugin/internal/source/SourcePluginWorkspace.ts +45 -19
- package/src/plugin/internal/source/buildSourcePlugin.ts +3 -1
- package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +9 -1
- package/targets/7.1/bridge/ast/enums_gen.go +174 -0
- package/targets/7.1/bridge/ast/extra-shim.json +4 -0
- package/targets/7.1/bridge/ast/go.mod +14 -0
- package/targets/7.1/bridge/ast/go.sum +20 -0
- package/targets/7.1/bridge/ast/lint.go +1412 -0
- package/targets/7.1/bridge/ast/neutral.go +141 -0
- package/targets/7.1/bridge/ast/parent.go +60 -0
- package/targets/7.1/bridge/ast/safe_text.go +108 -0
- package/targets/7.1/bridge/ast/shim.go +1656 -0
- package/targets/7.1/bridge/ast/surface.go +686 -0
- package/targets/7.1/bridge/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_multi_hop_qualified_name_test.go +47 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_one_hop_qualified_name_test.go +35 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_empty_for_nil_test.go +31 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_identifier_text_test.go +34 -0
- package/targets/7.1/bridge/ast/test/node_text_skips_empty_qualified_left_test.go +60 -0
- package/targets/7.1/bridge/astnav/go.mod +14 -0
- package/targets/7.1/bridge/astnav/go.sum +22 -0
- package/targets/7.1/bridge/astnav/shim.go +24 -0
- package/targets/7.1/bridge/bundled/extra-shim.json +1 -0
- package/targets/7.1/bridge/bundled/go.mod +10 -0
- package/targets/7.1/bridge/bundled/go.sum +10 -0
- package/targets/7.1/bridge/bundled/shim.go +24 -0
- package/targets/7.1/bridge/checker/enums_gen.go +150 -0
- package/targets/7.1/bridge/checker/extra-shim.json +37 -0
- package/targets/7.1/bridge/checker/go.mod +15 -0
- package/targets/7.1/bridge/checker/go.sum +24 -0
- package/targets/7.1/bridge/checker/node_builder_fields_gen.go +19 -0
- package/targets/7.1/bridge/checker/shim.go +1390 -0
- package/targets/7.1/bridge/compiler/contentmapper_process.go +70 -0
- package/targets/7.1/bridge/compiler/emit_sourcemap.go +296 -0
- package/targets/7.1/bridge/compiler/emitassemble.go +81 -0
- package/targets/7.1/bridge/compiler/emithook.go +44 -0
- package/targets/7.1/bridge/compiler/extra-shim.json +4 -0
- package/targets/7.1/bridge/compiler/go.mod +15 -0
- package/targets/7.1/bridge/compiler/go.sum +24 -0
- package/targets/7.1/bridge/compiler/incremental.go +185 -0
- package/targets/7.1/bridge/compiler/neutral.go +256 -0
- package/targets/7.1/bridge/compiler/resolution.go +571 -0
- package/targets/7.1/bridge/compiler/shim.go +70 -0
- package/targets/7.1/bridge/core/enums_gen.go +15 -0
- package/targets/7.1/bridge/core/extra-shim.json +4 -0
- package/targets/7.1/bridge/core/go.mod +7 -0
- package/targets/7.1/bridge/core/go.sum +8 -0
- package/targets/7.1/bridge/core/modulekind.go +19 -0
- package/targets/7.1/bridge/core/shim.go +272 -0
- package/targets/7.1/bridge/diagnosticwriter/go.mod +14 -0
- package/targets/7.1/bridge/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/bridge/diagnosticwriter/lint.go +411 -0
- package/targets/7.1/bridge/diagnosticwriter/shim.go +56 -0
- package/targets/7.1/bridge/lsp/extra-shim.json +4 -0
- package/targets/7.1/bridge/lsp/go.mod +16 -0
- package/targets/7.1/bridge/lsp/go.sum +26 -0
- package/targets/7.1/bridge/lsp/shim.go +112 -0
- package/targets/7.1/bridge/parser/extra-shim.json +4 -0
- package/targets/7.1/bridge/parser/go.mod +14 -0
- package/targets/7.1/bridge/parser/go.sum +24 -0
- package/targets/7.1/bridge/parser/shim.go +61 -0
- package/targets/7.1/bridge/printer/emithost.go +69 -0
- package/targets/7.1/bridge/printer/go.mod +15 -0
- package/targets/7.1/bridge/printer/go.sum +24 -0
- package/targets/7.1/bridge/printer/shim.go +168 -0
- package/targets/7.1/bridge/printer/sourcemap.go +49 -0
- package/targets/7.1/bridge/scanner/extra-shim.json +4 -0
- package/targets/7.1/bridge/scanner/go.mod +14 -0
- package/targets/7.1/bridge/scanner/go.sum +20 -0
- package/targets/7.1/bridge/scanner/regexp.go +42 -0
- package/targets/7.1/bridge/scanner/shim.go +137 -0
- package/targets/7.1/bridge/stringutil/extra-shim.json +1 -0
- package/targets/7.1/bridge/stringutil/go.mod +5 -0
- package/targets/7.1/bridge/stringutil/go.sum +2 -0
- package/targets/7.1/bridge/stringutil/shim.go +131 -0
- package/targets/7.1/bridge/transformers/go.mod +15 -0
- package/targets/7.1/bridge/transformers/go.sum +24 -0
- package/targets/7.1/bridge/transformers/shim.go +24 -0
- package/targets/7.1/bridge/tsoptions/command_line_raw.go +44 -0
- package/targets/7.1/bridge/tsoptions/extra-shim.json +4 -0
- package/targets/7.1/bridge/tsoptions/go.mod +15 -0
- package/targets/7.1/bridge/tsoptions/go.sum +24 -0
- package/targets/7.1/bridge/tsoptions/neutral.go +47 -0
- package/targets/7.1/bridge/tsoptions/shim.go +193 -0
- package/targets/7.1/bridge/tspath/extra-shim.json +4 -0
- package/targets/7.1/bridge/tspath/go.mod +5 -0
- package/targets/7.1/bridge/tspath/go.sum +6 -0
- package/targets/7.1/bridge/tspath/neutral.go +142 -0
- package/targets/7.1/bridge/tspath/shim.go +382 -0
- package/targets/7.1/bridge/vfs/cachedvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.mod +5 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/cachedvfs/shim.go +12 -0
- package/targets/7.1/bridge/vfs/decode.go +26 -0
- package/targets/7.1/bridge/vfs/decode_test.go +42 -0
- package/targets/7.1/bridge/vfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/neutral.go +23 -0
- package/targets/7.1/bridge/vfs/osvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/osvfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/osvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/osvfs/shim.go +14 -0
- package/targets/7.1/bridge/vfs/shim.go +27 -0
- package/targets/7.1/facade/ast/facade_gen.go +2691 -0
- package/targets/7.1/facade/ast/go.mod +20 -0
- package/targets/7.1/facade/ast/go.sum +20 -0
- package/targets/7.1/facade/astnav/facade_gen.go +15 -0
- package/targets/7.1/facade/astnav/go.mod +22 -0
- package/targets/7.1/facade/astnav/go.sum +22 -0
- package/targets/7.1/facade/bundled/facade_gen.go +32 -0
- package/targets/7.1/facade/bundled/go.mod +21 -0
- package/targets/7.1/facade/bundled/go.sum +10 -0
- package/targets/7.1/facade/checker/facade_gen.go +563 -0
- package/targets/7.1/facade/checker/go.mod +26 -0
- package/targets/7.1/facade/checker/go.sum +24 -0
- package/targets/7.1/facade/compiler/facade_gen.go +198 -0
- package/targets/7.1/facade/compiler/go.mod +41 -0
- package/targets/7.1/facade/compiler/go.sum +24 -0
- package/targets/7.1/facade/core/facade_gen.go +130 -0
- package/targets/7.1/facade/core/go.mod +12 -0
- package/targets/7.1/facade/core/go.sum +8 -0
- package/targets/7.1/facade/diagnosticwriter/facade_gen.go +36 -0
- package/targets/7.1/facade/diagnosticwriter/go.mod +22 -0
- package/targets/7.1/facade/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/facade/lsp/facade_gen.go +31 -0
- package/targets/7.1/facade/lsp/go.mod +19 -0
- package/targets/7.1/facade/lsp/go.sum +26 -0
- package/targets/7.1/facade/parser/facade_gen.go +102 -0
- package/targets/7.1/facade/parser/go.mod +25 -0
- package/targets/7.1/facade/parser/go.sum +24 -0
- package/targets/7.1/facade/printer/facade_gen.go +74 -0
- package/targets/7.1/facade/printer/go.mod +26 -0
- package/targets/7.1/facade/printer/go.sum +24 -0
- package/targets/7.1/facade/scanner/facade_gen.go +191 -0
- package/targets/7.1/facade/scanner/go.mod +25 -0
- package/targets/7.1/facade/scanner/go.sum +20 -0
- package/targets/7.1/facade/stringutil/facade_gen.go +176 -0
- package/targets/7.1/facade/stringutil/go.mod +9 -0
- package/targets/7.1/facade/stringutil/go.sum +2 -0
- package/targets/7.1/facade/transformers/facade_gen.go +12 -0
- package/targets/7.1/facade/transformers/go.mod +18 -0
- package/targets/7.1/facade/transformers/go.sum +24 -0
- package/targets/7.1/facade/tsoptions/facade_gen.go +274 -0
- package/targets/7.1/facade/tsoptions/go.mod +32 -0
- package/targets/7.1/facade/tsoptions/go.sum +24 -0
- package/targets/7.1/facade/tspath/facade_gen.go +550 -0
- package/targets/7.1/facade/tspath/go.mod +9 -0
- package/targets/7.1/facade/tspath/go.sum +6 -0
- package/targets/7.1/facade/vfs/cachedvfs/facade_gen.go +17 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/facade_gen.go +47 -0
- package/targets/7.1/facade/vfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/osvfs/facade_gen.go +20 -0
- package/targets/7.1/facade/vfs/osvfs/go.mod +21 -0
- package/targets/7.1/facade/vfs/osvfs/go.sum +10 -0
- package/tools/gen_facade/committed_facades_match_their_bridges_test.go +57 -0
- package/tools/gen_facade/facade_manifest_points_into_the_bridge_root_test.go +75 -0
- package/tools/gen_facade/facade_spells_internal_types_through_bridge_aliases_test.go +75 -0
- package/tools/gen_facade/facade_types_are_their_bridge_types_test.go +99 -0
- package/tools/gen_facade/go.mod +10 -0
- package/tools/gen_facade/go.sum +8 -0
- package/tools/gen_facade/main.go +734 -0
- package/tools/gen_shims/go.mod +4 -4
- package/tools/gen_shims/go.sum +6 -6
- package/tools/gen_shims/main.go +124 -66
- package/tools/gen_shims/mirror_structs_terminate_on_unexported_cycles_test.go +101 -0
- package/tools/shim_audit/baseline-7.1.json +720 -0
- package/tools/shim_audit/baseline.json +5 -4
- package/tools/shim_audit/go.mod +4 -4
- package/tools/shim_audit/go.sum +6 -6
- package/tools/shim_audit/linkname_signatures.go +178 -0
- package/tools/shim_audit/linkname_signatures_match_their_targets_test.go +64 -0
- package/tools/shim_audit/linkname_targets_follow_the_audited_compiler_test.go +38 -0
- package/tools/shim_audit/main.go +29 -4
- package/tools/shim_audit/neutral_api.go +160 -0
- package/tools/shim_audit/neutral_api_must_match_across_targets_test.go +74 -0
- package/utility/host.go +5 -4
- package/utility/preamble_output.go +15 -15
- package/utility/serve.go +1 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildSingleRootInMemory = buildSingleRootInMemory;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const BuildExecution_1 = require("../../compiler/internal/build/BuildExecution");
|
|
10
|
+
const PassthroughFlags_1 = require("../../compiler/internal/build/PassthroughFlags");
|
|
11
|
+
const TsgoArguments_1 = require("../../compiler/internal/build/TsgoArguments");
|
|
12
|
+
const readProjectConfig_1 = require("../../compiler/internal/project/readProjectConfig");
|
|
13
|
+
const readEffectiveCompilerOptions_1 = require("../../compiler/internal/readEffectiveCompilerOptions");
|
|
14
|
+
const resolveTsgo_1 = require("../../compiler/internal/resolveTsgo");
|
|
15
|
+
const SidecarEnvironment_1 = require("../../compiler/internal/sharedHost/SidecarEnvironment");
|
|
16
|
+
const readCompilerOptionValues_1 = require("../../flags/readCompilerOptionValues");
|
|
17
|
+
const hasProjectPluginEntries_1 = require("../../plugin/internal/load/hasProjectPluginEntries");
|
|
18
|
+
const TypeScriptSyncApi_1 = require("./TypeScriptSyncApi");
|
|
19
|
+
const compilerArgsAsConfigOptions_1 = require("./compilerArgsAsConfigOptions");
|
|
20
|
+
const DependencyBuildGeneration_1 = require("./runtime/DependencyBuildGeneration");
|
|
21
|
+
const runtimeCompilerArgs_1 = require("./runtimeCompilerArgs");
|
|
22
|
+
const runtimeEmitProfile_1 = require("./runtimeEmitProfile");
|
|
23
|
+
const singleRootProjectConfig_1 = require("./singleRootProjectConfig");
|
|
24
|
+
/**
|
|
25
|
+
* Compile one root outside its project's file set through the consuming
|
|
26
|
+
* TypeScript's own API, with the single-root tsconfig held in memory, or report
|
|
27
|
+
* that this build cannot take that route.
|
|
28
|
+
*
|
|
29
|
+
* `buildSingleRootProject` compiles such a root through a tsconfig that extends
|
|
30
|
+
* the project and lists only the root. On the command line that tsconfig has to
|
|
31
|
+
* exist on disk, beside the project's own when a checked build needs its
|
|
32
|
+
* directory-relative lookups. TypeScript 7.1's `typescript/sync` API opens a
|
|
33
|
+
* project from a snapshot whose filesystem layer holds the tsconfig instead,
|
|
34
|
+
* and its emit returns the files rather than writing them. So here the tsconfig
|
|
35
|
+
* always sits, in memory, beside the project's own: `${configDir}`, the default
|
|
36
|
+
* `typeRoots` and every `types` entry resolve exactly as the user's config sees
|
|
37
|
+
* them, and nothing is created in the user's tree.
|
|
38
|
+
*
|
|
39
|
+
* The compiler options are the command-line build's. The arguments that build
|
|
40
|
+
* would pass after `-p` (`TsgoArguments.createTsgoBuildArgs` over the same run
|
|
41
|
+
* options) are written into the in-memory tsconfig's `compilerOptions` by
|
|
42
|
+
* `compilerArgsAsConfigOptions`, which keeps their precedence over the project.
|
|
43
|
+
* The session compiler's own command-line parser must accept them first, so an
|
|
44
|
+
* invalid argument still gets the command line's diagnostic. Outputs are
|
|
45
|
+
* written into `emitDir` only; one the options would place elsewhere is not
|
|
46
|
+
* written at all, as the command-line build's isolation keeps it inside. Each
|
|
47
|
+
* JavaScript output's source is the one the compiler emitted it from.
|
|
48
|
+
*
|
|
49
|
+
* The route is unavailable, and the caller keeps the command-line build, when
|
|
50
|
+
* the project's TypeScript publishes no such API (7.0), when a compiler binary
|
|
51
|
+
* other than that TypeScript's own or a compiler environment is selected (the
|
|
52
|
+
* binary ttsx hands its runtime is the one it resolved, so a root the running
|
|
53
|
+
* program reaches is admitted like an entry), when the build would run native
|
|
54
|
+
* plugins (they run inside ttsc's own host, which reads its tsconfig from
|
|
55
|
+
* disk), or when its arguments cannot be carried by a tsconfig: a response
|
|
56
|
+
* file, a terminal flag, or another command-line-only argument.
|
|
57
|
+
*
|
|
58
|
+
* The returned `project` is the owning project's parse. The in-memory tsconfig
|
|
59
|
+
* changes only the file set, the output layout and declaration emission, so its
|
|
60
|
+
* module options are the project's.
|
|
61
|
+
*
|
|
62
|
+
* @returns The build, or `undefined` when this route is unavailable.
|
|
63
|
+
* @throws When the build fails, with the messages of the command-line build: a
|
|
64
|
+
* checked build fails on any diagnostic, an emit-only build only when it
|
|
65
|
+
* produced no JavaScript.
|
|
66
|
+
* @evidence contracts/common.md#principled-implementation The command-line build's own argument composition supplies the options, translated into the extending config's compilerOptions where they keep command-line precedence, and validated by the consumer compiler's parseCommandLine. Diagnostics are gathered in the native report order (GetDiagnosticsOfAnyProgram: config and syntactic, then options and global, then semantic and the global diagnostics checking found, each later group only when no diagnostic beyond the config ones precedes), and the emit is the consumer compiler's own. Premise: a layer-filesystem config is parsed like one on disk at the same path, verified against typescript@7.1.0-beta and the 7.1 nightly the E2E lane installs.
|
|
67
|
+
* @evidence contracts/common.md#clear-and-simple-design Admission, option translation, the API session and output writing are each one step of this function, with translation and the API surface in their own modules; the caller keeps the command-line route for every refusal.
|
|
68
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Every unsupported build class returns undefined to the existing command-line route instead of an approximation; no consumer or fixture is special-cased and the compiler is used through its published API.
|
|
69
|
+
* @evidence contracts/common.md#meaningful-documentation The prose explains the in-memory placement, option equivalence, output isolation, provenance, every refusal class and the meaning of the returned project.
|
|
70
|
+
* @evidence contracts/portability.md#os-neutral-implementation Output names from the API are resolved with node:path before writing, and sources are recorded by their native real path, the spelling the command-line provenance records.
|
|
71
|
+
* @evidence contracts/performance.md#efficient-algorithms The compiler package is resolved and its API loaded first, so a 7.0 project costs one package resolution and a failed export lookup before the command-line build. An admitted build then makes one project parse, one execution resolution without plugin loading, one API session with one snapshot, one diagnostic pass when checked and one emit; an emit-only build gathers diagnostics only to explain a failure.
|
|
72
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The project parse serves plugin admission, the runtime options and the execution context; the session's parse of the arguments precedes the single snapshot.
|
|
73
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The API session is closed in finally on success and failure: close destroys its pipes and signals the child to terminate without waiting for its exit, and the API kills a child still alive when the process exits. Emitted text is held until written; the caller owns emitDir.
|
|
74
|
+
*/
|
|
75
|
+
function buildSingleRootInMemory(props) {
|
|
76
|
+
const options = props.options;
|
|
77
|
+
if ((0, readCompilerOptionValues_1.readCompilerOptionValues)(options.passthrough).responseFiles.length !== 0 ||
|
|
78
|
+
(options.env !== undefined && Object.keys(options.env).length !== 0))
|
|
79
|
+
return undefined;
|
|
80
|
+
// Checked first: a 7.0 project, the common case, then costs one package
|
|
81
|
+
// resolution before the command-line build. The package is resolved past any
|
|
82
|
+
// selected binary, so the selection can be compared with it.
|
|
83
|
+
const packageEnv = SidecarEnvironment_1.SidecarEnvironment.merge(process.env);
|
|
84
|
+
SidecarEnvironment_1.SidecarEnvironment.write(packageEnv, "TTSC_TSGO_BINARY", undefined);
|
|
85
|
+
let compiler;
|
|
86
|
+
try {
|
|
87
|
+
compiler = (0, resolveTsgo_1.resolveTsgo)({
|
|
88
|
+
cwd: node_path_1.default.dirname(props.tsconfig),
|
|
89
|
+
env: packageEnv,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// The command-line build reports a missing compiler in its own words.
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
// ttsx hands its runtime the compiler it resolved as `TTSC_TSGO_BINARY`, so
|
|
97
|
+
// only a selection naming another binary is a custom compiler.
|
|
98
|
+
const selected = options.binary ?? SidecarEnvironment_1.SidecarEnvironment.read(process.env, "TTSC_TSGO_BINARY");
|
|
99
|
+
if (selected && !sameFile(selected, compiler.binary))
|
|
100
|
+
return undefined;
|
|
101
|
+
const api = TypeScriptSyncApi_1.TypeScriptSyncApi.load(compiler.packageJson);
|
|
102
|
+
if (api === undefined)
|
|
103
|
+
return undefined;
|
|
104
|
+
const project = (0, readProjectConfig_1.readProjectConfig)({
|
|
105
|
+
cwd: props.projectRoot,
|
|
106
|
+
projectRoot: options.projectRoot,
|
|
107
|
+
tsconfig: props.tsconfig,
|
|
108
|
+
});
|
|
109
|
+
if ((0, hasProjectPluginEntries_1.hasProjectPluginEntries)(project, options.plugins, options.pluginConfigDir))
|
|
110
|
+
return undefined;
|
|
111
|
+
const effectiveOptions = (0, readEffectiveCompilerOptions_1.readEffectiveCompilerOptions)(project, options.passthrough, undefined, process.env);
|
|
112
|
+
const runOptions = {
|
|
113
|
+
checkers: options.checkers,
|
|
114
|
+
cwd: props.projectRoot,
|
|
115
|
+
emit: true,
|
|
116
|
+
outDir: props.emitDir,
|
|
117
|
+
isolateOutputsTo: props.emitDir,
|
|
118
|
+
passthrough: (0, runtimeCompilerArgs_1.runtimeCompilerArgs)(project, options.passthrough, undefined, effectiveOptions),
|
|
119
|
+
forceRuntimeSourceMap: (0, runtimeEmitProfile_1.runtimeEmitProfile)(project, options.passthrough, undefined, effectiveOptions).forceRuntimeSourceMap,
|
|
120
|
+
plugins: options.plugins,
|
|
121
|
+
pluginConfigDir: options.pluginConfigDir,
|
|
122
|
+
projectRoot: options.projectRoot,
|
|
123
|
+
quiet: true,
|
|
124
|
+
resolvedProject: project,
|
|
125
|
+
singleThreaded: options.singleThreaded,
|
|
126
|
+
skipDiagnosticsCheck: !props.checked,
|
|
127
|
+
tsconfig: props.tsconfig,
|
|
128
|
+
};
|
|
129
|
+
const execution = BuildExecution_1.BuildExecution.resolveExecutionContext(runOptions);
|
|
130
|
+
if (execution.compilerSelection.inspectionError !== undefined ||
|
|
131
|
+
execution.pluginSetupFailure !== undefined ||
|
|
132
|
+
execution.nativePlugins.length !== 0 ||
|
|
133
|
+
!sameFile(execution.tsgo.binary, compiler.binary))
|
|
134
|
+
return undefined;
|
|
135
|
+
const buildOptions = BuildExecution_1.BuildExecution.applyProjectNoEmit(runOptions, execution);
|
|
136
|
+
if (PassthroughFlags_1.PassthroughFlags.forwardsTerminalTsgoFlag(buildOptions))
|
|
137
|
+
return undefined;
|
|
138
|
+
const args = TsgoArguments_1.TsgoArguments.createTsgoBuildArgs(execution, buildOptions, {
|
|
139
|
+
listEmittedFiles: false,
|
|
140
|
+
noEmitOnError: props.checked,
|
|
141
|
+
});
|
|
142
|
+
if (args[0] !== "-p" || args[1] !== execution.tsconfig)
|
|
143
|
+
return undefined;
|
|
144
|
+
const assigned = (0, compilerArgsAsConfigOptions_1.compilerArgsAsConfigOptions)(args.slice(2), execution.cwd);
|
|
145
|
+
if (assigned === undefined)
|
|
146
|
+
return undefined;
|
|
147
|
+
const config = (0, singleRootProjectConfig_1.singleRootProjectConfig)({
|
|
148
|
+
tsconfig: props.tsconfig,
|
|
149
|
+
source: props.source,
|
|
150
|
+
volumeRoot: props.volumeRoot,
|
|
151
|
+
checked: props.checked,
|
|
152
|
+
});
|
|
153
|
+
const configFile = node_path_1.default.join(node_path_1.default.dirname(props.tsconfig), `.ttsx-${props.role}.${props.key}.tsconfig.json`);
|
|
154
|
+
const session = new api.API({
|
|
155
|
+
cwd: execution.cwd,
|
|
156
|
+
tsserverPath: execution.tsgo.binary,
|
|
157
|
+
});
|
|
158
|
+
try {
|
|
159
|
+
if (session.parseCommandLine(args.slice(2)).errors.length !== 0)
|
|
160
|
+
return undefined;
|
|
161
|
+
const snapshot = session.createSnapshot({
|
|
162
|
+
openProjects: [configFile],
|
|
163
|
+
fileSystem: {
|
|
164
|
+
kind: "layer",
|
|
165
|
+
files: {
|
|
166
|
+
[configFile]: JSON.stringify({
|
|
167
|
+
...config,
|
|
168
|
+
compilerOptions: { ...config.compilerOptions, ...assigned },
|
|
169
|
+
}),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
const opened = snapshot.getConfiguredProject(configFile);
|
|
174
|
+
const program = opened === undefined ? undefined : snapshot.getProgram(opened.id);
|
|
175
|
+
if (program === undefined)
|
|
176
|
+
throw new Error(`ttsx: TypeScript did not open the ${props.role} project for ${props.source}`);
|
|
177
|
+
const failure = (summary, diagnostics) => new Error([summary, api.formatDiagnostics(diagnostics, session)]
|
|
178
|
+
.filter((line) => line.trim().length !== 0)
|
|
179
|
+
.join("\n"));
|
|
180
|
+
const checkFailure = `ttsx: ${props.role} check failed for ${props.source}`;
|
|
181
|
+
if (props.checked) {
|
|
182
|
+
const diagnostics = TypeScriptSyncApi_1.TypeScriptSyncApi.reportedDiagnostics(program);
|
|
183
|
+
if (diagnostics.length !== 0)
|
|
184
|
+
throw failure(checkFailure, diagnostics);
|
|
185
|
+
}
|
|
186
|
+
const emitted = program.emitToString();
|
|
187
|
+
if (props.checked && (emitted.diagnostics?.length ?? 0) !== 0)
|
|
188
|
+
throw failure(checkFailure, emitted.diagnostics);
|
|
189
|
+
const emitDir = node_path_1.default.resolve(props.emitDir);
|
|
190
|
+
const emittedSources = Object.create(null);
|
|
191
|
+
const emittedSourceProofFailures = Object.create(null);
|
|
192
|
+
node_fs_1.default.mkdirSync(emitDir, { recursive: true });
|
|
193
|
+
for (const [fileName, file] of emitted.outputFiles) {
|
|
194
|
+
const output = node_path_1.default.resolve(fileName);
|
|
195
|
+
const relative = node_path_1.default.relative(emitDir, output);
|
|
196
|
+
if (relative === "" ||
|
|
197
|
+
relative.startsWith("..") ||
|
|
198
|
+
node_path_1.default.isAbsolute(relative))
|
|
199
|
+
continue;
|
|
200
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(output), { recursive: true });
|
|
201
|
+
node_fs_1.default.writeFileSync(output, file.text);
|
|
202
|
+
if (!/\.(?:js|jsx|mjs|cjs)$/i.test(output))
|
|
203
|
+
continue;
|
|
204
|
+
const owner = physicalSource(file.sourceFileName);
|
|
205
|
+
if (owner !== undefined)
|
|
206
|
+
emittedSources[output] = [owner];
|
|
207
|
+
else {
|
|
208
|
+
emittedSources[output] = [];
|
|
209
|
+
emittedSourceProofFailures[output] =
|
|
210
|
+
file.sourceFileName === undefined
|
|
211
|
+
? "TypeScript reported no source for this output."
|
|
212
|
+
: `The source TypeScript emitted this output from no longer resolves: ${JSON.stringify(file.sourceFileName)}.`;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (!props.checked && !DependencyBuildGeneration_1.DependencyBuildGeneration.emittedAnything(emitDir))
|
|
216
|
+
throw failure(`ttsx: ${props.role} build produced no output for ${props.source}`, TypeScriptSyncApi_1.TypeScriptSyncApi.reportedDiagnostics(program));
|
|
217
|
+
return {
|
|
218
|
+
project,
|
|
219
|
+
rootDir: typeof assigned.rootDir === "string"
|
|
220
|
+
? assigned.rootDir
|
|
221
|
+
: props.volumeRoot,
|
|
222
|
+
emittedSources,
|
|
223
|
+
emittedSourceProofFailures: Object.keys(emittedSourceProofFailures).length === 0
|
|
224
|
+
? undefined
|
|
225
|
+
: emittedSourceProofFailures,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
session.close();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** Whether two paths name the same existing file. */
|
|
233
|
+
function sameFile(left, right) {
|
|
234
|
+
try {
|
|
235
|
+
return (node_fs_1.default.realpathSync.native(node_path_1.default.resolve(left)) ===
|
|
236
|
+
node_fs_1.default.realpathSync.native(node_path_1.default.resolve(right)));
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/** The native real path of an emitted output's source, if it still exists. */
|
|
243
|
+
function physicalSource(fileName) {
|
|
244
|
+
if (fileName === undefined)
|
|
245
|
+
return undefined;
|
|
246
|
+
try {
|
|
247
|
+
return node_fs_1.default.realpathSync.native(node_path_1.default.resolve(fileName));
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=buildSingleRootInMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSingleRootInMemory.js","sourceRoot":"","sources":["../../../src/launcher/internal/buildSingleRootInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,iFAA8E;AAC9E,qFAAkF;AAElF,+EAA4E;AAC5E,yFAAsF;AACtF,uGAAoG;AACpG,qEAAkE;AAClE,8FAA2F;AAC3F,mFAAgF;AAChF,gGAA6F;AAE7F,2DAAwD;AACxD,+EAA4E;AAC5E,mFAAgF;AAChF,+DAA4D;AAC5D,6DAA0D;AAC1D,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,iCAAwC,KA2BvC;IAQC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC9B,IACE,IAAA,mDAAwB,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC;QACxE,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;QAEpE,OAAO,SAAS,CAAC;IACnB,wEAAwE;IACxE,6E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QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,SAAS,cAAc,CAAC,QAA4B;IAClD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,iBAAE,CAAC,YAAY,CAAC,MAAM,CAAC,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -23,20 +23,24 @@ import type { TtscCommonOptions } from "../../structures/internal/TtscCommonOpti
|
|
|
23
23
|
* there. A checked build needs all of them exactly as the user's config sees
|
|
24
24
|
* them, so its tsconfig is written beside the real one, and a directory that
|
|
25
25
|
* refuses the write is reported by name. TypeScript-Go's command line cannot
|
|
26
|
-
* combine a project with a file list,
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
26
|
+
* combine a project with a file list, so no other placement is faithful for it.
|
|
27
|
+
* TypeScript 7.1's API can hold that tsconfig in memory, beside the real one,
|
|
28
|
+
* without creating a file: `buildSingleRootInMemory` takes the build first, and
|
|
29
|
+
* everything below runs only when that route is unavailable: for a TypeScript
|
|
30
|
+
* 7.0 project, native plugins, a custom compiler, or arguments a tsconfig
|
|
31
|
+
* cannot carry. An emit-only build ignores diagnostics, and none of those
|
|
32
|
+
* lookups changes what it emits, with one exception: `${configDir}` inside
|
|
33
|
+
* `paths` or `baseUrl` decides which module an import resolves to, and so
|
|
34
|
+
* whether a re-exported name is elided as a type. Unless its config chain uses
|
|
35
|
+
* `${configDir}`, an emit-only build's tsconfig is written beside `emitDir`
|
|
36
|
+
* instead, because such a build runs while the program is running, for an
|
|
37
|
+
* installed package whose directory may be read-only or for a plugin descriptor
|
|
38
|
+
* whose inputs are fingerprinted by their directory's metadata, and a file
|
|
39
|
+
* created and removed in the user's tree would disturb both. The overlay is
|
|
40
|
+
* created exclusively: an occupied name is refused without writing or removing
|
|
41
|
+
* that entry. After acquisition, closing its descriptor and removing the
|
|
42
|
+
* overlay are attempted on success or failure; native cleanup failures may
|
|
43
|
+
* leave the overlay behind.
|
|
40
44
|
*
|
|
41
45
|
* `rootDir` is the root of the source's volume. The layout of this emit is
|
|
42
46
|
* private, so `rootDir` decides nothing here but whether a file of the program
|
|
@@ -64,12 +68,12 @@ import type { TtscCommonOptions } from "../../structures/internal/TtscCommonOpti
|
|
|
64
68
|
* synthesized from maps.
|
|
65
69
|
* @throws When the build fails. A checked build fails on any diagnostic; an
|
|
66
70
|
* emit-only build fails only when it produced no JavaScript at all.
|
|
67
|
-
* @evidence contracts/common.md#principled-implementation
|
|
68
|
-
* @evidence contracts/common.md#clear-and-simple-design This boundary owns single-root overlay construction and cleanup, delegates project parsing/building, and isolates writable-directory diagnostics in a private helper.
|
|
71
|
+
* @evidence contracts/common.md#principled-implementation The in-memory API route is tried first and owns its own admission; otherwise a transient extends overlay changes only roots and runtime output constraints, while preserving configDir-sensitive anchors; effective rootDir is returned for output ownership rather than inferred from emitted filenames.
|
|
72
|
+
* @evidence contracts/common.md#clear-and-simple-design This boundary selects the in-memory route when it is available and otherwise owns single-root overlay construction and cleanup, delegates project parsing/building, and isolates writable-directory diagnostics in a private helper.
|
|
69
73
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Private emit layout, disabled declaration/composite products and checked versus installed-package diagnostics are runtime contract distinctions, not source patches or tests-only compiler modes.
|
|
70
|
-
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain overlay placement, wide rootDir, diagnostics and cleanup, while separately documented input members preserve their ownership facts.
|
|
74
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain the in-memory route and when it is unavailable, overlay placement, wide rootDir, diagnostics and cleanup, while separately documented input members preserve their ownership facts.
|
|
71
75
|
* @evidence contracts/portability.md#os-neutral-implementation Shared filesystem identity selects the source volume from resolved native identity when available and retained spelling otherwise; overlay JSON converts only native separators, preserving literal POSIX backslashes. Public exclusive creation refuses an occupied overlay name without overwriting it; explicit compiler paths avoid shell interpolation and blanket case folding.
|
|
72
|
-
* @evidence contracts/performance.md#efficient-algorithms Emit-only placement parses the config chain and scans its text for configDir anchors; checked placement skips that scan. Native identity resolution, overlay serialization/write, effective-options preparation and delegated compilation contribute path/input/output byte costs; this boundary performs no source-directory mirror or second whole-project compilation.
|
|
76
|
+
* @evidence contracts/performance.md#efficient-algorithms An admitted in-memory build replaces every step below with its own single API session; a refused one adds its admission (a project parse and an execution resolution without plugin loading) before them. Emit-only placement parses the config chain and scans its text for configDir anchors; checked placement skips that scan. Native identity resolution, overlay serialization/write, effective-options preparation and delegated compilation contribute path/input/output byte costs; this boundary performs no source-directory mirror or second whole-project compilation.
|
|
73
77
|
* @evidence contracts/performance.md#reuse-equivalent-work One effective-options reader for this overlay and exact forwarded tokens is shared by runtime lowering, emit classification and rootDir selection, avoiding duplicate response-file compiler queries. Callers own sharing of completed build generations.
|
|
74
78
|
* @evidence contracts/performance.md#bound-retention-and-release-resources Exclusive open establishes ownership of one transient tsconfig and descriptor. The descriptor is closed before parsing; finally attempts any remaining close and removal after write, close, parse or build failure, without removing a failed-acquisition entry. Native cleanup failures may retain the overlay; caller owns emit storage and delegated build lifetimes.
|
|
75
79
|
*/
|
|
@@ -11,6 +11,7 @@ const readProjectConfig_1 = require("../../compiler/internal/project/readProject
|
|
|
11
11
|
const readEffectiveCompilerOptions_1 = require("../../compiler/internal/readEffectiveCompilerOptions");
|
|
12
12
|
const SidecarEnvironment_1 = require("../../compiler/internal/sharedHost/SidecarEnvironment");
|
|
13
13
|
const createFilesystemPathIdentityContext_1 = require("../../internal/pathIdentity/createFilesystemPathIdentityContext");
|
|
14
|
+
const buildSingleRootInMemory_1 = require("./buildSingleRootInMemory");
|
|
14
15
|
const DependencyBuildGeneration_1 = require("./runtime/DependencyBuildGeneration");
|
|
15
16
|
const runtimeCompilerArgs_1 = require("./runtimeCompilerArgs");
|
|
16
17
|
const runtimeEmitProfile_1 = require("./runtimeEmitProfile");
|
|
@@ -37,20 +38,24 @@ const singleRootProjectConfig_1 = require("./singleRootProjectConfig");
|
|
|
37
38
|
* there. A checked build needs all of them exactly as the user's config sees
|
|
38
39
|
* them, so its tsconfig is written beside the real one, and a directory that
|
|
39
40
|
* refuses the write is reported by name. TypeScript-Go's command line cannot
|
|
40
|
-
* combine a project with a file list,
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
41
|
+
* combine a project with a file list, so no other placement is faithful for it.
|
|
42
|
+
* TypeScript 7.1's API can hold that tsconfig in memory, beside the real one,
|
|
43
|
+
* without creating a file: `buildSingleRootInMemory` takes the build first, and
|
|
44
|
+
* everything below runs only when that route is unavailable: for a TypeScript
|
|
45
|
+
* 7.0 project, native plugins, a custom compiler, or arguments a tsconfig
|
|
46
|
+
* cannot carry. An emit-only build ignores diagnostics, and none of those
|
|
47
|
+
* lookups changes what it emits, with one exception: `${configDir}` inside
|
|
48
|
+
* `paths` or `baseUrl` decides which module an import resolves to, and so
|
|
49
|
+
* whether a re-exported name is elided as a type. Unless its config chain uses
|
|
50
|
+
* `${configDir}`, an emit-only build's tsconfig is written beside `emitDir`
|
|
51
|
+
* instead, because such a build runs while the program is running, for an
|
|
52
|
+
* installed package whose directory may be read-only or for a plugin descriptor
|
|
53
|
+
* whose inputs are fingerprinted by their directory's metadata, and a file
|
|
54
|
+
* created and removed in the user's tree would disturb both. The overlay is
|
|
55
|
+
* created exclusively: an occupied name is refused without writing or removing
|
|
56
|
+
* that entry. After acquisition, closing its descriptor and removing the
|
|
57
|
+
* overlay are attempted on success or failure; native cleanup failures may
|
|
58
|
+
* leave the overlay behind.
|
|
54
59
|
*
|
|
55
60
|
* `rootDir` is the root of the source's volume. The layout of this emit is
|
|
56
61
|
* private, so `rootDir` decides nothing here but whether a file of the program
|
|
@@ -78,12 +83,12 @@ const singleRootProjectConfig_1 = require("./singleRootProjectConfig");
|
|
|
78
83
|
* synthesized from maps.
|
|
79
84
|
* @throws When the build fails. A checked build fails on any diagnostic; an
|
|
80
85
|
* emit-only build fails only when it produced no JavaScript at all.
|
|
81
|
-
* @evidence contracts/common.md#principled-implementation
|
|
82
|
-
* @evidence contracts/common.md#clear-and-simple-design This boundary owns single-root overlay construction and cleanup, delegates project parsing/building, and isolates writable-directory diagnostics in a private helper.
|
|
86
|
+
* @evidence contracts/common.md#principled-implementation The in-memory API route is tried first and owns its own admission; otherwise a transient extends overlay changes only roots and runtime output constraints, while preserving configDir-sensitive anchors; effective rootDir is returned for output ownership rather than inferred from emitted filenames.
|
|
87
|
+
* @evidence contracts/common.md#clear-and-simple-design This boundary selects the in-memory route when it is available and otherwise owns single-root overlay construction and cleanup, delegates project parsing/building, and isolates writable-directory diagnostics in a private helper.
|
|
83
88
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Private emit layout, disabled declaration/composite products and checked versus installed-package diagnostics are runtime contract distinctions, not source patches or tests-only compiler modes.
|
|
84
|
-
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain overlay placement, wide rootDir, diagnostics and cleanup, while separately documented input members preserve their ownership facts.
|
|
89
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain the in-memory route and when it is unavailable, overlay placement, wide rootDir, diagnostics and cleanup, while separately documented input members preserve their ownership facts.
|
|
85
90
|
* @evidence contracts/portability.md#os-neutral-implementation Shared filesystem identity selects the source volume from resolved native identity when available and retained spelling otherwise; overlay JSON converts only native separators, preserving literal POSIX backslashes. Public exclusive creation refuses an occupied overlay name without overwriting it; explicit compiler paths avoid shell interpolation and blanket case folding.
|
|
86
|
-
* @evidence contracts/performance.md#efficient-algorithms Emit-only placement parses the config chain and scans its text for configDir anchors; checked placement skips that scan. Native identity resolution, overlay serialization/write, effective-options preparation and delegated compilation contribute path/input/output byte costs; this boundary performs no source-directory mirror or second whole-project compilation.
|
|
91
|
+
* @evidence contracts/performance.md#efficient-algorithms An admitted in-memory build replaces every step below with its own single API session; a refused one adds its admission (a project parse and an execution resolution without plugin loading) before them. Emit-only placement parses the config chain and scans its text for configDir anchors; checked placement skips that scan. Native identity resolution, overlay serialization/write, effective-options preparation and delegated compilation contribute path/input/output byte costs; this boundary performs no source-directory mirror or second whole-project compilation.
|
|
87
92
|
* @evidence contracts/performance.md#reuse-equivalent-work One effective-options reader for this overlay and exact forwarded tokens is shared by runtime lowering, emit classification and rootDir selection, avoiding duplicate response-file compiler queries. Callers own sharing of completed build generations.
|
|
88
93
|
* @evidence contracts/performance.md#bound-retention-and-release-resources Exclusive open establishes ownership of one transient tsconfig and descriptor. The descriptor is closed before parsing; finally attempts any remaining close and removal after write, close, parse or build failure, without removing a failed-acquisition entry. Native cleanup failures may retain the overlay; caller owns emit storage and delegated build lifetimes.
|
|
89
94
|
*/
|
|
@@ -99,6 +104,9 @@ function buildSingleRootProject(props) {
|
|
|
99
104
|
const volumeRoot = node_path_1.default.parse((0, createFilesystemPathIdentityContext_1.createFilesystemPathIdentityContext)({
|
|
100
105
|
throwOnRealpathError: false,
|
|
101
106
|
}).resolve(props.source).path).root;
|
|
107
|
+
const inMemory = (0, buildSingleRootInMemory_1.buildSingleRootInMemory)({ ...props, options, volumeRoot });
|
|
108
|
+
if (inMemory !== undefined)
|
|
109
|
+
return inMemory;
|
|
102
110
|
const beside = props.checked ||
|
|
103
111
|
(0, readProjectConfig_1.readProjectConfig)({ tsconfig: props.tsconfig }).configPaths.some((file) => node_fs_1.default.readFileSync(file, "utf8").includes("${configDir}"));
|
|
104
112
|
const tsconfig = node_path_1.default.join(beside ? node_path_1.default.dirname(props.tsconfig) : node_path_1.default.dirname(props.emitDir), `.ttsx-${props.role}.${props.key}.tsconfig.json`);
|
|
@@ -225,6 +233,7 @@ function unwritableConfigDirectory(error, props, directory) {
|
|
|
225
233
|
`ttsx: cannot compile ${props.source} with the options of ${props.tsconfig}: ${directory} is not writable (${code}).`,
|
|
226
234
|
"The file is outside that project's file set, and ttsx compiles it through a temporary tsconfig placed beside the project's own for the length of the build.",
|
|
227
235
|
`Make the directory writable, or add the file to the project's "include" or "files".`,
|
|
236
|
+
"With TypeScript 7.1 or later, a build without native plugins, a custom compiler or a response file compiles it in memory instead.",
|
|
228
237
|
].join("\n"));
|
|
229
238
|
}
|
|
230
239
|
//# sourceMappingURL=buildSingleRootProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSingleRootProject.js","sourceRoot":"","sources":["../../../src/launcher/internal/buildSingleRootProject.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,qEAAkE;AAClE,yFAAsF;AACtF,uGAAoG;AACpG,8FAA2F;AAC3F,yHAAsH;AAGtH,mFAAgF;AAChF,+DAA4D;AAC5D,6DAA0D;AAC1D,uEAAoE;AAEpE
|
|
1
|
+
{"version":3,"file":"buildSingleRootProject.js","sourceRoot":"","sources":["../../../src/launcher/internal/buildSingleRootProject.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,qEAAkE;AAClE,yFAAsF;AACtF,uGAAoG;AACpG,8FAA2F;AAC3F,yHAAsH;AAGtH,uEAAoE;AACpE,mFAAgF;AAChF,+DAA4D;AAC5D,6DAA0D;AAC1D,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,gCAAuC,KA4BtC;IAaC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,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,yBAAyB,CAChC,KAAc,EACd,KAA2C,EAC3C,SAAiB;IAEjB,MAAM,IAAI,GAAI,KAAsC,EAAE,IAAI,CAAC;IAC3D,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAC5E,OAAO,IAAI,KAAK,CACd;QACE,wBAAwB,KAAK,CAAC,MAAM,wBAAwB,KAAK,CAAC,QAAQ,KAAK,SAAS,qBAAqB,IAAI,IAAI;QACrH,6JAA6J;QAC7J,qFAAqF;QACrF,mIAAmI;KACpI,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate compiler command-line arguments into the `compilerOptions` of a
|
|
3
|
+
* tsconfig that extends the project, so that a build which opens that tsconfig
|
|
4
|
+
* alone sees the options the arguments would have given it.
|
|
5
|
+
*
|
|
6
|
+
* TypeScript applies command-line options over the options of the config it
|
|
7
|
+
* builds, and an extending config's own `compilerOptions` override the config
|
|
8
|
+
* it extends in the same way. So the assignments of `args`, written into the
|
|
9
|
+
* extending config, win over the project exactly as they would on the command
|
|
10
|
+
* line. Each value is converted the way the compiler parses it from argv: the
|
|
11
|
+
* last occurrence of an option wins; `null` resets an inherited value; enum
|
|
12
|
+
* values are trimmed and lowercased; a list value is split at commas and loses
|
|
13
|
+
* its empty members; and a value that names a path is resolved against `cwd`,
|
|
14
|
+
* because the compiler resolves a command-line path against its working
|
|
15
|
+
* directory while a config path resolves against the config's directory.
|
|
16
|
+
*
|
|
17
|
+
* Arguments that a config cannot carry make the translation unavailable, so the
|
|
18
|
+
* caller keeps a build that passes them on the command line: a response file, a
|
|
19
|
+
* positional file name, an unknown option, an option the compiler accepts only
|
|
20
|
+
* on the command line, a project selection, the trace and profile options whose
|
|
21
|
+
* artifacts the compiler writes itself, and a value containing `${configDir}`,
|
|
22
|
+
* which a config would substitute and the command line does not. The
|
|
23
|
+
* translation assumes valid arguments; the caller confirms them with the same
|
|
24
|
+
* compiler's own command-line parser before using the result.
|
|
25
|
+
*
|
|
26
|
+
* @param args Compiler arguments without the leading `-p <tsconfig>`.
|
|
27
|
+
* @param cwd The directory the compiler would run in.
|
|
28
|
+
* @returns The assignments by canonical option name, or `undefined` when the
|
|
29
|
+
* arguments cannot be carried by a config.
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation Each occurrence is classified by the pinned native grammar (readCompilerOptionOccurrence) and its value converted by the native command-line rules: null resets, last occurrence wins, enum trim and lowercase, list TrimSpace and comma split with empty members dropped, and paths resolved against the working directory. Command-line options override the configured ones as an extending config's options override its base, so writing them into the extending config preserves precedence. Premise: the arguments are valid; the caller verifies that with the consumer compiler's parseCommandLine. Options newer than the pinned table are unknown here and make the translation unavailable.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design One pure function owns the argv-to-config translation; the build that consumes it owns compiler selection, validation and emission.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Unsupported argument classes return undefined so the caller keeps the command-line build instead of approximating them; no option is special-cased by consumer or fixture.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation The prose states the precedence premise, every conversion rule, each class that makes the translation unavailable and the validity premise.
|
|
34
|
+
* @evidence contracts/portability.md#os-neutral-implementation Path values are resolved with node:path against the supplied working directory, so drive letters and separators follow the host; no other value is touched as a path.
|
|
35
|
+
* @evidence contracts/performance.md#efficient-algorithms One pass over the arguments with a constant-time table lookup per option and a split per list value.
|
|
36
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The translation depends only on its arguments and is computed once per build.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned record is the only allocation and transfers to the caller.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compilerArgsAsConfigOptions(args: readonly string[], cwd: string): Record<string, unknown> | undefined;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.compilerArgsAsConfigOptions = compilerArgsAsConfigOptions;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const normalizeCompilerEnumValue_1 = require("../../flags/normalizeCompilerEnumValue");
|
|
9
|
+
const readCompilerOptionOccurrence_1 = require("../../flags/readCompilerOptionOccurrence");
|
|
10
|
+
/**
|
|
11
|
+
* Translate compiler command-line arguments into the `compilerOptions` of a
|
|
12
|
+
* tsconfig that extends the project, so that a build which opens that tsconfig
|
|
13
|
+
* alone sees the options the arguments would have given it.
|
|
14
|
+
*
|
|
15
|
+
* TypeScript applies command-line options over the options of the config it
|
|
16
|
+
* builds, and an extending config's own `compilerOptions` override the config
|
|
17
|
+
* it extends in the same way. So the assignments of `args`, written into the
|
|
18
|
+
* extending config, win over the project exactly as they would on the command
|
|
19
|
+
* line. Each value is converted the way the compiler parses it from argv: the
|
|
20
|
+
* last occurrence of an option wins; `null` resets an inherited value; enum
|
|
21
|
+
* values are trimmed and lowercased; a list value is split at commas and loses
|
|
22
|
+
* its empty members; and a value that names a path is resolved against `cwd`,
|
|
23
|
+
* because the compiler resolves a command-line path against its working
|
|
24
|
+
* directory while a config path resolves against the config's directory.
|
|
25
|
+
*
|
|
26
|
+
* Arguments that a config cannot carry make the translation unavailable, so the
|
|
27
|
+
* caller keeps a build that passes them on the command line: a response file, a
|
|
28
|
+
* positional file name, an unknown option, an option the compiler accepts only
|
|
29
|
+
* on the command line, a project selection, the trace and profile options whose
|
|
30
|
+
* artifacts the compiler writes itself, and a value containing `${configDir}`,
|
|
31
|
+
* which a config would substitute and the command line does not. The
|
|
32
|
+
* translation assumes valid arguments; the caller confirms them with the same
|
|
33
|
+
* compiler's own command-line parser before using the result.
|
|
34
|
+
*
|
|
35
|
+
* @param args Compiler arguments without the leading `-p <tsconfig>`.
|
|
36
|
+
* @param cwd The directory the compiler would run in.
|
|
37
|
+
* @returns The assignments by canonical option name, or `undefined` when the
|
|
38
|
+
* arguments cannot be carried by a config.
|
|
39
|
+
* @evidence contracts/common.md#principled-implementation Each occurrence is classified by the pinned native grammar (readCompilerOptionOccurrence) and its value converted by the native command-line rules: null resets, last occurrence wins, enum trim and lowercase, list TrimSpace and comma split with empty members dropped, and paths resolved against the working directory. Command-line options override the configured ones as an extending config's options override its base, so writing them into the extending config preserves precedence. Premise: the arguments are valid; the caller verifies that with the consumer compiler's parseCommandLine. Options newer than the pinned table are unknown here and make the translation unavailable.
|
|
40
|
+
* @evidence contracts/common.md#clear-and-simple-design One pure function owns the argv-to-config translation; the build that consumes it owns compiler selection, validation and emission.
|
|
41
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Unsupported argument classes return undefined so the caller keeps the command-line build instead of approximating them; no option is special-cased by consumer or fixture.
|
|
42
|
+
* @evidence contracts/common.md#meaningful-documentation The prose states the precedence premise, every conversion rule, each class that makes the translation unavailable and the validity premise.
|
|
43
|
+
* @evidence contracts/portability.md#os-neutral-implementation Path values are resolved with node:path against the supplied working directory, so drive letters and separators follow the host; no other value is touched as a path.
|
|
44
|
+
* @evidence contracts/performance.md#efficient-algorithms One pass over the arguments with a constant-time table lookup per option and a split per list value.
|
|
45
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The translation depends only on its arguments and is computed once per build.
|
|
46
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned record is the only allocation and transfers to the caller.
|
|
47
|
+
*/
|
|
48
|
+
function compilerArgsAsConfigOptions(args, cwd) {
|
|
49
|
+
const options = {};
|
|
50
|
+
for (let index = 0; index < args.length;) {
|
|
51
|
+
if (args[index].startsWith("@"))
|
|
52
|
+
return undefined;
|
|
53
|
+
const occurrence = (0, readCompilerOptionOccurrence_1.readCompilerOptionOccurrence)(args, index);
|
|
54
|
+
const option = occurrence.option;
|
|
55
|
+
if (option === undefined ||
|
|
56
|
+
option.commandLineOnly ||
|
|
57
|
+
COMMAND_LINE_OUTPUTS.has(option.name))
|
|
58
|
+
return undefined;
|
|
59
|
+
const next = occurrence.width === 2 ? args[index + 1] : undefined;
|
|
60
|
+
let value;
|
|
61
|
+
if (next === "null")
|
|
62
|
+
value = null;
|
|
63
|
+
else if (option.configOnly) {
|
|
64
|
+
// The command line accepts only `null`, or `false` for a boolean.
|
|
65
|
+
if (option.kind !== "boolean" || next !== "false")
|
|
66
|
+
return undefined;
|
|
67
|
+
value = false;
|
|
68
|
+
}
|
|
69
|
+
else if (option.kind === "boolean")
|
|
70
|
+
value = occurrence.booleanValue;
|
|
71
|
+
else if (next === undefined)
|
|
72
|
+
// A list whose value is empty; any other kind is an invalid argument.
|
|
73
|
+
value = [];
|
|
74
|
+
else if (next.includes("${configDir}"))
|
|
75
|
+
return undefined;
|
|
76
|
+
else if (option.kind === "number")
|
|
77
|
+
value = Number(next);
|
|
78
|
+
else if (option.kind === "enum")
|
|
79
|
+
value = (0, normalizeCompilerEnumValue_1.normalizeCompilerEnumValue)(next, "cli");
|
|
80
|
+
else if (option.kind === "list")
|
|
81
|
+
value = splitList(next, option.element === "enum", option.filePath, cwd);
|
|
82
|
+
else
|
|
83
|
+
value = option.filePath ? node_path_1.default.resolve(cwd, next) : next;
|
|
84
|
+
options[option.name] = value;
|
|
85
|
+
index += occurrence.width;
|
|
86
|
+
}
|
|
87
|
+
return options;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Options whose output the compiler writes itself, outside the emit: a config
|
|
91
|
+
* route that only collects emitted files cannot produce them.
|
|
92
|
+
*/
|
|
93
|
+
const COMMAND_LINE_OUTPUTS = new Set([
|
|
94
|
+
"project",
|
|
95
|
+
"generateTrace",
|
|
96
|
+
"generateCpuProfile",
|
|
97
|
+
"pprofDir",
|
|
98
|
+
]);
|
|
99
|
+
/** Members of a command-line list value, as the native parser reads them. */
|
|
100
|
+
function splitList(value, enumMembers, filePath, cwd) {
|
|
101
|
+
// Go strings.TrimSpace follows Unicode White_Space for the whole value;
|
|
102
|
+
// enum members are then trimmed with the compiler's IsWhiteSpaceLike set.
|
|
103
|
+
const trimmed = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, "");
|
|
104
|
+
if (trimmed === "" || trimmed.startsWith("-"))
|
|
105
|
+
return [];
|
|
106
|
+
const members = [];
|
|
107
|
+
for (const part of trimmed.split(",")) {
|
|
108
|
+
const member = enumMembers ? (0, normalizeCompilerEnumValue_1.normalizeCompilerEnumValue)(part, "cli") : part;
|
|
109
|
+
if (member === null || member === "")
|
|
110
|
+
continue;
|
|
111
|
+
members.push(filePath ? node_path_1.default.resolve(cwd, member) : member);
|
|
112
|
+
}
|
|
113
|
+
return members;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=compilerArgsAsConfigOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilerArgsAsConfigOptions.js","sourceRoot":"","sources":["../../../src/launcher/internal/compilerArgsAsConfigOptions.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qCACE,IAAuB,EACvB,GAAW;IAEX,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,GAAI,CAAC;QAC1C,IAAI,IAAI,CAAC,KAAK,CAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QACnD,MAAM,UAAU,GAAG,IAAA,2DAA4B,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QACjC,IACE,MAAM,KAAK,SAAS;YACpB,MAAM,CAAC,eAAe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