ttsc 0.19.3 → 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.
Files changed (170) hide show
  1. package/README.md +7 -5
  2. package/cmd/graphdump/main.go +2 -4
  3. package/cmd/ttsc/filter.go +12 -4
  4. package/cmd/ttsc/filter_resolves_flag_names_case_insensitively_test.go +53 -0
  5. package/cmd/ttsc/flags_gen.go +3 -3
  6. package/cmd/ttscgraph/dump.go +5 -7
  7. package/cmd/ttscgraph/run_dump_emits_only_checker_verified_member_relations_test.go +118 -0
  8. package/cmd/ttscgraph/serve.go +58 -308
  9. package/cmd/ttscgraph/serve_session_keeps_base_url_fallback_unchanged_test.go +49 -0
  10. package/cmd/ttscgraph/serve_session_keeps_esm_directory_candidate_unchanged_test.go +61 -0
  11. package/cmd/ttscgraph/serve_session_keeps_exports_blocked_file_candidates_unchanged_test.go +64 -0
  12. package/cmd/ttscgraph/serve_session_keeps_inactive_conditional_export_unchanged_test.go +66 -0
  13. package/cmd/ttscgraph/serve_session_keeps_lower_priority_module_candidate_unchanged_test.go +67 -0
  14. package/cmd/ttscgraph/serve_session_keeps_lower_priority_paths_pattern_unchanged_test.go +58 -0
  15. package/cmd/ttscgraph/serve_session_keeps_nonlongest_root_dirs_candidate_unchanged_test.go +54 -0
  16. package/cmd/ttscgraph/serve_session_reloads_commonjs_package_entry_for_esm_test.go +50 -0
  17. package/cmd/ttscgraph/serve_session_reloads_module_suffix_candidate_test.go +41 -0
  18. package/cmd/ttscgraph/serve_session_reloads_superseding_module_candidates_test.go +216 -0
  19. package/cmd/ttscgraph/serve_session_retries_failed_dump_test.go +103 -0
  20. package/driver/graph.go +12 -6
  21. package/driver/lsp.go +30 -0
  22. package/driver/program.go +37 -1
  23. package/driver/resolution_candidates.go +819 -0
  24. package/driver/windowsjunction/windowsjunction.go +40 -0
  25. package/go.mod +2 -0
  26. package/internal/graph/build.go +45 -11
  27. package/internal/graph/dump.go +276 -100
  28. package/internal/graph/dump_checkout_paths_are_stable_test.go +210 -0
  29. package/internal/graph/dump_diagnostics_ride_the_generation_that_built_it_test.go +9 -3
  30. package/internal/graph/dump_paths.go +172 -0
  31. package/internal/graph/dump_paths_are_portable_and_injective_test.go +93 -0
  32. package/internal/graph/dump_uses_ecma_line_terminators_test.go +87 -0
  33. package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +61 -0
  34. package/internal/graph/edges.go +208 -0
  35. package/internal/graph/graph.go +143 -5
  36. package/internal/graph/line_model.go +122 -0
  37. package/internal/graph/member_relation_edges_follow_checker_validity_test.go +85 -0
  38. package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +191 -0
  39. package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +119 -0
  40. package/internal/graph/node_ids_preserve_hash_bearing_components_test.go +41 -0
  41. package/internal/graph/node_modifiers_emit_union_strings_test.go +4 -1
  42. package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +192 -0
  43. package/internal/graph/object_member_signatures_preserve_literal_whitespace_test.go +67 -0
  44. package/internal/graph/object_members.go +229 -0
  45. package/internal/graph/provenance.go +88 -30
  46. package/internal/graph/source_texts_cover_every_resident_program_source_test.go +73 -0
  47. package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +66 -0
  48. package/internal/graphsymbols/provider.go +26 -91
  49. package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +144 -0
  50. package/internal/lspserver/lsp_completion.go +109 -0
  51. package/internal/lspserver/lsp_completion_gate_never_refuses_a_matching_line_test.go +50 -0
  52. package/internal/lspserver/lsp_completion_hints_longest_trigger_wins_test.go +149 -0
  53. package/internal/lspserver/lsp_completion_hints_nearest_trigger_wins_test.go +37 -0
  54. package/internal/lspserver/lsp_completion_merges_into_upstream_response_test.go +149 -0
  55. package/internal/lspserver/lsp_completion_nearest_hint_replaces_nearest_filter_test.go +43 -0
  56. package/internal/lspserver/lsp_completion_preserves_completion_list_extensions_test.go +99 -0
  57. package/internal/lspserver/lsp_completion_refuses_hints_inside_a_string_literal_test.go +69 -0
  58. package/internal/lspserver/lsp_completion_replaces_full_filter_in_rank_order_test.go +85 -0
  59. package/internal/lspserver/lsp_completion_request.go +455 -0
  60. package/internal/lspserver/lsp_completion_scope.go +530 -0
  61. package/internal/lspserver/lsp_completion_scope_bench_test.go +41 -0
  62. package/internal/lspserver/lsp_completion_scope_classifies_regex_statement_and_operator_boundaries_test.go +39 -0
  63. package/internal/lspserver/lsp_completion_scope_ignores_jsdoc_bytes_in_literals_test.go +108 -0
  64. package/internal/lspserver/lsp_completion_scope_refuses_regex_hints_test.go +52 -0
  65. package/internal/lspserver/lsp_completion_trigger_uses_last_rune_test.go +24 -0
  66. package/internal/lspserver/lsp_deleted_watched_file_withdraws_plugin_diagnostics_test.go +110 -0
  67. package/internal/lspserver/lsp_didsave_keeps_the_incremental_changed_uri_path_test.go +78 -0
  68. package/internal/lspserver/lsp_hints_absence_is_not_an_error_test.go +46 -0
  69. package/internal/lspserver/lsp_hints_refresh_coalesces_concurrent_requests_test.go +82 -0
  70. package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +40 -0
  71. package/internal/lspserver/lsp_hints_refresh_keeps_each_producer_isolated_test.go +64 -0
  72. package/internal/lspserver/lsp_hints_refresh_replaces_the_session_snapshot_test.go +66 -0
  73. package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +90 -0
  74. package/internal/lspserver/lsp_hints_refresh_serves_completion_while_running_test.go +91 -0
  75. package/internal/lspserver/lsp_index_byte_from_bounds_its_search_start_test.go +38 -0
  76. package/internal/lspserver/lsp_initialize_constrains_position_encoding_to_utf16_test.go +205 -0
  77. package/internal/lspserver/lsp_late_completion_trigger_is_reported_once_test.go +105 -0
  78. package/internal/lspserver/lsp_native_completion_hints_decode_flat_lint_wire_test.go +66 -0
  79. package/internal/lspserver/lsp_native_completion_hints_grouped_compatibility_boundary_test.go +60 -0
  80. package/internal/lspserver/lsp_native_plugin_source.go +315 -2
  81. package/internal/lspserver/lsp_native_resident.go +304 -0
  82. package/internal/lspserver/lsp_plugin.go +85 -8
  83. package/internal/lspserver/lsp_plugin_completion_resolve_stays_local_test.go +82 -0
  84. package/internal/lspserver/lsp_position_conversions_span_astral_and_combining_runes_test.go +119 -0
  85. package/internal/lspserver/lsp_proxy.go +601 -9
  86. package/internal/lspserver/lsp_refresh.go +70 -0
  87. package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +43 -0
  88. package/internal/lspserver/lsp_resident_maps_verb_args_test.go +34 -0
  89. package/internal/lspserver/lsp_server.go +13 -1
  90. package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +172 -0
  91. package/lib/TtscCompiler.d.ts +3 -1
  92. package/lib/TtscCompiler.js +5 -1
  93. package/lib/TtscCompiler.js.map +1 -1
  94. package/lib/TtscService.d.ts +13 -3
  95. package/lib/TtscService.js +6 -6
  96. package/lib/TtscService.js.map +1 -1
  97. package/lib/compiler/internal/project/readConfigJson.d.ts +30 -0
  98. package/lib/compiler/internal/project/readConfigJson.js +208 -0
  99. package/lib/compiler/internal/project/readConfigJson.js.map +1 -0
  100. package/lib/compiler/internal/project/readProjectConfig.js +53 -149
  101. package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
  102. package/lib/compiler/internal/residentTransformProcess.d.ts +15 -2
  103. package/lib/compiler/internal/residentTransformProcess.js +159 -39
  104. package/lib/compiler/internal/residentTransformProcess.js.map +1 -1
  105. package/lib/compiler/internal/runBuild.d.ts +6 -0
  106. package/lib/compiler/internal/runBuild.js +143 -44
  107. package/lib/compiler/internal/runBuild.js.map +1 -1
  108. package/lib/compiler/internal/startResidentTransform.d.ts +5 -1
  109. package/lib/compiler/internal/startResidentTransform.js +3 -1
  110. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  111. package/lib/compiler/internal/transformProjectInMemory.js +12 -2
  112. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  113. package/lib/flags/parser.d.ts +19 -0
  114. package/lib/flags/parser.js +78 -36
  115. package/lib/flags/parser.js.map +1 -1
  116. package/lib/flags/schema.d.ts +49 -11
  117. package/lib/flags/schema.js +94 -22
  118. package/lib/flags/schema.js.map +1 -1
  119. package/lib/internal/assertSafeExplicitCacheDirectory.d.ts +5 -0
  120. package/lib/internal/assertSafeExplicitCacheDirectory.js +26 -0
  121. package/lib/internal/assertSafeExplicitCacheDirectory.js.map +1 -0
  122. package/lib/launcher/internal/runTtsc.js +107 -69
  123. package/lib/launcher/internal/runTtsc.js.map +1 -1
  124. package/lib/launcher/internal/runTtsx.js +28 -41
  125. package/lib/launcher/internal/runTtsx.js.map +1 -1
  126. package/lib/launcher/internal/runtimeHooks.d.ts +15 -0
  127. package/lib/launcher/internal/runtimeHooks.js +18 -1
  128. package/lib/launcher/internal/runtimeHooks.js.map +1 -1
  129. package/lib/launcher/internal/watchTopology.d.ts +43 -0
  130. package/lib/launcher/internal/watchTopology.js +360 -0
  131. package/lib/launcher/internal/watchTopology.js.map +1 -0
  132. package/lib/plugin/internal/buildSourcePlugin.d.ts +14 -3
  133. package/lib/plugin/internal/buildSourcePlugin.js +247 -61
  134. package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
  135. package/lib/plugin/internal/loadProjectPlugins.js +63 -2
  136. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
  137. package/lib/structures/ITtscCompilerTransformation.d.ts +16 -0
  138. package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +2 -0
  139. package/package.json +8 -8
  140. package/shim/ast/shim.go +48 -3
  141. package/shim/astnav/go.mod +14 -0
  142. package/shim/astnav/go.sum +20 -0
  143. package/shim/astnav/shim.go +15 -0
  144. package/shim/checker/shim.go +100 -0
  145. package/shim/core/shim.go +47 -0
  146. package/shim/diagnosticwriter/lint.go +50 -0
  147. package/src/TtscCompiler.ts +5 -1
  148. package/src/TtscService.ts +37 -10
  149. package/src/compiler/internal/project/readConfigJson.ts +209 -0
  150. package/src/compiler/internal/project/readProjectConfig.ts +62 -158
  151. package/src/compiler/internal/residentTransformProcess.ts +197 -39
  152. package/src/compiler/internal/runBuild.ts +169 -47
  153. package/src/compiler/internal/startResidentTransform.ts +12 -1
  154. package/src/compiler/internal/transformProjectInMemory.ts +12 -1
  155. package/src/flags/parser.ts +113 -42
  156. package/src/flags/schema.ts +113 -31
  157. package/src/internal/assertSafeExplicitCacheDirectory.ts +29 -0
  158. package/src/launcher/internal/runTtsc.ts +117 -68
  159. package/src/launcher/internal/runTtsx.ts +29 -44
  160. package/src/launcher/internal/runtimeHooks.ts +30 -2
  161. package/src/launcher/internal/watchTopology.ts +466 -0
  162. package/src/plugin/internal/buildSourcePlugin.ts +326 -64
  163. package/src/plugin/internal/loadProjectPlugins.ts +80 -2
  164. package/src/structures/ITtscCompilerTransformation.ts +17 -0
  165. package/src/structures/internal/ITtscParsedProjectConfig.ts +2 -0
  166. package/tools/shim_audit/baseline.json +0 -3
  167. package/tools/shim_audit/main.go +42 -14
  168. package/tools/shim_audit/shim_dir_coverage_test.go +25 -0
  169. package/utility/flags_gen.go +3 -3
  170. package/utility/host.go +9 -3
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResidentTransformProcess = void 0;
4
+ exports.normalizeRequestTimeoutMs = normalizeRequestTimeoutMs;
4
5
  const node_child_process_1 = require("node:child_process");
5
6
  const node_readline_1 = require("node:readline");
6
7
  /** Cap on retained stderr so a long-lived host cannot grow it without bound. */
7
8
  const STDERR_TAIL_LIMIT = 64 * 1024;
8
9
  /** Cap on how much of an offending line an error message echoes back. */
9
10
  const REPLY_ECHO_LIMIT = 200;
11
+ /** Default deadline for one request to the resident transform host. */
12
+ const DEFAULT_REQUEST_TIMEOUT_MS = 300_000;
13
+ /** Node clamps timers beyond this signed 32-bit millisecond duration. */
14
+ const MAX_TIMER_MS = 2_147_483_647;
15
+ /** Allow a cooperative host a short shutdown window before forcing it down. */
16
+ const TERMINATION_GRACE_MS = 1_000;
10
17
  /**
11
18
  * Async client for the long-lived `utility-host serve` process.
12
19
  *
@@ -25,9 +32,11 @@ class ResidentTransformProcess {
25
32
  child;
26
33
  reader;
27
34
  pending = [];
35
+ requestTimeoutMs;
28
36
  stderr = "";
29
37
  failure;
30
38
  constructor(options) {
39
+ this.requestTimeoutMs = normalizeRequestTimeoutMs(options.requestTimeoutMs);
31
40
  // Default stdio is "pipe" for stdin/stdout/stderr, which is exactly what the
32
41
  // line protocol needs; spelling it out as a string[] would not narrow to
33
42
  // StdioOptions, so it is left implicit.
@@ -73,23 +82,60 @@ class ResidentTransformProcess {
73
82
  * when the host has already failed or exited, or if writing the request
74
83
  * fails.
75
84
  */
76
- request(payload, kind) {
85
+ request(payload, kind, options = {}) {
77
86
  if (this.failure !== undefined) {
78
87
  return Promise.reject(this.failure);
79
88
  }
89
+ if (options.signal?.aborted) {
90
+ return Promise.reject(cancelledError(options.signal));
91
+ }
80
92
  const stdin = this.child.stdin;
81
93
  if (stdin === null || stdin.destroyed) {
82
94
  return Promise.reject(new Error("ttsc: resident transform host stdin is closed"));
83
95
  }
96
+ let line;
97
+ try {
98
+ line = `${JSON.stringify(payload)}\n`;
99
+ }
100
+ catch (error) {
101
+ return Promise.reject(asError(error));
102
+ }
84
103
  return new Promise((resolve, reject) => {
85
- const pending = { kind, reject, resolve };
104
+ let pending;
105
+ pending = {
106
+ kind,
107
+ reject,
108
+ resolve,
109
+ settled: false,
110
+ signal: options.signal,
111
+ timer: setTimeout(() => this.timeout(pending), this.requestTimeoutMs),
112
+ };
113
+ pending.timer.unref();
114
+ if (options.signal !== undefined) {
115
+ pending.abort = () => this.cancel(pending, options.signal);
116
+ options.signal.addEventListener("abort", pending.abort, { once: true });
117
+ }
86
118
  this.pending.push(pending);
87
- stdin.write(`${JSON.stringify(payload)}\n`, (error) => {
88
- if (error) {
89
- this.removePending(pending);
90
- reject(error);
91
- }
92
- });
119
+ if (options.signal?.aborted) {
120
+ pending.abort();
121
+ return;
122
+ }
123
+ try {
124
+ stdin.write(line, (error) => {
125
+ if (error === null || error === undefined || pending.settled) {
126
+ return;
127
+ }
128
+ this.settlePending(pending, error);
129
+ this.fail(new Error(`ttsc: resident transform host could not write a request: ${error.message}`));
130
+ });
131
+ }
132
+ catch (error) {
133
+ if (pending.settled)
134
+ return;
135
+ const reason = asError(error);
136
+ this.settlePending(pending, reason);
137
+ this.fail(new Error(`ttsc: resident transform host could not write a request: ${reason.message}`));
138
+ }
93
139
  });
94
140
  }
95
141
  /**
@@ -97,30 +143,22 @@ class ResidentTransformProcess {
97
143
  * call more than once.
98
144
  */
99
145
  dispose() {
100
- if (this.failure === undefined) {
101
- // If the host already died, reject with its real exit error (stderr +
102
- // exit code) rather than a bland "disposed" message.
103
- this.failure =
104
- this.child.exitCode !== null || this.child.signalCode !== null
105
- ? this.exitError()
106
- : new Error("ttsc: resident transform host disposed");
107
- }
108
- const stdin = this.child.stdin;
109
- if (stdin !== null && !stdin.destroyed) {
110
- stdin.end();
111
- }
112
- this.reader.close();
113
- this.rejectAll(this.failure);
114
- if (this.child.exitCode === null && this.child.signalCode === null) {
115
- this.child.kill();
116
- }
146
+ if (this.failure !== undefined)
147
+ return;
148
+ // If the host already died, reject with its real exit error (stderr + exit
149
+ // code) rather than a bland "disposed" message.
150
+ this.fail(this.child.exitCode !== null || this.child.signalCode !== null
151
+ ? this.exitError()
152
+ : new Error("ttsc: resident transform host disposed"));
117
153
  }
118
154
  onLine(line) {
155
+ if (this.failure !== undefined)
156
+ return;
119
157
  const trimmed = line.trim();
120
158
  if (trimmed.length === 0) {
121
159
  return;
122
160
  }
123
- const request = this.pending.shift();
161
+ const request = this.pending[0];
124
162
  if (request === undefined) {
125
163
  // The host must emit exactly one reply per request, so an unmatched line
126
164
  // is a protocol violation that would desync every later reply into the
@@ -140,7 +178,7 @@ class ResidentTransformProcess {
140
178
  // with a later request. `fail` marks the failure so that trailing line is
141
179
  // treated as benign instead of unsolicited.
142
180
  const error = new Error(`ttsc: resident transform host sent a malformed reply: ${echoLine(trimmed)}`);
143
- request.reject(error);
181
+ this.settlePending(request, error);
144
182
  this.fail(error);
145
183
  return;
146
184
  }
@@ -150,31 +188,82 @@ class ResidentTransformProcess {
150
188
  // line consumed exactly one slot — so only this request is corrupt; later
151
189
  // replies still pair correctly. Reject just this request instead of
152
190
  // failing the whole process.
153
- request.reject(new Error(`ttsc: resident transform host sent an invalid ${request.kind} reply: ${echoLine(trimmed)}`));
191
+ this.settlePending(request, new Error(`ttsc: resident transform host sent an invalid ${request.kind} reply: ${echoLine(trimmed)}`));
154
192
  return;
155
193
  }
156
- request.resolve(reply);
194
+ this.settlePending(request, reply);
157
195
  }
158
196
  onReaderClose() {
159
- if (this.pending.length === 0) {
160
- return;
161
- }
162
- this.rejectAll(this.failure ?? this.exitError());
197
+ if (this.failure === undefined)
198
+ this.fail(this.exitError());
163
199
  }
164
200
  fail(error) {
165
- this.failure ??= error;
166
- this.rejectAll(this.failure);
201
+ if (this.failure !== undefined)
202
+ return;
203
+ this.failure = error;
204
+ this.rejectAll(error);
205
+ this.terminate();
167
206
  }
168
207
  rejectAll(error) {
169
208
  while (this.pending.length !== 0) {
170
- this.pending.shift().reject(error);
209
+ this.settlePending(this.pending[0], error);
171
210
  }
172
211
  }
173
- removePending(target) {
174
- const index = this.pending.indexOf(target);
175
- if (index !== -1) {
212
+ settlePending(pending, result) {
213
+ if (pending.settled)
214
+ return;
215
+ pending.settled = true;
216
+ const index = this.pending.indexOf(pending);
217
+ if (index !== -1)
176
218
  this.pending.splice(index, 1);
219
+ clearTimeout(pending.timer);
220
+ if (pending.signal !== undefined && pending.abort !== undefined) {
221
+ pending.signal.removeEventListener("abort", pending.abort);
222
+ }
223
+ if (result instanceof Error)
224
+ pending.reject(result);
225
+ else
226
+ pending.resolve(result);
227
+ }
228
+ timeout(pending) {
229
+ if (pending.settled)
230
+ return;
231
+ const timeout = new Error(`ttsc: resident transform request timed out after ${String(this.requestTimeoutMs)} ms${stderrSuffix(this.stderr)}`);
232
+ this.settlePending(pending, timeout);
233
+ this.fail(new Error(`ttsc: resident transform host retired after another request timed out${stderrSuffix(this.stderr)}`));
234
+ }
235
+ cancel(pending, signal) {
236
+ if (pending.settled)
237
+ return;
238
+ this.settlePending(pending, cancelledError(signal));
239
+ this.fail(new Error(`ttsc: resident transform host retired after another request was cancelled${abortDetail(signal)}${stderrSuffix(this.stderr)}`));
240
+ }
241
+ terminate() {
242
+ const stdin = this.child.stdin;
243
+ if (stdin !== null && !stdin.destroyed)
244
+ stdin.destroy();
245
+ if (this.child.exitCode !== null || this.child.signalCode !== null)
246
+ return;
247
+ try {
248
+ this.child.kill();
177
249
  }
250
+ catch {
251
+ // The host exited between the liveness check and termination.
252
+ return;
253
+ }
254
+ const force = setTimeout(() => {
255
+ if (this.child.exitCode !== null || this.child.signalCode !== null) {
256
+ return;
257
+ }
258
+ try {
259
+ this.child.kill("SIGKILL");
260
+ }
261
+ catch {
262
+ // The host exited between the liveness check and the forced signal.
263
+ }
264
+ }, TERMINATION_GRACE_MS);
265
+ force.unref();
266
+ this.child.once("exit", () => clearTimeout(force));
178
267
  }
179
268
  exitError() {
180
269
  const detail = this.stderr.trim();
@@ -190,6 +279,37 @@ class ResidentTransformProcess {
190
279
  }
191
280
  }
192
281
  exports.ResidentTransformProcess = ResidentTransformProcess;
282
+ /** Validate and normalize the caller-visible resident request deadline. */
283
+ function normalizeRequestTimeoutMs(requestTimeoutMs) {
284
+ const value = requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
285
+ if (!Number.isSafeInteger(value) || value <= 0 || value > MAX_TIMER_MS) {
286
+ throw new TypeError(`ttsc: requestTimeoutMs must be an integer between 1 and ${String(MAX_TIMER_MS)}`);
287
+ }
288
+ return value;
289
+ }
290
+ function cancelledError(signal) {
291
+ const error = new Error(`ttsc: resident transform request cancelled${abortDetail(signal)}`);
292
+ error.name = "AbortError";
293
+ return error;
294
+ }
295
+ function abortDetail(signal) {
296
+ const reason = signal.reason;
297
+ if (reason === undefined)
298
+ return "";
299
+ try {
300
+ return `: ${reason instanceof Error ? reason.message : String(reason)}`;
301
+ }
302
+ catch {
303
+ return "";
304
+ }
305
+ }
306
+ function stderrSuffix(stderr) {
307
+ const detail = stderr.trim();
308
+ return detail.length === 0 ? "" : `: ${detail}`;
309
+ }
310
+ function asError(error) {
311
+ return error instanceof Error ? error : new Error(String(error));
312
+ }
193
313
  /**
194
314
  * Parse one reply line into a plain object, or `undefined` when the line is not
195
315
  * a JSON object. Invalid JSON, arrays, primitives, and `null` all yield
@@ -1 +1 @@
1
- {"version":3,"file":"residentTransformProcess.js","sourceRoot":"","sources":["../../../src/compiler/internal/residentTransformProcess.ts"],"names":[],"mappings":";;;AAAA,2DAA8D;AAC9D,iDAAgE;AAEhE,gFAAgF;AAChF,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpC,yEAAyE;AACzE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AA0B7B;;;;;;;;;;;;;GAaG;AACH;IACmB,KAAK,CAAe;IACpB,MAAM,CAAY;IAClB,OAAO,GAAqB,EAAE,CAAC;IACxC,MAAM,GAAG,EAAE,CAAC;IACZ,OAAO,CAAoB;IAEnC,YAAmB,OAAwC;QACzD,6EAA6E;QAC7E,yEAAyE;QACzE,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAA,0BAAK,EAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE;YACpD,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC/B,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,EAA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;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,KAA8B,EAC9B,IAAuB;IAEvB,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC;AAC5C,CAAC;AAED,uEAAuE;AACvE,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,MAAM,GAAG,gBAAgB;QACnC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG;QACvC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
1
+ {"version":3,"file":"residentTransformProcess.js","sourceRoot":"","sources":["../../../src/compiler/internal/residentTransformProcess.ts"],"names":[],"mappings":";;;;AAAA,2DAA8D;AAC9D,iDAAgE;AAEhE,gFAAgF;AAChF,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpC,yEAAyE;AACzE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,uEAAuE;AACvE,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAE3C,yEAAyE;AACzE,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,+EAA+E;AAC/E,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAsCnC;;;;;;;;;;;;;GAaG;AACH;IACmB,KAAK,CAAe;IACpB,MAAM,CAAY;IAClB,OAAO,GAAqB,EAAE,CAAC;IAC/B,gBAAgB,CAAS;IAClC,MAAM,GAAG,EAAE,CAAC;IACZ,OAAO,CAAoB;IAEnC,YAAmB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MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5E,OAAO,MAAiC,CAAC;IAC3C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,KAA8B,EAC9B,IAAuB;IAEvB,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC;AAC5C,CAAC;AAED,uEAAuE;AACvE,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,MAAM,GAAG,gBAAgB;QACnC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG;QACvC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -5,6 +5,12 @@ import type { TtscBuildResult } from "../../structures/internal/TtscBuildResult"
5
5
  type RunBuildOptions = TtscBuildOptions & {
6
6
  skipDiagnosticsCheck?: boolean;
7
7
  forceListEmittedFiles?: boolean;
8
+ /**
9
+ * Receives selected native-plugin source roots after the project resolves.
10
+ * The watch launcher uses these roots to invalidate a sidecar when its Go
11
+ * implementation changes between rebuilds.
12
+ */
13
+ onWatchInputs?: (inputs: readonly string[]) => void;
8
14
  /**
9
15
  * Emit an external source map from the direct tsgo build lane even when the
10
16
  * project configures none. Set by the ttsx runtime builds so a served emit
@@ -45,15 +45,18 @@ function hasEnabledPassthroughFlag(options, flag) {
45
45
  const passthrough = options.passthrough ?? [];
46
46
  for (let i = 0; i < passthrough.length; i++) {
47
47
  const token = passthrough[i];
48
- if (token.startsWith(`${flag}=`)) {
49
- return token.slice(flag.length + 1).toLowerCase() !== "false";
48
+ // Identity, not spelling: the user forwards their own casing and ttsc must
49
+ // read `--DIAGNOSTICS` the way tsgo does.
50
+ if ((0, schema_1.resolveFlagSpec)(token)?.name !== flag)
51
+ continue;
52
+ const equalsIndex = token.indexOf("=");
53
+ if (equalsIndex !== -1) {
54
+ return token.slice(equalsIndex + 1).toLowerCase() !== "false";
50
55
  }
51
- if (token === flag) {
52
- if (i + 1 < passthrough.length && isBooleanLiteral(passthrough[i + 1])) {
53
- return passthrough[i + 1].toLowerCase() !== "false";
54
- }
55
- return true;
56
+ if (i + 1 < passthrough.length && isBooleanLiteral(passthrough[i + 1])) {
57
+ return passthrough[i + 1].toLowerCase() !== "false";
56
58
  }
59
+ return true;
57
60
  }
58
61
  return false;
59
62
  }
@@ -131,8 +134,15 @@ function runBuild(options = {}) {
131
134
  return appendTimingOutput(result, timing);
132
135
  }
133
136
  function runBuildTimed(options, timing) {
137
+ const projectFree = runProjectFreeTerminalFlag(options);
138
+ if (projectFree !== null)
139
+ return projectFree;
134
140
  const setupStartedAt = process.hrtime.bigint();
135
141
  const execution = resolveExecutionContext(options);
142
+ options.onWatchInputs?.(execution.nativePlugins.flatMap((plugin) => [
143
+ plugin.source,
144
+ ...(plugin.contributors?.map((contributor) => contributor.source) ?? []),
145
+ ]));
136
146
  if (execution.nativePlugins.length > 0 ||
137
147
  execution.pluginSetupFailure !== undefined) {
138
148
  recordTiming(timing, "ttsc plugin setup time", setupStartedAt);
@@ -217,14 +227,70 @@ function runBuildTimed(options, timing) {
217
227
  };
218
228
  }
219
229
  const args = createTsgoBuildArgs(execution, buildOptions, {
230
+ // `--verbose` promises the emitted-file list on every lane, and the list
231
+ // only exists if tsgo is asked for it. ttsc adds the flag for itself here
232
+ // exactly as it does for `forceListEmittedFiles`, and strips the raw
233
+ // `TSFILE:` lines back out below.
220
234
  listEmittedFiles: buildOptions.emit !== false &&
221
- buildOptions.forceListEmittedFiles === true,
235
+ (buildOptions.forceListEmittedFiles === true ||
236
+ buildOptions.quiet === false),
222
237
  noEmitOnError: buildOptions.emit !== false &&
223
238
  buildOptions.skipDiagnosticsCheck !== true &&
224
239
  !forwardsTerminalTsgoFlag(buildOptions),
225
240
  });
226
241
  return runTsgoBuild(execution, buildOptions, args);
227
242
  }
243
+ /**
244
+ * Answer a forwarded terminal flag whose meaning precedes a project, when no
245
+ * project can be resolved.
246
+ *
247
+ * `ttsc --init` exists to write the starter `tsconfig.json`, and `ttsc --all` /
248
+ * `ttsc -?` only print tsgo's help — none of them needs a project, yet all
249
+ * three died in project resolution because that layer ran first and
250
+ * unconditionally. The classification is `FLAG_SCHEMA`'s (`terminal` +
251
+ * `projectFree`), so marking a further flag project-free needs no edit here.
252
+ *
253
+ * A resolvable project keeps the established lane untouched: the build path
254
+ * still forwards the flag with `-p <tsconfig>` from the project root, so `ttsc
255
+ * --init` inside an existing project still reports tsgo's TS5054 instead of
256
+ * writing a second config into the current directory. Returns `null` when this
257
+ * lane does not apply.
258
+ */
259
+ function runProjectFreeTerminalFlag(options) {
260
+ if (!forwardsProjectFreeTerminalTsgoFlag(options))
261
+ return null;
262
+ if (options.resolvedProject !== undefined)
263
+ return null;
264
+ const cwd = node_path_1.default.resolve(options.cwd ?? process.cwd());
265
+ try {
266
+ (0, readProjectConfig_1.readProjectConfig)({
267
+ cwd,
268
+ projectRoot: options.projectRoot,
269
+ tsconfig: options.tsconfig,
270
+ });
271
+ return null;
272
+ }
273
+ catch {
274
+ // Any resolution failure takes this branch, not only "not found": a
275
+ // malformed config and an explicitly named missing `-p` path are equally
276
+ // beside the point for a flag whose meaning does not presuppose a project.
277
+ // Forward it to tsgo from the invocation directory instead of failing.
278
+ }
279
+ const tsgo = (0, resolveTsgo_1.resolveTsgo)({ ...options, cwd });
280
+ const res = (0, spawnNative_1.spawnNative)(tsgo.binary, [...(options.passthrough ?? [])], {
281
+ cwd,
282
+ env: mergeEnv(options.env),
283
+ encoding: "utf8",
284
+ });
285
+ if (res.error) {
286
+ throw new Error(`ttsc: failed to spawn ${tsgo.binary}: ${res.error.message}`);
287
+ }
288
+ return normalizeBuildOutput({
289
+ status: res.status ?? 1,
290
+ stdout: (0, spawnNative_1.outputText)(res.stdout),
291
+ stderr: (0, spawnNative_1.outputText)(res.stderr),
292
+ }, cwd);
293
+ }
228
294
  /**
229
295
  * A tsconfig-level `noEmit: true` is an analysis-only build unless the user
230
296
  * explicitly asks `ttsc --emit` to override it. Treat it like CLI `--noEmit`
@@ -285,13 +351,15 @@ function createPluginFailureTypecheckOptions(options) {
285
351
  const passthrough = [];
286
352
  for (let i = 0; i < (options.passthrough?.length ?? 0); i++) {
287
353
  const token = options.passthrough[i];
288
- if (token === "--pretty") {
289
- if (isBooleanLiteral(options.passthrough[i + 1] ?? ""))
354
+ if ((0, schema_1.resolveFlagSpec)(token)?.name === "--pretty") {
355
+ // `--pretty` is boolean: it owns a following token only when that token
356
+ // is the literal `true`/`false`, and the inline form carries its own.
357
+ if (!token.includes("=") &&
358
+ isBooleanLiteral(options.passthrough[i + 1] ?? "")) {
290
359
  i++;
360
+ }
291
361
  continue;
292
362
  }
293
- if (token.startsWith("--pretty="))
294
- continue;
295
363
  passthrough.push(token);
296
364
  }
297
365
  return {
@@ -360,29 +428,34 @@ function diagnosticHeadline(message) {
360
428
  return message.split(/\r?\n/, 1)[0].trim();
361
429
  }
362
430
  /**
363
- * Tsgo CLI flags that make `tsgo` print something and exit instead of building
364
- * (`--showConfig`, `--listFilesOnly`, `--help`, …). ttsc must not add
365
- * build-only guard flags around these because the forwarded flag asks tsgo to
366
- * print something and exit instead of compiling the project.
431
+ * Report whether the caller forwarded a print-and-exit tsgo flag
432
+ * (`--showConfig`, `--listFilesOnly`, `--all`, `--init`, `-?`), so ttsc can
433
+ * avoid adding compile-only flags to a command that is not going to compile.
367
434
  *
368
- * Schema-derived: the set is computed from `FLAG_SCHEMA[*].terminal === true`,
369
- * not hand-maintained next to runBuild. Adding a new terminal flag now means
370
- * editing `schema.ts` and re-running `pnpm format` — every layer learns about
371
- * it automatically.
435
+ * Schema-derived, and resolved by flag identity rather than by exact spelling:
436
+ * `resolveFlagSpec` applies the one normalization the parsing engine and the
437
+ * generated Go allow-lists use, so `--showconfig` classifies exactly like
438
+ * `--showConfig`. Adding a new terminal flag means editing `schema.ts` and
439
+ * re-running `pnpm run gen:flags`; this predicate needs no edit, and it grows
440
+ * no normalization of its own for the next consumer to forget.
372
441
  */
373
- const TERMINAL_TSGO_FLAGS = (() => {
374
- // Mirror the legacy hand-list: schema's terminal flags ∪ the `-?` alias
375
- // tsgo accepts (kept here because it is a tsgo synonym, not a ttsc flag).
376
- const out = new Set(schema_1.TERMINAL_FLAGS);
377
- out.add("-?");
378
- return out;
379
- })();
442
+ function forwardsTerminalTsgoFlag(options) {
443
+ return (options.passthrough?.some((token) => (0, schema_1.resolveFlagSpec)(token)?.terminal === true) ?? false);
444
+ }
380
445
  /**
381
- * Report whether the caller forwarded a print-and-exit tsgo flag, so ttsc can
382
- * avoid adding compile-only flags to a command that is not going to compile.
446
+ * Report whether the caller forwarded a terminal flag whose meaning does not
447
+ * presuppose a resolved project (`--init`, `--all`, `-?`).
448
+ *
449
+ * Derived from `FLAG_SCHEMA[*].projectFree`, through the same identity
450
+ * resolution as every other classification — never a literal list of flag names
451
+ * beside this branch, which is the shape that let terminal-flag awareness exist
452
+ * in one layer and be missing from the layer above it.
383
453
  */
384
- function forwardsTerminalTsgoFlag(options) {
385
- return (options.passthrough?.some((flag) => TERMINAL_TSGO_FLAGS.has(flag)) ?? false);
454
+ function forwardsProjectFreeTerminalTsgoFlag(options) {
455
+ return (options.passthrough?.some((token) => {
456
+ const flag = (0, schema_1.resolveFlagSpec)(token);
457
+ return flag?.terminal === true && flag.projectFree === true;
458
+ }) ?? false);
386
459
  }
387
460
  /**
388
461
  * Report whether the caller forwarded a flag ttsc adds to tsgo internally —
@@ -397,18 +470,17 @@ function forwardsTerminalTsgoFlag(options) {
397
470
  * against the schema, not one bespoke `if` per shadow flag.
398
471
  */
399
472
  function forwardsInternalShadowFlag(options, flag) {
400
- if (!schema_1.INTERNAL_SHADOW_FLAGS.has(flag))
401
- return false;
402
473
  const passthrough = options.passthrough;
403
474
  if (passthrough === undefined)
404
475
  return false;
405
- // Match both the bare form (`--pretty`) and the inline-value form
406
- // (`--pretty=true`). The launcher's parser preserves these shapes
407
- // verbatim, so a tolerant prefix compare is what we want — `passthrough`
408
- // never holds a stray substring that happens to start with the flag
409
- // because parser positional/passthrough sinks split on whitespace.
410
- const inlinePrefix = `${flag}=`;
411
- return passthrough.some((token) => token === flag || token.startsWith(inlinePrefix));
476
+ // Resolution covers the bare form (`--pretty`), the inline-value form
477
+ // (`--pretty=true`), and every casing tsgo accepts (`--PRETTY`) — the
478
+ // launcher forwards the user's own spelling verbatim, so comparing raw
479
+ // strings would miss a spelling tsgo honours.
480
+ return passthrough.some((token) => {
481
+ const spec = (0, schema_1.resolveFlagSpec)(token);
482
+ return spec?.internalShadow === true && spec.name === flag;
483
+ });
412
484
  }
413
485
  /**
414
486
  * Dispatch a build through the shared-host native plugin. The host plugin is
@@ -482,8 +554,37 @@ function runTsgoBuild(execution, options, args) {
482
554
  if (emittedFiles.length !== 0 && !userListedEmitted) {
483
555
  result.stdout = stripEmittedFileLines(result.stdout);
484
556
  }
557
+ if (options.quiet === false) {
558
+ result.stdout += verboseBuildSummary(execution, options, emittedFiles);
559
+ }
485
560
  return normalizeBuildOutput({ ...result, emittedFiles }, execution.projectRoot);
486
561
  }
562
+ /**
563
+ * The `--verbose` summary for the direct-tsgo lane, in the shape
564
+ * `cmd/ttsc/build.go` already prints on the native-host lane.
565
+ *
566
+ * Verbosity is a launcher-owned presentation concern: which lane `runBuild`
567
+ * selects is an implementation detail the user cannot see, so a documented flag
568
+ * must not change meaning with it. This lane never consumed `quiet` at all,
569
+ * which is why the flag was silent on every project without a ttsc plugin.
570
+ *
571
+ * `sites=0` is a fact about this lane rather than a placeholder: it runs
572
+ * precisely when the project declares no native plugin. A build that emitted
573
+ * nothing prints the header and `emitted=0 files`, so the summary never claims
574
+ * files that were not written.
575
+ */
576
+ function verboseBuildSummary(execution, options, emittedFiles) {
577
+ const lines = [
578
+ `// ttsc: tsconfig=${execution.tsconfig} cwd=${execution.cwd} sites=0 emit=${options.emit !== false}`,
579
+ ];
580
+ if (options.emit !== false) {
581
+ lines.push(`// ttsc: emitted=${emittedFiles.length} files`);
582
+ for (const file of emittedFiles) {
583
+ lines.push(` + ${node_path_1.default.relative(execution.cwd, file) || file}`);
584
+ }
585
+ }
586
+ return `${lines.join("\n")}\n`;
587
+ }
487
588
  /** Build the argument list for a direct `tsgo` build invocation. */
488
589
  function createTsgoBuildArgs(execution, options, flags) {
489
590
  const args = ["-p", execution.tsconfig];
@@ -710,10 +811,8 @@ function nativeTsgoPassthroughArgs(options) {
710
811
  return out;
711
812
  }
712
813
  function isDiagnosticsPassthroughFlag(token) {
713
- return (token === "--diagnostics" ||
714
- token.startsWith("--diagnostics=") ||
715
- token === "--extendedDiagnostics" ||
716
- token.startsWith("--extendedDiagnostics="));
814
+ const name = (0, schema_1.resolveFlagSpec)(token)?.name;
815
+ return name === "--diagnostics" || name === "--extendedDiagnostics";
717
816
  }
718
817
  function isBooleanLiteral(token) {
719
818
  const normalized = token.toLowerCase();