ttsc 0.20.1 → 0.22.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.
Files changed (95) hide show
  1. package/cmd/ttscserver/main.go +79 -3
  2. package/cmd/ttscserver/run_lsp_uses_native_plugin_manifest_source_test.go +96 -16
  3. package/driver/lsp.go +4 -0
  4. package/internal/lspserver/lsp_document_diagnostics_omits_cached_project_when_current_result_has_none_test.go +48 -0
  5. package/internal/lspserver/lsp_executable_project_input_change_requests_launcher_restart_test.go +98 -0
  6. package/internal/lspserver/lsp_external_watched_change_retains_program_test.go +53 -0
  7. package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +9 -0
  8. package/internal/lspserver/lsp_native_plugin_source.go +171 -55
  9. package/internal/lspserver/lsp_native_resident.go +110 -9
  10. package/internal/lspserver/lsp_plugin.go +6 -0
  11. package/internal/lspserver/lsp_project_context_transport_identity_test.go +43 -0
  12. package/internal/lspserver/lsp_project_diagnostics.go +235 -0
  13. package/internal/lspserver/lsp_project_diagnostics_capability_is_independent_test.go +67 -0
  14. package/internal/lspserver/lsp_project_diagnostics_program_input_overlap_refreshes_all_producers_test.go +78 -0
  15. package/internal/lspserver/lsp_project_diagnostics_refresh_accumulates_owner_freshness_test.go +65 -0
  16. package/internal/lspserver/lsp_project_diagnostics_refresh_keeps_each_producer_last_good_test.go +90 -0
  17. package/internal/lspserver/lsp_project_diagnostics_refreshes_only_input_owners_test.go +62 -0
  18. package/internal/lspserver/lsp_project_diagnostics_resident_unsupported_falls_back_test.go +123 -0
  19. package/internal/lspserver/lsp_project_diagnostics_resume_preserves_generation_test.go +52 -0
  20. package/internal/lspserver/lsp_project_diagnostics_translates_relative_client_project_test.go +90 -0
  21. package/internal/lspserver/lsp_project_input_ownership_resolves_declared_spellings_test.go +95 -0
  22. package/internal/lspserver/lsp_project_input_registration.go +504 -0
  23. package/internal/lspserver/lsp_project_input_registration_rechecks_selection_baseline_test.go +71 -0
  24. package/internal/lspserver/lsp_project_input_registration_reconciles_rejected_pending_request_test.go +268 -0
  25. package/internal/lspserver/lsp_project_input_registration_shapes_patterns_test.go +94 -0
  26. package/internal/lspserver/lsp_project_input_watchers_anchor_missing_paths_test.go +48 -0
  27. package/internal/lspserver/lsp_project_inputs.go +944 -0
  28. package/internal/lspserver/lsp_project_inputs_match_missing_exact_and_glob_test.go +129 -0
  29. package/internal/lspserver/lsp_project_inputs_reject_invalid_and_foreign_snapshots_test.go +110 -0
  30. package/internal/lspserver/lsp_proxy.go +591 -28
  31. package/internal/lspserver/lsp_reload_directories_compare_immediate_topology_test.go +188 -0
  32. package/internal/lspserver/lsp_reload_file_fingerprint_preserves_raw_symlink_target_test.go +47 -0
  33. package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +1 -1
  34. package/internal/lspserver/lsp_resident_invalidation_broadcasts_program_input_overlap_test.go +60 -0
  35. package/internal/lspserver/lsp_resident_invalidation_targets_project_input_owners_test.go +51 -0
  36. package/internal/lspserver/lsp_same_transport_entries_are_deduplicated_test.go +66 -0
  37. package/lib/compiler/internal/project/readProjectConfig.d.ts +5 -3
  38. package/lib/compiler/internal/project/readProjectConfig.js +46 -14
  39. package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
  40. package/lib/compiler/internal/residentCheckProcess.d.ts +46 -0
  41. package/lib/compiler/internal/residentCheckProcess.js +227 -0
  42. package/lib/compiler/internal/residentCheckProcess.js.map +1 -0
  43. package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +2 -1
  44. package/lib/compiler/internal/resolveEmittedJavaScript.js +35 -18
  45. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
  46. package/lib/compiler/internal/runBuild.d.ts +64 -1
  47. package/lib/compiler/internal/runBuild.js +484 -7
  48. package/lib/compiler/internal/runBuild.js.map +1 -1
  49. package/lib/compiler/internal/runSingleFileEmit.js +1 -0
  50. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  51. package/lib/flags/parser.js +13 -17
  52. package/lib/flags/parser.js.map +1 -1
  53. package/lib/flags/schema.d.ts +10 -3
  54. package/lib/flags/schema.js +99 -0
  55. package/lib/flags/schema.js.map +1 -1
  56. package/lib/internal/projectInputPathIdentity.d.ts +23 -0
  57. package/lib/internal/projectInputPathIdentity.js +222 -0
  58. package/lib/internal/projectInputPathIdentity.js.map +1 -0
  59. package/lib/launcher/internal/runTtsc.d.ts +17 -0
  60. package/lib/launcher/internal/runTtsc.js +121 -88
  61. package/lib/launcher/internal/runTtsc.js.map +1 -1
  62. package/lib/launcher/internal/runTtscserver.d.ts +13 -1
  63. package/lib/launcher/internal/runTtscserver.js +415 -45
  64. package/lib/launcher/internal/runTtscserver.js.map +1 -1
  65. package/lib/launcher/internal/singleFileOutput.d.ts +16 -0
  66. package/lib/launcher/internal/singleFileOutput.js +103 -0
  67. package/lib/launcher/internal/singleFileOutput.js.map +1 -0
  68. package/lib/launcher/internal/watchTopology.d.ts +214 -2
  69. package/lib/launcher/internal/watchTopology.js +1560 -41
  70. package/lib/launcher/internal/watchTopology.js.map +1 -1
  71. package/lib/plugin/internal/loadProjectPlugins.d.ts +1 -0
  72. package/lib/plugin/internal/loadProjectPlugins.js +5 -0
  73. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
  74. package/lib/structures/ITtscPluginCapabilities.d.ts +31 -0
  75. package/lib/structures/internal/ITtscProjectInputSnapshot.d.ts +29 -0
  76. package/lib/structures/internal/ITtscProjectInputSnapshot.js +3 -0
  77. package/lib/structures/internal/ITtscProjectInputSnapshot.js.map +1 -0
  78. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +5 -0
  79. package/package.json +8 -8
  80. package/src/compiler/internal/project/readProjectConfig.ts +62 -8
  81. package/src/compiler/internal/residentCheckProcess.ts +279 -0
  82. package/src/compiler/internal/resolveEmittedJavaScript.ts +43 -21
  83. package/src/compiler/internal/runBuild.ts +728 -12
  84. package/src/compiler/internal/runSingleFileEmit.ts +1 -0
  85. package/src/flags/parser.ts +17 -17
  86. package/src/flags/schema.ts +111 -3
  87. package/src/internal/projectInputPathIdentity.ts +273 -0
  88. package/src/launcher/internal/runTtsc.ts +141 -117
  89. package/src/launcher/internal/runTtscserver.ts +561 -54
  90. package/src/launcher/internal/singleFileOutput.ts +133 -0
  91. package/src/launcher/internal/watchTopology.ts +2008 -59
  92. package/src/plugin/internal/loadProjectPlugins.ts +8 -0
  93. package/src/structures/ITtscPluginCapabilities.ts +34 -0
  94. package/src/structures/internal/ITtscProjectInputSnapshot.ts +29 -0
  95. package/src/structures/internal/TtscSingleFileEmitOptions.ts +5 -0
@@ -65,6 +65,7 @@ export function loadProjectPlugins(options: {
65
65
  entries?: readonly ITtscProjectPluginConfig[] | false;
66
66
  env?: NodeJS.ProcessEnv;
67
67
  file?: string;
68
+ onWatchInputs?: (inputs: readonly string[]) => void;
68
69
  pluginConfigDir?: string;
69
70
  projectRoot?: string;
70
71
  tsconfig?: string;
@@ -86,6 +87,7 @@ export function loadProjectPlugins(options: {
86
87
  (entry) => entry.config.enabled !== false,
87
88
  );
88
89
  if (entries.length === 0) {
90
+ options.onWatchInputs?.([]);
89
91
  return {
90
92
  nativePlugins: [],
91
93
  project,
@@ -150,6 +152,12 @@ export function loadProjectPlugins(options: {
150
152
  stage,
151
153
  };
152
154
  });
155
+ options.onWatchInputs?.(
156
+ records.flatMap((record) => [
157
+ record.source,
158
+ ...(record.contributors?.map((contributor) => contributor.source) ?? []),
159
+ ]),
160
+ );
153
161
  const linkedContributors = records
154
162
  .filter((record) => record.stage === "transform")
155
163
  .flatMap((record) =>
@@ -46,6 +46,40 @@ export interface ITtscPluginCapabilities {
46
46
  */
47
47
  projectContextArgs?: boolean;
48
48
 
49
+ /**
50
+ * Whether the LSP sidecar implements the standalone `lsp-project-diagnostics`
51
+ * command.
52
+ *
53
+ * The command evaluates project rules without an open document. It is
54
+ * independent of `projectInputs`, which publishes only filesystem topology.
55
+ *
56
+ * @default false
57
+ */
58
+ projectDiagnostics?: boolean;
59
+
60
+ /**
61
+ * Whether the sidecar implements the `project-inputs` command. The command
62
+ * publishes normalized exact paths and glob populations declared by enabled
63
+ * project rules without loading a TypeScript Program.
64
+ *
65
+ * @default false
66
+ */
67
+ projectInputs?: boolean;
68
+
69
+ /**
70
+ * Whether the check-stage sidecar implements the newline-delimited
71
+ * `check-serve` protocol used by `ttsc check --watch`.
72
+ *
73
+ * A resident check host keeps one no-emit TypeScript Program across
74
+ * compatible source and declared external-input changes while constructing a
75
+ * fresh rule engine and reporter for every request. The launcher retains the
76
+ * spawn-per-cycle path when this capability is absent and never uses it for
77
+ * transform or emit work.
78
+ *
79
+ * @default false
80
+ */
81
+ residentCheck?: boolean;
82
+
49
83
  /**
50
84
  * Whether the sidecar accepts `--singleThreaded` and `--checkers` on its
51
85
  * command line. The lint sidecar parses both flags via `parseSubcommandFlags`
@@ -0,0 +1,29 @@
1
+ /** Normalized local filesystem dependencies published by project rules. */
2
+ export interface ITtscProjectInputSnapshot {
3
+ /** Exact absolute paths, retained even while missing. */
4
+ files: readonly string[];
5
+ /** Absolute glob patterns using forward-slash separators. */
6
+ globs: readonly string[];
7
+ /** Exact paths whose change invalidates plugin/execution selection. */
8
+ reloadFiles?: readonly string[];
9
+ /** Directories whose immediate topology changes execution selection. */
10
+ reloadDirectories?: readonly string[];
11
+ /** Physical project root that anchored relative declarations. */
12
+ root: string;
13
+ /**
14
+ * The spellings the contributors published, before identity normalization.
15
+ *
16
+ * Normalizing a declaration resolves it through every symlink on its way, so
17
+ * the retained snapshot names the file the link currently points at rather
18
+ * than the link. That is what every comparison needs and the wrong thing to
19
+ * watch: retargeting or replacing the link is exactly what decides which
20
+ * bytes the declaration names next, and it happens at the spelling that
21
+ * normalization discarded. Consumers that install watchers keep both.
22
+ */
23
+ declared?: {
24
+ files: readonly string[];
25
+ globs: readonly string[];
26
+ reloadFiles?: readonly string[];
27
+ reloadDirectories?: readonly string[];
28
+ };
29
+ }
@@ -1,3 +1,4 @@
1
+ import type { ITtscProjectInputSnapshot } from "./ITtscProjectInputSnapshot";
1
2
  import type { TtscCommonOptions } from "./TtscCommonOptions";
2
3
 
3
4
  /** Internal options for emitting one source file through the file-argument path. */
@@ -10,4 +11,8 @@ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
10
11
  out?: string;
11
12
  /** Suppress summary banners from ttsc/native sidecars. Defaults to `true`. */
12
13
  quiet?: boolean;
14
+ /** Receive native-plugin source roots when a watch owns this invocation. */
15
+ onWatchInputs?: (inputs: readonly string[]) => void;
16
+ /** Receive project-rule filesystem inputs when a watch owns this invocation. */
17
+ onProjectInputs?: (inputs: ITtscProjectInputSnapshot) => void;
13
18
  }