ttsc 0.19.2 → 0.20.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 +7 -5
- package/cmd/graphdump/main.go +2 -4
- package/cmd/ttsc/filter.go +12 -4
- package/cmd/ttsc/filter_resolves_flag_names_case_insensitively_test.go +53 -0
- package/cmd/ttsc/flags_gen.go +3 -3
- package/cmd/ttscgraph/dump.go +5 -7
- package/cmd/ttscgraph/run_dump_emits_only_checker_verified_member_relations_test.go +118 -0
- package/cmd/ttscgraph/serve.go +58 -308
- package/cmd/ttscgraph/serve_session_keeps_base_url_fallback_unchanged_test.go +49 -0
- package/cmd/ttscgraph/serve_session_keeps_esm_directory_candidate_unchanged_test.go +61 -0
- package/cmd/ttscgraph/serve_session_keeps_exports_blocked_file_candidates_unchanged_test.go +64 -0
- package/cmd/ttscgraph/serve_session_keeps_inactive_conditional_export_unchanged_test.go +66 -0
- package/cmd/ttscgraph/serve_session_keeps_lower_priority_module_candidate_unchanged_test.go +67 -0
- package/cmd/ttscgraph/serve_session_keeps_lower_priority_paths_pattern_unchanged_test.go +58 -0
- package/cmd/ttscgraph/serve_session_keeps_nonlongest_root_dirs_candidate_unchanged_test.go +54 -0
- package/cmd/ttscgraph/serve_session_reloads_commonjs_package_entry_for_esm_test.go +50 -0
- package/cmd/ttscgraph/serve_session_reloads_module_suffix_candidate_test.go +41 -0
- package/cmd/ttscgraph/serve_session_reloads_superseding_module_candidates_test.go +216 -0
- package/cmd/ttscgraph/serve_session_retries_failed_dump_test.go +103 -0
- package/driver/graph.go +12 -6
- package/driver/lsp.go +30 -0
- package/driver/program.go +37 -1
- package/driver/resolution_candidates.go +819 -0
- package/driver/windowsjunction/windowsjunction.go +40 -0
- package/go.mod +2 -0
- package/internal/graph/build.go +45 -11
- package/internal/graph/dump.go +312 -108
- package/internal/graph/dump_checkout_paths_are_stable_test.go +210 -0
- package/internal/graph/dump_diagnostics_ride_the_generation_that_built_it_test.go +9 -3
- package/internal/graph/dump_paths.go +172 -0
- package/internal/graph/dump_paths_are_portable_and_injective_test.go +93 -0
- package/internal/graph/dump_schema_version_matches_the_typescript_client_test.go +1 -1
- package/internal/graph/dump_uses_ecma_line_terminators_test.go +87 -0
- package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +61 -0
- package/internal/graph/edges.go +220 -5
- package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +131 -0
- package/internal/graph/graph.go +177 -5
- package/internal/graph/line_model.go +122 -0
- package/internal/graph/literals.go +175 -0
- package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +74 -0
- package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +79 -0
- package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +84 -0
- package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +77 -0
- package/internal/graph/literals_resolve_through_alias_indirection_test.go +64 -0
- package/internal/graph/member_relation_edges_follow_checker_validity_test.go +85 -0
- package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +191 -0
- package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +119 -0
- package/internal/graph/node_ids_preserve_hash_bearing_components_test.go +41 -0
- package/internal/graph/node_modifiers_emit_union_strings_test.go +4 -1
- package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +192 -0
- package/internal/graph/object_member_signatures_preserve_literal_whitespace_test.go +67 -0
- package/internal/graph/object_members.go +229 -0
- package/internal/graph/provenance.go +88 -30
- package/internal/graph/source_texts_cover_every_resident_program_source_test.go +73 -0
- package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +66 -0
- package/internal/graphsymbols/provider.go +26 -91
- package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +144 -0
- package/internal/lspserver/lsp_completion.go +109 -0
- package/internal/lspserver/lsp_completion_gate_never_refuses_a_matching_line_test.go +50 -0
- package/internal/lspserver/lsp_completion_hints_longest_trigger_wins_test.go +149 -0
- package/internal/lspserver/lsp_completion_hints_nearest_trigger_wins_test.go +37 -0
- package/internal/lspserver/lsp_completion_merges_into_upstream_response_test.go +149 -0
- package/internal/lspserver/lsp_completion_nearest_hint_replaces_nearest_filter_test.go +43 -0
- package/internal/lspserver/lsp_completion_preserves_completion_list_extensions_test.go +99 -0
- package/internal/lspserver/lsp_completion_refuses_hints_inside_a_string_literal_test.go +69 -0
- package/internal/lspserver/lsp_completion_replaces_full_filter_in_rank_order_test.go +85 -0
- package/internal/lspserver/lsp_completion_request.go +455 -0
- package/internal/lspserver/lsp_completion_scope.go +530 -0
- package/internal/lspserver/lsp_completion_scope_bench_test.go +41 -0
- package/internal/lspserver/lsp_completion_scope_classifies_regex_statement_and_operator_boundaries_test.go +39 -0
- package/internal/lspserver/lsp_completion_scope_ignores_jsdoc_bytes_in_literals_test.go +108 -0
- package/internal/lspserver/lsp_completion_scope_refuses_regex_hints_test.go +52 -0
- package/internal/lspserver/lsp_completion_trigger_uses_last_rune_test.go +24 -0
- package/internal/lspserver/lsp_deleted_watched_file_withdraws_plugin_diagnostics_test.go +110 -0
- package/internal/lspserver/lsp_didsave_keeps_the_incremental_changed_uri_path_test.go +78 -0
- package/internal/lspserver/lsp_hints_absence_is_not_an_error_test.go +46 -0
- package/internal/lspserver/lsp_hints_refresh_coalesces_concurrent_requests_test.go +82 -0
- package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +40 -0
- package/internal/lspserver/lsp_hints_refresh_keeps_each_producer_isolated_test.go +64 -0
- package/internal/lspserver/lsp_hints_refresh_replaces_the_session_snapshot_test.go +66 -0
- package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +90 -0
- package/internal/lspserver/lsp_hints_refresh_serves_completion_while_running_test.go +91 -0
- package/internal/lspserver/lsp_index_byte_from_bounds_its_search_start_test.go +38 -0
- package/internal/lspserver/lsp_initialize_constrains_position_encoding_to_utf16_test.go +205 -0
- package/internal/lspserver/lsp_late_completion_trigger_is_reported_once_test.go +105 -0
- package/internal/lspserver/lsp_native_completion_hints_decode_flat_lint_wire_test.go +66 -0
- package/internal/lspserver/lsp_native_completion_hints_grouped_compatibility_boundary_test.go +60 -0
- package/internal/lspserver/lsp_native_plugin_source.go +315 -2
- package/internal/lspserver/lsp_native_resident.go +304 -0
- package/internal/lspserver/lsp_plugin.go +85 -8
- package/internal/lspserver/lsp_plugin_completion_resolve_stays_local_test.go +82 -0
- package/internal/lspserver/lsp_position_conversions_span_astral_and_combining_runes_test.go +119 -0
- package/internal/lspserver/lsp_proxy.go +601 -9
- package/internal/lspserver/lsp_refresh.go +70 -0
- package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +43 -0
- package/internal/lspserver/lsp_resident_maps_verb_args_test.go +34 -0
- package/internal/lspserver/lsp_server.go +13 -1
- package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +172 -0
- package/lib/TtscCompiler.d.ts +3 -1
- package/lib/TtscCompiler.js +5 -1
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/TtscService.d.ts +13 -3
- package/lib/TtscService.js +6 -6
- package/lib/TtscService.js.map +1 -1
- package/lib/compiler/internal/project/readConfigJson.d.ts +30 -0
- package/lib/compiler/internal/project/readConfigJson.js +208 -0
- package/lib/compiler/internal/project/readConfigJson.js.map +1 -0
- package/lib/compiler/internal/project/readProjectConfig.js +53 -149
- package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
- package/lib/compiler/internal/residentTransformProcess.d.ts +15 -2
- package/lib/compiler/internal/residentTransformProcess.js +159 -39
- package/lib/compiler/internal/residentTransformProcess.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +6 -0
- package/lib/compiler/internal/runBuild.js +143 -44
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/startResidentTransform.d.ts +5 -1
- package/lib/compiler/internal/startResidentTransform.js +3 -1
- package/lib/compiler/internal/startResidentTransform.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.js +12 -2
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/flags/parser.d.ts +19 -0
- package/lib/flags/parser.js +78 -36
- package/lib/flags/parser.js.map +1 -1
- package/lib/flags/schema.d.ts +49 -11
- package/lib/flags/schema.js +94 -22
- package/lib/flags/schema.js.map +1 -1
- package/lib/internal/assertSafeExplicitCacheDirectory.d.ts +5 -0
- package/lib/internal/assertSafeExplicitCacheDirectory.js +26 -0
- package/lib/internal/assertSafeExplicitCacheDirectory.js.map +1 -0
- package/lib/launcher/internal/runTtsc.js +107 -69
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +28 -41
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtimeHooks.d.ts +15 -0
- package/lib/launcher/internal/runtimeHooks.js +18 -1
- package/lib/launcher/internal/runtimeHooks.js.map +1 -1
- package/lib/launcher/internal/watchTopology.d.ts +43 -0
- package/lib/launcher/internal/watchTopology.js +360 -0
- package/lib/launcher/internal/watchTopology.js.map +1 -0
- package/lib/plugin/internal/buildSourcePlugin.d.ts +14 -3
- package/lib/plugin/internal/buildSourcePlugin.js +247 -61
- package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/loadProjectPlugins.js +63 -2
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/structures/ITtscCompilerTransformation.d.ts +16 -0
- package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +2 -0
- package/package.json +8 -8
- package/shim/ast/shim.go +48 -3
- package/shim/astnav/go.mod +14 -0
- package/shim/astnav/go.sum +20 -0
- package/shim/astnav/shim.go +15 -0
- package/shim/checker/shim.go +113 -0
- package/shim/core/shim.go +47 -0
- package/shim/diagnosticwriter/lint.go +50 -0
- package/src/TtscCompiler.ts +5 -1
- package/src/TtscService.ts +37 -10
- package/src/compiler/internal/project/readConfigJson.ts +209 -0
- package/src/compiler/internal/project/readProjectConfig.ts +62 -158
- package/src/compiler/internal/residentTransformProcess.ts +197 -39
- package/src/compiler/internal/runBuild.ts +169 -47
- package/src/compiler/internal/startResidentTransform.ts +12 -1
- package/src/compiler/internal/transformProjectInMemory.ts +12 -1
- package/src/flags/parser.ts +113 -42
- package/src/flags/schema.ts +113 -31
- package/src/internal/assertSafeExplicitCacheDirectory.ts +29 -0
- package/src/launcher/internal/runTtsc.ts +117 -68
- package/src/launcher/internal/runTtsx.ts +29 -44
- package/src/launcher/internal/runtimeHooks.ts +30 -2
- package/src/launcher/internal/watchTopology.ts +466 -0
- package/src/plugin/internal/buildSourcePlugin.ts +326 -64
- package/src/plugin/internal/loadProjectPlugins.ts +80 -2
- package/src/structures/ITtscCompilerTransformation.ts +17 -0
- package/src/structures/internal/ITtscParsedProjectConfig.ts +2 -0
- package/tools/shim_audit/baseline.json +0 -3
- package/tools/shim_audit/main.go +42 -14
- package/tools/shim_audit/shim_dir_coverage_test.go +25 -0
- package/utility/flags_gen.go +3 -3
- package/utility/host.go +9 -3
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Package windowsjunction creates a Windows directory junction without
|
|
2
|
+
// interpolating filesystem paths into cmd.exe syntax.
|
|
3
|
+
package windowsjunction
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"fmt"
|
|
7
|
+
"os"
|
|
8
|
+
"os/exec"
|
|
9
|
+
"strings"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
const (
|
|
13
|
+
linkEnvironment = "TTSC_WINDOWS_JUNCTION_LINK"
|
|
14
|
+
targetEnvironment = "TTSC_WINDOWS_JUNCTION_TARGET"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
// Create makes link a directory junction that points to target.
|
|
18
|
+
func Create(link, target string) error {
|
|
19
|
+
// mklink is a cmd.exe builtin. Feed a constant command over stdin and use
|
|
20
|
+
// delayed environment expansion so Go never has to quote a command string
|
|
21
|
+
// for cmd.exe. Delayed values are substituted after cmd has classified the
|
|
22
|
+
// command's metacharacters, keeping every character in each path as data.
|
|
23
|
+
cmd := exec.Command("cmd.exe", "/d", "/q", "/v:on")
|
|
24
|
+
cmd.Stdin = strings.NewReader(
|
|
25
|
+
"mklink /J \"!TTSC_WINDOWS_JUNCTION_LINK!\" \"!TTSC_WINDOWS_JUNCTION_TARGET!\"\r\nexit /b !errorlevel!\r\n",
|
|
26
|
+
)
|
|
27
|
+
cmd.Env = append(
|
|
28
|
+
os.Environ(),
|
|
29
|
+
linkEnvironment+"="+link,
|
|
30
|
+
targetEnvironment+"="+target,
|
|
31
|
+
)
|
|
32
|
+
if out, err := cmd.CombinedOutput(); err != nil {
|
|
33
|
+
return fmt.Errorf(
|
|
34
|
+
"mklink /J failed: %v: %s",
|
|
35
|
+
err,
|
|
36
|
+
strings.TrimSpace(string(out)),
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
return nil
|
|
40
|
+
}
|
package/go.mod
CHANGED
|
@@ -8,6 +8,7 @@ go 1.26
|
|
|
8
8
|
// stabilizes.
|
|
9
9
|
replace (
|
|
10
10
|
github.com/microsoft/typescript-go/shim/ast => ./shim/ast
|
|
11
|
+
github.com/microsoft/typescript-go/shim/astnav => ./shim/astnav
|
|
11
12
|
github.com/microsoft/typescript-go/shim/bundled => ./shim/bundled
|
|
12
13
|
github.com/microsoft/typescript-go/shim/checker => ./shim/checker
|
|
13
14
|
github.com/microsoft/typescript-go/shim/compiler => ./shim/compiler
|
|
@@ -26,6 +27,7 @@ replace (
|
|
|
26
27
|
|
|
27
28
|
require (
|
|
28
29
|
github.com/microsoft/typescript-go/shim/ast v0.0.0
|
|
30
|
+
github.com/microsoft/typescript-go/shim/astnav v0.0.0
|
|
29
31
|
github.com/microsoft/typescript-go/shim/bundled v0.0.0
|
|
30
32
|
github.com/microsoft/typescript-go/shim/checker v0.0.0
|
|
31
33
|
github.com/microsoft/typescript-go/shim/compiler v0.0.0
|
package/internal/graph/build.go
CHANGED
|
@@ -28,12 +28,22 @@ func Build(prog *driver.Program) *Graph {
|
|
|
28
28
|
return g
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
// SourceTexts maps
|
|
32
|
-
//
|
|
31
|
+
// SourceTexts maps every program source to the resident checker text.
|
|
32
|
+
// Declaration and virtual bundled files are included because external graph
|
|
33
|
+
// leaves still carry facts and spans the source manifest must attest to.
|
|
33
34
|
func SourceTexts(prog *driver.Program) map[string]string {
|
|
34
|
-
|
|
35
|
+
if prog == nil || prog.TSProgram == nil {
|
|
36
|
+
return map[string]string{}
|
|
37
|
+
}
|
|
38
|
+
// Discarded on purpose: this returns text, not an error channel. A failed
|
|
39
|
+
// apply reaches the dump through `NewDiagnostics`, which asks `Diagnostics`.
|
|
40
|
+
_ = prog.ApplyLinkedPlugins()
|
|
41
|
+
files := prog.TSProgram.SourceFiles()
|
|
35
42
|
out := make(map[string]string, len(files))
|
|
36
43
|
for _, file := range files {
|
|
44
|
+
if file == nil {
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
37
47
|
out[file.FileName()] = file.Text()
|
|
38
48
|
}
|
|
39
49
|
return out
|
|
@@ -114,6 +124,7 @@ func collectVariables(g *Graph, path string, statement *shimast.Node) {
|
|
|
114
124
|
}
|
|
115
125
|
for _, binding := range list.Declarations.Nodes {
|
|
116
126
|
addNode(g, path, binding, NodeVariable)
|
|
127
|
+
g.collectObjectMembers(path, binding)
|
|
117
128
|
collectClosures(g, path, binding)
|
|
118
129
|
}
|
|
119
130
|
}
|
|
@@ -398,18 +409,41 @@ func putDeclaredNode(g *Graph, path, name string, kind NodeKind, declaration *sh
|
|
|
398
409
|
}
|
|
399
410
|
}
|
|
400
411
|
g.Nodes[id] = &Node{
|
|
401
|
-
ID:
|
|
402
|
-
Name:
|
|
403
|
-
Simple:
|
|
404
|
-
Kind:
|
|
405
|
-
File:
|
|
406
|
-
Pos:
|
|
407
|
-
End:
|
|
408
|
-
|
|
412
|
+
ID: id,
|
|
413
|
+
Name: name,
|
|
414
|
+
Simple: simpleName(declaration.Symbol()),
|
|
415
|
+
Kind: kind,
|
|
416
|
+
File: path,
|
|
417
|
+
Pos: declaration.Pos(),
|
|
418
|
+
End: declaration.End(),
|
|
419
|
+
SignatureEnd: declarationSignatureEnd(declaration),
|
|
420
|
+
Modifiers: declarationModifiers(declaration),
|
|
409
421
|
}
|
|
410
422
|
g.bodyNodes[id] = hasBody
|
|
411
423
|
}
|
|
412
424
|
|
|
425
|
+
// declarationSignatureEnd is the offset where a declaration's head ends, or 0
|
|
426
|
+
// when this declaration has no body to bound.
|
|
427
|
+
//
|
|
428
|
+
// It reuses the boundary walk the object-member outline already uses, which
|
|
429
|
+
// stops at the construct that opens a body — a block, an object or array
|
|
430
|
+
// literal, a class expression, or an arrow's `=>`. Reusing it keeps one
|
|
431
|
+
// definition of "where the head ends" for both outlines rather than two that
|
|
432
|
+
// can disagree.
|
|
433
|
+
//
|
|
434
|
+
// A boundary at or before the declaration's own start, or past its end, is no
|
|
435
|
+
// boundary; those report 0 and leave the consumer on its existing behavior.
|
|
436
|
+
func declarationSignatureEnd(declaration *shimast.Node) int {
|
|
437
|
+
if declaration == nil {
|
|
438
|
+
return 0
|
|
439
|
+
}
|
|
440
|
+
boundary, found := sourceBodyBoundary(declaration)
|
|
441
|
+
if !found || boundary.end <= declaration.Pos() || boundary.end > declaration.End() {
|
|
442
|
+
return 0
|
|
443
|
+
}
|
|
444
|
+
return boundary.end
|
|
445
|
+
}
|
|
446
|
+
|
|
413
447
|
// declarationModifiers maps a declaration's combined modifier flags onto the
|
|
414
448
|
// wire-string subset of the TtscGraphNodeModifier union. Only flags with an
|
|
415
449
|
// exact union member are emitted, in a stable order; an unknown string would
|