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.
- package/cmd/ttscserver/main.go +79 -3
- package/cmd/ttscserver/run_lsp_uses_native_plugin_manifest_source_test.go +96 -16
- package/driver/lsp.go +4 -0
- package/internal/lspserver/lsp_document_diagnostics_omits_cached_project_when_current_result_has_none_test.go +48 -0
- package/internal/lspserver/lsp_executable_project_input_change_requests_launcher_restart_test.go +98 -0
- package/internal/lspserver/lsp_external_watched_change_retains_program_test.go +53 -0
- package/internal/lspserver/lsp_hints_refresh_scheduled_by_editor_events_test.go +9 -0
- package/internal/lspserver/lsp_native_plugin_source.go +171 -55
- package/internal/lspserver/lsp_native_resident.go +110 -9
- package/internal/lspserver/lsp_plugin.go +6 -0
- package/internal/lspserver/lsp_project_context_transport_identity_test.go +43 -0
- package/internal/lspserver/lsp_project_diagnostics.go +235 -0
- package/internal/lspserver/lsp_project_diagnostics_capability_is_independent_test.go +67 -0
- package/internal/lspserver/lsp_project_diagnostics_program_input_overlap_refreshes_all_producers_test.go +78 -0
- package/internal/lspserver/lsp_project_diagnostics_refresh_accumulates_owner_freshness_test.go +65 -0
- package/internal/lspserver/lsp_project_diagnostics_refresh_keeps_each_producer_last_good_test.go +90 -0
- package/internal/lspserver/lsp_project_diagnostics_refreshes_only_input_owners_test.go +62 -0
- package/internal/lspserver/lsp_project_diagnostics_resident_unsupported_falls_back_test.go +123 -0
- package/internal/lspserver/lsp_project_diagnostics_resume_preserves_generation_test.go +52 -0
- package/internal/lspserver/lsp_project_diagnostics_translates_relative_client_project_test.go +90 -0
- package/internal/lspserver/lsp_project_input_ownership_resolves_declared_spellings_test.go +95 -0
- package/internal/lspserver/lsp_project_input_registration.go +504 -0
- package/internal/lspserver/lsp_project_input_registration_rechecks_selection_baseline_test.go +71 -0
- package/internal/lspserver/lsp_project_input_registration_reconciles_rejected_pending_request_test.go +268 -0
- package/internal/lspserver/lsp_project_input_registration_shapes_patterns_test.go +94 -0
- package/internal/lspserver/lsp_project_input_watchers_anchor_missing_paths_test.go +48 -0
- package/internal/lspserver/lsp_project_inputs.go +944 -0
- package/internal/lspserver/lsp_project_inputs_match_missing_exact_and_glob_test.go +129 -0
- package/internal/lspserver/lsp_project_inputs_reject_invalid_and_foreign_snapshots_test.go +110 -0
- package/internal/lspserver/lsp_proxy.go +591 -28
- package/internal/lspserver/lsp_reload_directories_compare_immediate_topology_test.go +188 -0
- package/internal/lspserver/lsp_reload_file_fingerprint_preserves_raw_symlink_target_test.go +47 -0
- package/internal/lspserver/lsp_resident_falls_back_when_serve_unsupported_test.go +1 -1
- package/internal/lspserver/lsp_resident_invalidation_broadcasts_program_input_overlap_test.go +60 -0
- package/internal/lspserver/lsp_resident_invalidation_targets_project_input_owners_test.go +51 -0
- package/internal/lspserver/lsp_same_transport_entries_are_deduplicated_test.go +66 -0
- package/lib/compiler/internal/project/readProjectConfig.d.ts +5 -3
- package/lib/compiler/internal/project/readProjectConfig.js +46 -14
- package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
- package/lib/compiler/internal/residentCheckProcess.d.ts +46 -0
- package/lib/compiler/internal/residentCheckProcess.js +227 -0
- package/lib/compiler/internal/residentCheckProcess.js.map +1 -0
- package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +2 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.js +35 -18
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +64 -1
- package/lib/compiler/internal/runBuild.js +484 -7
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.js +1 -0
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/flags/parser.js +13 -17
- package/lib/flags/parser.js.map +1 -1
- package/lib/flags/schema.d.ts +10 -3
- package/lib/flags/schema.js +99 -0
- package/lib/flags/schema.js.map +1 -1
- package/lib/internal/projectInputPathIdentity.d.ts +23 -0
- package/lib/internal/projectInputPathIdentity.js +222 -0
- package/lib/internal/projectInputPathIdentity.js.map +1 -0
- package/lib/launcher/internal/runTtsc.d.ts +17 -0
- package/lib/launcher/internal/runTtsc.js +121 -88
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtscserver.d.ts +13 -1
- package/lib/launcher/internal/runTtscserver.js +415 -45
- package/lib/launcher/internal/runTtscserver.js.map +1 -1
- package/lib/launcher/internal/singleFileOutput.d.ts +16 -0
- package/lib/launcher/internal/singleFileOutput.js +103 -0
- package/lib/launcher/internal/singleFileOutput.js.map +1 -0
- package/lib/launcher/internal/watchTopology.d.ts +214 -2
- package/lib/launcher/internal/watchTopology.js +1560 -41
- package/lib/launcher/internal/watchTopology.js.map +1 -1
- package/lib/plugin/internal/loadProjectPlugins.d.ts +1 -0
- package/lib/plugin/internal/loadProjectPlugins.js +5 -0
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/structures/ITtscPluginCapabilities.d.ts +31 -0
- package/lib/structures/internal/ITtscProjectInputSnapshot.d.ts +29 -0
- package/lib/structures/internal/ITtscProjectInputSnapshot.js +3 -0
- package/lib/structures/internal/ITtscProjectInputSnapshot.js.map +1 -0
- package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +5 -0
- package/package.json +8 -8
- package/src/compiler/internal/project/readProjectConfig.ts +62 -8
- package/src/compiler/internal/residentCheckProcess.ts +279 -0
- package/src/compiler/internal/resolveEmittedJavaScript.ts +43 -21
- package/src/compiler/internal/runBuild.ts +728 -12
- package/src/compiler/internal/runSingleFileEmit.ts +1 -0
- package/src/flags/parser.ts +17 -17
- package/src/flags/schema.ts +111 -3
- package/src/internal/projectInputPathIdentity.ts +273 -0
- package/src/launcher/internal/runTtsc.ts +141 -117
- package/src/launcher/internal/runTtscserver.ts +561 -54
- package/src/launcher/internal/singleFileOutput.ts +133 -0
- package/src/launcher/internal/watchTopology.ts +2008 -59
- package/src/plugin/internal/loadProjectPlugins.ts +8 -0
- package/src/structures/ITtscPluginCapabilities.ts +34 -0
- package/src/structures/internal/ITtscProjectInputSnapshot.ts +29 -0
- package/src/structures/internal/TtscSingleFileEmitOptions.ts +5 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResidentCheckProcess = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const node_readline_1 = require("node:readline");
|
|
6
|
+
const residentTransformProcess_1 = require("./residentTransformProcess");
|
|
7
|
+
const STDERR_TAIL_LIMIT = 64 * 1024;
|
|
8
|
+
const REPLY_ECHO_LIMIT = 200;
|
|
9
|
+
const TERMINATION_GRACE_MS = 1_000;
|
|
10
|
+
/**
|
|
11
|
+
* FIFO JSON-line client for a check-stage `check-serve` sidecar.
|
|
12
|
+
*
|
|
13
|
+
* A watch session serializes cycles, but the client still queues replies so a
|
|
14
|
+
* caller cannot accidentally pair a late response with the next request. Any
|
|
15
|
+
* framing failure retires the process; the launcher then falls back to the
|
|
16
|
+
* ordinary one-shot command for that cycle.
|
|
17
|
+
*/
|
|
18
|
+
class ResidentCheckProcess {
|
|
19
|
+
child;
|
|
20
|
+
pending = [];
|
|
21
|
+
reader;
|
|
22
|
+
requestTimeoutMs;
|
|
23
|
+
failure;
|
|
24
|
+
stderr = "";
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.requestTimeoutMs = (0, residentTransformProcess_1.normalizeRequestTimeoutMs)(options.requestTimeoutMs);
|
|
27
|
+
this.child = (0, node_child_process_1.spawn)(options.binary, [...options.args], {
|
|
28
|
+
cwd: options.cwd,
|
|
29
|
+
env: options.env,
|
|
30
|
+
windowsHide: true,
|
|
31
|
+
});
|
|
32
|
+
const stdin = this.child.stdin;
|
|
33
|
+
const stdout = this.child.stdout;
|
|
34
|
+
if (stdin === null || stdout === null) {
|
|
35
|
+
this.child.kill();
|
|
36
|
+
throw new Error("ttsc: resident check host has no stdio pipes");
|
|
37
|
+
}
|
|
38
|
+
this.reader = (0, node_readline_1.createInterface)({ input: stdout });
|
|
39
|
+
this.reader.on("line", (line) => this.onLine(line));
|
|
40
|
+
this.reader.on("close", () => {
|
|
41
|
+
if (this.failure === undefined)
|
|
42
|
+
this.fail(this.exitError());
|
|
43
|
+
});
|
|
44
|
+
this.child.stderr?.on("data", (chunk) => {
|
|
45
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
46
|
+
this.stderr = (this.stderr + text).slice(-STDERR_TAIL_LIMIT);
|
|
47
|
+
});
|
|
48
|
+
this.child.on("error", (error) => this.fail(error));
|
|
49
|
+
stdin.on("error", (error) => this.fail(error));
|
|
50
|
+
stdout.on("error", (error) => this.fail(error));
|
|
51
|
+
this.child.stderr?.on("error", () => { });
|
|
52
|
+
}
|
|
53
|
+
request(payload) {
|
|
54
|
+
if (this.failure !== undefined)
|
|
55
|
+
return Promise.reject(this.failure);
|
|
56
|
+
const stdin = this.child.stdin;
|
|
57
|
+
if (stdin === null || stdin.destroyed) {
|
|
58
|
+
return Promise.reject(new Error("ttsc: resident check host stdin is closed"));
|
|
59
|
+
}
|
|
60
|
+
let line;
|
|
61
|
+
try {
|
|
62
|
+
line = `${JSON.stringify(payload)}\n`;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return Promise.reject(asError(error));
|
|
66
|
+
}
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const pending = {
|
|
69
|
+
reject,
|
|
70
|
+
resolve,
|
|
71
|
+
timer: setTimeout(() => {
|
|
72
|
+
const detail = stderrSuffix(this.stderr);
|
|
73
|
+
const timeout = new Error(`ttsc: resident check request timed out after ${String(this.requestTimeoutMs)} ms${detail}`);
|
|
74
|
+
this.settle(pending, timeout);
|
|
75
|
+
this.fail(timeout);
|
|
76
|
+
}, this.requestTimeoutMs),
|
|
77
|
+
};
|
|
78
|
+
pending.timer.unref();
|
|
79
|
+
this.pending.push(pending);
|
|
80
|
+
try {
|
|
81
|
+
stdin.write(line, (error) => {
|
|
82
|
+
if (error === null || error === undefined)
|
|
83
|
+
return;
|
|
84
|
+
this.settle(pending, error);
|
|
85
|
+
this.fail(error);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
const reason = asError(error);
|
|
90
|
+
this.settle(pending, reason);
|
|
91
|
+
this.fail(reason);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
dispose() {
|
|
96
|
+
if (this.failure !== undefined)
|
|
97
|
+
return;
|
|
98
|
+
this.fail(new Error("ttsc: resident check host disposed"));
|
|
99
|
+
}
|
|
100
|
+
onLine(line) {
|
|
101
|
+
if (this.failure !== undefined || line.trim().length === 0)
|
|
102
|
+
return;
|
|
103
|
+
const pending = this.pending[0];
|
|
104
|
+
if (pending === undefined) {
|
|
105
|
+
this.fail(new Error("ttsc: resident check host sent an unsolicited reply"));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const result = parseResidentCheckResult(line);
|
|
109
|
+
if (result === undefined) {
|
|
110
|
+
const error = new Error(`ttsc: resident check host sent a malformed reply: ${echoLine(line)}`);
|
|
111
|
+
this.settle(pending, error);
|
|
112
|
+
this.fail(error);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.settle(pending, result);
|
|
116
|
+
}
|
|
117
|
+
settle(pending, result) {
|
|
118
|
+
const index = this.pending.indexOf(pending);
|
|
119
|
+
if (index === -1)
|
|
120
|
+
return;
|
|
121
|
+
this.pending.splice(index, 1);
|
|
122
|
+
clearTimeout(pending.timer);
|
|
123
|
+
if (result instanceof Error)
|
|
124
|
+
pending.reject(result);
|
|
125
|
+
else
|
|
126
|
+
pending.resolve(result);
|
|
127
|
+
}
|
|
128
|
+
fail(error) {
|
|
129
|
+
if (this.failure !== undefined)
|
|
130
|
+
return;
|
|
131
|
+
this.failure = error;
|
|
132
|
+
while (this.pending.length !== 0) {
|
|
133
|
+
this.settle(this.pending[0], error);
|
|
134
|
+
}
|
|
135
|
+
this.terminate();
|
|
136
|
+
}
|
|
137
|
+
terminate() {
|
|
138
|
+
const stdin = this.child.stdin;
|
|
139
|
+
if (stdin !== null && !stdin.destroyed)
|
|
140
|
+
stdin.destroy();
|
|
141
|
+
if (this.child.exitCode !== null || this.child.signalCode !== null)
|
|
142
|
+
return;
|
|
143
|
+
try {
|
|
144
|
+
this.child.kill();
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const force = setTimeout(() => {
|
|
150
|
+
if (this.child.exitCode !== null || this.child.signalCode !== null)
|
|
151
|
+
return;
|
|
152
|
+
try {
|
|
153
|
+
this.child.kill("SIGKILL");
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// The host exited between the liveness check and forced termination.
|
|
157
|
+
}
|
|
158
|
+
}, TERMINATION_GRACE_MS);
|
|
159
|
+
force.unref();
|
|
160
|
+
this.child.once("exit", () => clearTimeout(force));
|
|
161
|
+
}
|
|
162
|
+
exitError() {
|
|
163
|
+
const detail = this.stderr.trim();
|
|
164
|
+
if (detail.length !== 0)
|
|
165
|
+
return new Error(detail);
|
|
166
|
+
const signal = this.child.signalCode === null ? "" : `, signal ${this.child.signalCode}`;
|
|
167
|
+
return new Error(`ttsc: resident check host exited (code ${this.child.exitCode ?? "null"}${signal})`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.ResidentCheckProcess = ResidentCheckProcess;
|
|
171
|
+
function parseResidentCheckResult(line) {
|
|
172
|
+
let value;
|
|
173
|
+
try {
|
|
174
|
+
value = JSON.parse(line);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
if (!isRecord(value) ||
|
|
180
|
+
typeof value.status !== "number" ||
|
|
181
|
+
!Number.isInteger(value.status)) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
if (typeof value.stdout !== "string" || typeof value.stderr !== "string") {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
const telemetry = value.telemetry;
|
|
188
|
+
if (!isRecord(telemetry) ||
|
|
189
|
+
typeof telemetry.pid !== "number" ||
|
|
190
|
+
!Number.isSafeInteger(telemetry.pid) ||
|
|
191
|
+
typeof telemetry.programLoads !== "number" ||
|
|
192
|
+
!Number.isSafeInteger(telemetry.programLoads) ||
|
|
193
|
+
typeof telemetry.programUpdates !== "number" ||
|
|
194
|
+
!Number.isSafeInteger(telemetry.programUpdates) ||
|
|
195
|
+
typeof telemetry.reused !== "boolean") {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
diagnostics: [],
|
|
200
|
+
status: value.status,
|
|
201
|
+
stderr: value.stderr,
|
|
202
|
+
stdout: value.stdout,
|
|
203
|
+
telemetry: {
|
|
204
|
+
pid: telemetry.pid,
|
|
205
|
+
programLoads: telemetry.programLoads,
|
|
206
|
+
programUpdates: telemetry.programUpdates,
|
|
207
|
+
reused: telemetry.reused,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function isRecord(value) {
|
|
212
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
213
|
+
}
|
|
214
|
+
function echoLine(line) {
|
|
215
|
+
const trimmed = line.trim();
|
|
216
|
+
return JSON.stringify(trimmed.length <= REPLY_ECHO_LIMIT
|
|
217
|
+
? trimmed
|
|
218
|
+
: `${trimmed.slice(0, REPLY_ECHO_LIMIT)}…`);
|
|
219
|
+
}
|
|
220
|
+
function stderrSuffix(stderr) {
|
|
221
|
+
const detail = stderr.trim();
|
|
222
|
+
return detail.length === 0 ? "" : `: ${detail}`;
|
|
223
|
+
}
|
|
224
|
+
function asError(error) {
|
|
225
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=residentCheckProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"residentCheckProcess.js","sourceRoot":"","sources":["../../../src/compiler/internal/residentCheckProcess.ts"],"names":[],"mappings":";;;AAAA,2DAA8D;AAC9D,iDAAgE;AAGhE,yEAAuE;AAEvE,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAiCnC;;;;;;;GAOG;AACH;IACmB,KAAK,CAAe;IACpB,OAAO,GAAqB,EAAE,CAAC;IAC/B,MAAM,CAAY;IAClB,gBAAgB,CAAS;IAClC,OAAO,CAAoB;IAC3B,MAAM,GAAG,EAAE,CAAC;IAEpB,YAAmB,OAAoC;QACrD,IAAI,CAAC,gBAAgB,GAAG,IAAA,oDAAyB,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC5E,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,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACjC,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACtC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAA,+BAAe,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,EA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OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,OAAO,IAAI,CAAC,SAAS,CACnB,OAAO,CAAC,MAAM,IAAI,gBAAgB;QAChC,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAC7C,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* 1. Try to derive the exact output path by mirroring the source's relative
|
|
7
7
|
* position inside `projectRoot` into `outDir`, applying the correct JS
|
|
8
|
-
* extension (`.js` / `.mjs` / `.cjs`). Use this path if it exists
|
|
8
|
+
* extension (`.js` / `.jsx` / `.mjs` / `.cjs`). Use this path if it exists
|
|
9
|
+
* on disk.
|
|
9
10
|
* 2. Fall back to scoring each candidate in `emittedFiles` (or a recursive
|
|
10
11
|
* directory scan of `outDir`) by the number of trailing path-stem segments
|
|
11
12
|
* shared with the source file name, and pick the highest-scoring existing
|
|
@@ -14,7 +14,8 @@ const paths_1 = require("./paths");
|
|
|
14
14
|
*
|
|
15
15
|
* 1. Try to derive the exact output path by mirroring the source's relative
|
|
16
16
|
* position inside `projectRoot` into `outDir`, applying the correct JS
|
|
17
|
-
* extension (`.js` / `.mjs` / `.cjs`). Use this path if it exists
|
|
17
|
+
* extension (`.js` / `.jsx` / `.mjs` / `.cjs`). Use this path if it exists
|
|
18
|
+
* on disk.
|
|
18
19
|
* 2. Fall back to scoring each candidate in `emittedFiles` (or a recursive
|
|
19
20
|
* directory scan of `outDir`) by the number of trailing path-stem segments
|
|
20
21
|
* shared with the source file name, and pick the highest-scoring existing
|
|
@@ -23,9 +24,17 @@ const paths_1 = require("./paths");
|
|
|
23
24
|
* Returns `null` when no matching output file is found on disk.
|
|
24
25
|
*/
|
|
25
26
|
function resolveEmittedJavaScript(options) {
|
|
26
|
-
const exact =
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const exact = resolveExactEmittedFiles(options.outDir, options.projectRoot, options.sourceFile);
|
|
28
|
+
const emitted = new Set(options.emittedFiles?.map((file) => emittedPathKey(file)) ?? []);
|
|
29
|
+
for (const candidate of exact) {
|
|
30
|
+
if (emitted.has(emittedPathKey(candidate)) && node_fs_1.default.existsSync(candidate)) {
|
|
31
|
+
return candidate;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const candidate of exact) {
|
|
35
|
+
if (node_fs_1.default.existsSync(candidate)) {
|
|
36
|
+
return candidate;
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
// Score the pre-computed emit list first (cheap). When it yields nothing —
|
|
31
40
|
// because the list is incomplete (a native transform host such as typia emits
|
|
@@ -64,16 +73,16 @@ function bestStemMatch(files, sourceFile) {
|
|
|
64
73
|
}
|
|
65
74
|
/**
|
|
66
75
|
* Derive the exact output path for `sourceFile` by mirroring its position
|
|
67
|
-
* relative to `projectRoot` into `outDir`. Returns
|
|
68
|
-
* not inside the project root or when the path cannot be determined.
|
|
76
|
+
* relative to `projectRoot` into `outDir`. Returns no candidates when the
|
|
77
|
+
* source is not inside the project root or when the path cannot be determined.
|
|
69
78
|
*/
|
|
70
|
-
function
|
|
79
|
+
function resolveExactEmittedFiles(outDir, projectRoot, sourceFile) {
|
|
71
80
|
const relative = node_path_1.default.relative(projectRoot, sourceFile);
|
|
72
81
|
if (relative === "" || (0, paths_1.isOutsideRelativePath)(relative)) {
|
|
73
|
-
return
|
|
82
|
+
return [];
|
|
74
83
|
}
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
const stem = relative.slice(0, relative.length - node_path_1.default.extname(relative).length);
|
|
85
|
+
return emittedJavaScriptExtensions(sourceFile).map((extension) => node_path_1.default.resolve(outDir, stem + extension));
|
|
77
86
|
}
|
|
78
87
|
/**
|
|
79
88
|
* Recursively enumerate every JavaScript output file under `root`. Uses an
|
|
@@ -125,21 +134,29 @@ function sharedSourceStemSegments(outPath, srcPath) {
|
|
|
125
134
|
return shared;
|
|
126
135
|
}
|
|
127
136
|
/**
|
|
128
|
-
* Map a
|
|
129
|
-
*
|
|
137
|
+
* Map a source extension to every JavaScript output counterpart tsgo can use.
|
|
138
|
+
* JSX preserve mode writes `.tsx`/`.jsx` inputs as `.jsx`; all other JSX modes
|
|
139
|
+
* write `.js`.
|
|
130
140
|
*/
|
|
131
|
-
function
|
|
141
|
+
function emittedJavaScriptExtensions(filename) {
|
|
132
142
|
switch (node_path_1.default.extname(filename).toLowerCase()) {
|
|
133
143
|
case ".mts":
|
|
134
|
-
return ".mjs";
|
|
144
|
+
return [".mjs"];
|
|
135
145
|
case ".cts":
|
|
136
|
-
return ".cjs";
|
|
146
|
+
return [".cjs"];
|
|
147
|
+
case ".tsx":
|
|
148
|
+
case ".jsx":
|
|
149
|
+
return [".js", ".jsx"];
|
|
137
150
|
default:
|
|
138
|
-
return ".js";
|
|
151
|
+
return [".js"];
|
|
139
152
|
}
|
|
140
153
|
}
|
|
141
|
-
/** Return true when `filename` has a
|
|
154
|
+
/** Return true when `filename` has a JavaScript output extension. */
|
|
142
155
|
function isJavaScriptOutput(filename) {
|
|
143
|
-
return /\.(?:[cm]?js)$/i.test(filename);
|
|
156
|
+
return /\.(?:[cm]?js|jsx)$/i.test(filename);
|
|
157
|
+
}
|
|
158
|
+
function emittedPathKey(filename) {
|
|
159
|
+
const resolved = node_path_1.default.resolve(filename);
|
|
160
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
144
161
|
}
|
|
145
162
|
//# sourceMappingURL=resolveEmittedJavaScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEmittedJavaScript.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveEmittedJavaScript.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,mCAAgD;AAEhD
|
|
1
|
+
{"version":3,"file":"resolveEmittedJavaScript.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveEmittedJavaScript.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,mCAAgD;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,kCAAyC,OAMxC;IACC,MAAM,KAAK,GAAG,wBAAwB,CACpC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,CACnB,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAChE,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,IAAI,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACvE,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;I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ACT,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzB;YACE,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,QAAQ,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1E,CAAC"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import { type ProjectInputPathIdentityContext } from "../../internal/projectInputPathIdentity";
|
|
1
2
|
import type { ITtscCompilerDiagnostic } from "../../structures/ITtscCompilerDiagnostic";
|
|
3
|
+
import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin";
|
|
2
4
|
import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscParsedProjectConfig";
|
|
5
|
+
import type { ITtscProjectInputSnapshot } from "../../structures/internal/ITtscProjectInputSnapshot";
|
|
3
6
|
import type { TtscBuildOptions } from "../../structures/internal/TtscBuildOptions";
|
|
4
7
|
import type { TtscBuildResult } from "../../structures/internal/TtscBuildResult";
|
|
5
|
-
type
|
|
8
|
+
import { type ResidentCheckRequest } from "./residentCheckProcess";
|
|
9
|
+
export type RunBuildOptions = TtscBuildOptions & {
|
|
6
10
|
skipDiagnosticsCheck?: boolean;
|
|
7
11
|
forceListEmittedFiles?: boolean;
|
|
12
|
+
/** Keep every compiler-owned side product inside this private directory. */
|
|
13
|
+
isolateOutputsTo?: string;
|
|
8
14
|
/**
|
|
9
15
|
* Receives selected native-plugin source roots after the project resolves.
|
|
10
16
|
* The watch launcher uses these roots to invalidate a sidecar when its Go
|
|
11
17
|
* implementation changes between rebuilds.
|
|
12
18
|
*/
|
|
13
19
|
onWatchInputs?: (inputs: readonly string[]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Receives the reconciled project-rule filesystem dependency snapshot. Called
|
|
22
|
+
* only by watch launchers; ordinary builds do not probe the optional sidecar
|
|
23
|
+
* command.
|
|
24
|
+
*/
|
|
25
|
+
onProjectInputs?: (inputs: ITtscProjectInputSnapshot) => void;
|
|
14
26
|
/**
|
|
15
27
|
* Emit an external source map from the direct tsgo build lane even when the
|
|
16
28
|
* project configures none. Set by the ttsx runtime builds so a served emit
|
|
@@ -27,6 +39,57 @@ type RunBuildOptions = TtscBuildOptions & {
|
|
|
27
39
|
* decide how to surface diagnostics. Does not throw on non-zero exit.
|
|
28
40
|
*/
|
|
29
41
|
export declare function runBuild(options?: RunBuildOptions): TtscBuildResult;
|
|
42
|
+
export type ResidentCheckWatchChange = {
|
|
43
|
+
/** Re-resolve project, plugin, contributor, and Program topology. */
|
|
44
|
+
reload?: boolean;
|
|
45
|
+
/** Retain the sidecar and execution selection but cold-load its Program. */
|
|
46
|
+
invalidate?: boolean;
|
|
47
|
+
/** Local compiler or data paths changed since the prior cycle. */
|
|
48
|
+
changed?: readonly string[];
|
|
49
|
+
/** Subset of changed paths declared by ProjectRules as external inputs. */
|
|
50
|
+
external?: readonly string[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Analysis-only watch coordinator.
|
|
54
|
+
*
|
|
55
|
+
* The selected project and compatible check-stage processes stay resident
|
|
56
|
+
* across ordinary source/data edits. A config, root-set, contributor, or plugin
|
|
57
|
+
* topology transition calls for a full reset before the next cycle. Emit and
|
|
58
|
+
* transform lanes can pass through the coordinator, but compatibility checks
|
|
59
|
+
* keep them on the established one-shot path without starting sidecars.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ResidentCheckWatchSession {
|
|
62
|
+
private execution;
|
|
63
|
+
private readonly pendingChanges;
|
|
64
|
+
private projectInputs;
|
|
65
|
+
private readonly processes;
|
|
66
|
+
run(options: RunBuildOptions, change?: ResidentCheckWatchChange): Promise<TtscBuildResult>;
|
|
67
|
+
/** Terminate every sidecar and discard the cached selection context. */
|
|
68
|
+
dispose(): void;
|
|
69
|
+
private reset;
|
|
70
|
+
private captureProjectInputs;
|
|
71
|
+
private refreshProjectInputTopology;
|
|
72
|
+
private runCheckPlugins;
|
|
73
|
+
}
|
|
74
|
+
export type ResidentCheckEntryPlan = {
|
|
75
|
+
args: string[];
|
|
76
|
+
entryIndex: number;
|
|
77
|
+
key: string | undefined;
|
|
78
|
+
plugin: ITtscLoadedNativePlugin;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Plan every configured check entry while sharing resident processes only by
|
|
82
|
+
* binary/name/argument identity.
|
|
83
|
+
*/
|
|
84
|
+
export declare function planResidentCheckEntries(plugins: readonly ITtscLoadedNativePlugin[], createArgs: (plugin: ITtscLoadedNativePlugin) => string[]): ResidentCheckEntryPlan[];
|
|
85
|
+
/** Retain one complete change stream per configured resident check entry. */
|
|
86
|
+
export declare function bufferResidentCheckEntryRequests(pending: Map<number, ResidentCheckRequest>, checks: readonly ResidentCheckEntryPlan[], request: ResidentCheckRequest): void;
|
|
87
|
+
/** Consume exactly one configured entry's buffered request. */
|
|
88
|
+
export declare function takeResidentCheckEntryRequest(pending: Map<number, ResidentCheckRequest>, entryIndex: number): ResidentCheckRequest;
|
|
89
|
+
export declare function residentCheckRequest(change: ResidentCheckWatchChange, cwd: string): ResidentCheckRequest;
|
|
90
|
+
export declare function mergeProjectInputSnapshots(fallbackRoot: string, snapshots: readonly ITtscProjectInputSnapshot[], identities?: ProjectInputPathIdentityContext): ITtscProjectInputSnapshot;
|
|
91
|
+
export declare function parseProjectInputSnapshot(text: string, plugin: ITtscLoadedNativePlugin): ITtscProjectInputSnapshot;
|
|
92
|
+
export declare function isAbsoluteLocalProjectInputPath(location: string, platform?: NodeJS.Platform): boolean;
|
|
30
93
|
/**
|
|
31
94
|
* Merge two `TtscBuildResult` values into one.
|
|
32
95
|
*
|