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.
- 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 +276 -100
- 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_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 +208 -0
- package/internal/graph/graph.go +143 -5
- package/internal/graph/line_model.go +122 -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 +100 -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,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readJsonFile = readJsonFile;
|
|
7
|
+
exports.readJsoncFile = readJsoncFile;
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
/**
|
|
10
|
+
* Attributed JSON / JSONC readers for every configuration file ttsc owns.
|
|
11
|
+
*
|
|
12
|
+
* A bare `JSON.parse` failure reports a byte offset in an unnamed file, which
|
|
13
|
+
* is unusable exactly where attribution matters most: an `extends` chain, where
|
|
14
|
+
* any ancestor could be the source, and a watch session, which reprints the
|
|
15
|
+
* same line on every save. Every ttsc-owned configuration read goes through
|
|
16
|
+
* these helpers so the failure names its file and position in ttsc's own
|
|
17
|
+
* diagnostic voice, like the neighbouring `ttsc: extended tsconfig not found:
|
|
18
|
+
* …`.
|
|
19
|
+
*
|
|
20
|
+
* Comment, trailing-comma, and BOM removal is length-preserving (each removed
|
|
21
|
+
* character becomes a space, each removed newline stays a newline), so the line
|
|
22
|
+
* and column the JSON parser reports are the position in the file the user
|
|
23
|
+
* actually edited rather than in a shortened intermediate string.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Read and parse a strict-JSON configuration file (`package.json`), naming it
|
|
27
|
+
* on failure.
|
|
28
|
+
*
|
|
29
|
+
* A leading UTF-8 BOM is accepted, matching the tsconfig reader that closed
|
|
30
|
+
* issue #216: the two readers are consulted for the same project and
|
|
31
|
+
* disagreeing about a byte order mark would only surprise the user who hit it.
|
|
32
|
+
*/
|
|
33
|
+
function readJsonFile(file) {
|
|
34
|
+
const text = stripLeadingBom(node_fs_1.default.readFileSync(file, "utf8"));
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(text);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new Error(`ttsc: failed to parse ${file}: ${describe(error)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Read and parse a JSONC (JSON with comments and trailing commas) configuration
|
|
44
|
+
* file — tsconfig.json, jsconfig.json — naming it on failure.
|
|
45
|
+
*/
|
|
46
|
+
function readJsoncFile(file) {
|
|
47
|
+
const text = node_fs_1.default.readFileSync(file, "utf8");
|
|
48
|
+
try {
|
|
49
|
+
return parseJsonc(text);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw new Error(`ttsc: failed to parse ${file}: ${describe(error)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse a JSONC string by blanking comments and trailing commas before handing
|
|
57
|
+
* off to `JSON.parse`. Callers hold a path, so they go through
|
|
58
|
+
* {@link readJsoncFile} and their failures are attributed.
|
|
59
|
+
*/
|
|
60
|
+
function parseJsonc(input) {
|
|
61
|
+
return JSON.parse(stripTrailingCommas(stripComments(stripLeadingBom(input))));
|
|
62
|
+
}
|
|
63
|
+
/** Render a parse failure's message without the `Error:` noise around it. */
|
|
64
|
+
function describe(error) {
|
|
65
|
+
return error instanceof Error ? error.message : String(error);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Replace a leading UTF-8 BOM with a space. JSON ignores leading whitespace, so
|
|
69
|
+
* blanking rather than removing keeps every later offset equal to the offset in
|
|
70
|
+
* the original file. A BOM anywhere else is left in place and still rejected,
|
|
71
|
+
* which is the behaviour issue #216 pinned.
|
|
72
|
+
*/
|
|
73
|
+
function stripLeadingBom(input) {
|
|
74
|
+
return input.charCodeAt(0) === 0xfeff ? ` ${input.slice(1)}` : input;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Blank `//` line comments and `/* block comments *\/` in a JSONC string,
|
|
78
|
+
* writing a space for every removed character and preserving newlines.
|
|
79
|
+
* Correctly handles strings that contain comment-like character sequences by
|
|
80
|
+
* tracking string boundaries and escape characters.
|
|
81
|
+
*/
|
|
82
|
+
function stripComments(input) {
|
|
83
|
+
let output = "";
|
|
84
|
+
let inBlockComment = false;
|
|
85
|
+
let inLineComment = false;
|
|
86
|
+
let inString = false;
|
|
87
|
+
let quote = "";
|
|
88
|
+
let escape = false;
|
|
89
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
90
|
+
const current = input[i];
|
|
91
|
+
const next = input[i + 1];
|
|
92
|
+
if (inBlockComment) {
|
|
93
|
+
if (current === "*" && next === "/") {
|
|
94
|
+
inBlockComment = false;
|
|
95
|
+
output += " ";
|
|
96
|
+
i += 1;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
output += blank(current);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (inLineComment) {
|
|
103
|
+
if (current === "\n") {
|
|
104
|
+
inLineComment = false;
|
|
105
|
+
output += current;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
output += blank(current);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (inString) {
|
|
112
|
+
output += current;
|
|
113
|
+
if (escape) {
|
|
114
|
+
escape = false;
|
|
115
|
+
}
|
|
116
|
+
else if (current === "\\") {
|
|
117
|
+
escape = true;
|
|
118
|
+
}
|
|
119
|
+
else if (current === quote) {
|
|
120
|
+
inString = false;
|
|
121
|
+
quote = "";
|
|
122
|
+
}
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (current === '"' || current === "'") {
|
|
126
|
+
inString = true;
|
|
127
|
+
quote = current;
|
|
128
|
+
output += current;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (current === "/" && next === "/") {
|
|
132
|
+
inLineComment = true;
|
|
133
|
+
output += " ";
|
|
134
|
+
i += 1;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (current === "/" && next === "*") {
|
|
138
|
+
inBlockComment = true;
|
|
139
|
+
output += " ";
|
|
140
|
+
i += 1;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
output += current;
|
|
144
|
+
}
|
|
145
|
+
return output;
|
|
146
|
+
}
|
|
147
|
+
/** Keep a newline as a newline; every other removed character becomes a space. */
|
|
148
|
+
function blank(current) {
|
|
149
|
+
return current === "\n" ? "\n" : " ";
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Blank trailing commas before `}` or `]` in a JSON string (after comments have
|
|
153
|
+
* already been blanked). Handles string boundaries and escape characters to
|
|
154
|
+
* avoid touching commas inside string values.
|
|
155
|
+
*/
|
|
156
|
+
function stripTrailingCommas(input) {
|
|
157
|
+
let output = "";
|
|
158
|
+
let inString = false;
|
|
159
|
+
let quote = "";
|
|
160
|
+
let escape = false;
|
|
161
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
162
|
+
const current = input[i];
|
|
163
|
+
if (inString) {
|
|
164
|
+
output += current;
|
|
165
|
+
if (escape) {
|
|
166
|
+
escape = false;
|
|
167
|
+
}
|
|
168
|
+
else if (current === "\\") {
|
|
169
|
+
escape = true;
|
|
170
|
+
}
|
|
171
|
+
else if (current === quote) {
|
|
172
|
+
inString = false;
|
|
173
|
+
quote = "";
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (current === '"' || current === "'") {
|
|
178
|
+
inString = true;
|
|
179
|
+
quote = current;
|
|
180
|
+
output += current;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (current === ",") {
|
|
184
|
+
const next = nextNonWhitespace(input, i + 1);
|
|
185
|
+
if (next === "}" || next === "]") {
|
|
186
|
+
output += " ";
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
output += current;
|
|
191
|
+
}
|
|
192
|
+
return output;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Return the first non-whitespace character at or after position `from` in
|
|
196
|
+
* `input`, or `undefined` when only whitespace remains. Used by
|
|
197
|
+
* `stripTrailingCommas` to detect whether a comma is trailing.
|
|
198
|
+
*/
|
|
199
|
+
function nextNonWhitespace(input, from) {
|
|
200
|
+
for (let i = from; i < input.length; i += 1) {
|
|
201
|
+
const current = input[i];
|
|
202
|
+
if (/\s/.test(current) === false) {
|
|
203
|
+
return current;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=readConfigJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readConfigJson.js","sourceRoot":"","sources":["../../../../src/compiler/internal/project/readConfigJson.ts"],"names":[],"mappings":";;;;;;;AAAA,sDAAyB;AAEzB;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH,sBAA6B,IAAY;IACvC,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,uBAA8B,IAAY;IACxC,MAAM,IAAI,GAAG,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAA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G,IAAI,CAAC;YAChB,KAAK,GAAG,OAAO,CAAC;YAChB,MAAM,IAAI,OAAO,CAAC;YAClB,SAAS;QACX,CAAC;QACD,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7C,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjC,MAAM,IAAI,GAAG,CAAC;gBACd,SAAS;YACX,CAAC;QACH,CAAC;QACD,MAAM,IAAI,OAAO,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,KAAa,EAAE,IAAY;IACpD,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -7,6 +7,7 @@ exports.readProjectConfig = readProjectConfig;
|
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_module_1 = require("node:module");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const readConfigJson_1 = require("./readConfigJson");
|
|
10
11
|
const resolveProjectConfig_1 = require("./resolveProjectConfig");
|
|
11
12
|
/**
|
|
12
13
|
* Compiler option keys whose values are file-system paths that must be resolved
|
|
@@ -28,6 +29,7 @@ function readProjectConfig(opts = {}) {
|
|
|
28
29
|
const root = identity.physicalProjectRoot;
|
|
29
30
|
const compilerOptions = readResolvedCompilerOptions(tsconfig);
|
|
30
31
|
return {
|
|
32
|
+
configPaths: compilerOptions.configPaths,
|
|
31
33
|
compilerOptions: {
|
|
32
34
|
...compilerOptions.options,
|
|
33
35
|
outDir: compilerOptions.outDir,
|
|
@@ -76,7 +78,7 @@ function readResolvedCompilerOptions(tsconfig, seen = new Set()) {
|
|
|
76
78
|
}
|
|
77
79
|
seen.add(canonical);
|
|
78
80
|
try {
|
|
79
|
-
const parsed =
|
|
81
|
+
const parsed = (0, readConfigJson_1.readJsoncFile)(canonical);
|
|
80
82
|
const own = parsed.compilerOptions;
|
|
81
83
|
const base = resolveBaseCompilerOptions(canonical, parsed.extends, seen);
|
|
82
84
|
const ownBaseDir = node_path_1.default.dirname(canonical);
|
|
@@ -97,6 +99,7 @@ function readResolvedCompilerOptions(tsconfig, seen = new Set()) {
|
|
|
97
99
|
? ownPlugins.filter(isProjectPluginConfig)
|
|
98
100
|
: base.plugins;
|
|
99
101
|
return {
|
|
102
|
+
configPaths: uniquePaths([...base.configPaths, canonical]),
|
|
100
103
|
optionBaseDirs,
|
|
101
104
|
options,
|
|
102
105
|
outDir: typeof own?.outDir === "string"
|
|
@@ -129,6 +132,7 @@ function resolveBaseCompilerOptions(tsconfig, extended, seen) {
|
|
|
129
132
|
}
|
|
130
133
|
if (!Array.isArray(extended)) {
|
|
131
134
|
return {
|
|
135
|
+
configPaths: [],
|
|
132
136
|
optionBaseDirs: {},
|
|
133
137
|
options: {},
|
|
134
138
|
pluginBaseDirs: [],
|
|
@@ -137,6 +141,7 @@ function resolveBaseCompilerOptions(tsconfig, extended, seen) {
|
|
|
137
141
|
};
|
|
138
142
|
}
|
|
139
143
|
let merged = {
|
|
144
|
+
configPaths: [],
|
|
140
145
|
optionBaseDirs: {},
|
|
141
146
|
options: {},
|
|
142
147
|
pluginBaseDirs: [],
|
|
@@ -149,6 +154,7 @@ function resolveBaseCompilerOptions(tsconfig, extended, seen) {
|
|
|
149
154
|
}
|
|
150
155
|
const current = readResolvedCompilerOptions(resolveExtendsConfig(tsconfig, specifier), seen);
|
|
151
156
|
merged = {
|
|
157
|
+
configPaths: uniquePaths([...merged.configPaths, ...current.configPaths]),
|
|
152
158
|
optionBaseDirs: {
|
|
153
159
|
...merged.optionBaseDirs,
|
|
154
160
|
...current.optionBaseDirs,
|
|
@@ -167,6 +173,9 @@ function resolveBaseCompilerOptions(tsconfig, extended, seen) {
|
|
|
167
173
|
}
|
|
168
174
|
return merged;
|
|
169
175
|
}
|
|
176
|
+
function uniquePaths(paths) {
|
|
177
|
+
return [...new Set(paths)];
|
|
178
|
+
}
|
|
170
179
|
/**
|
|
171
180
|
* Resolve path-typed compiler options to absolute paths using the directory of
|
|
172
181
|
* the tsconfig that declared each option (`baseDirs`).
|
|
@@ -219,9 +228,10 @@ function resolveExtendsConfig(tsconfig, specifier) {
|
|
|
219
228
|
/**
|
|
220
229
|
* When `specifier` names a bare package root, resolve the config file its
|
|
221
230
|
* `package.json#tsconfig` field selects (anchored at the package directory).
|
|
222
|
-
* Returns `undefined` when the specifier is a subpath, the manifest
|
|
223
|
-
*
|
|
224
|
-
*
|
|
231
|
+
* Returns `undefined` when the specifier is a subpath, the manifest cannot be
|
|
232
|
+
* resolved at all, or it declares no `tsconfig` field, so the caller falls back
|
|
233
|
+
* to Node entrypoint resolution. A manifest that resolves but does not parse
|
|
234
|
+
* throws, naming the file.
|
|
225
235
|
*/
|
|
226
236
|
function resolvePackageManifestTsconfig(resolver, specifier) {
|
|
227
237
|
if (!isBarePackageRoot(specifier)) {
|
|
@@ -231,16 +241,31 @@ function resolvePackageManifestTsconfig(resolver, specifier) {
|
|
|
231
241
|
try {
|
|
232
242
|
manifestPath = resolver.resolve(`${specifier}/package.json`);
|
|
233
243
|
}
|
|
234
|
-
catch {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
catch (error) {
|
|
245
|
+
// Node parses a package's manifest while resolving into it, so a malformed
|
|
246
|
+
// preset manifest fails here rather than at the read below. Swallowing it
|
|
247
|
+
// is what turned a broken manifest into the confusing downstream
|
|
248
|
+
// "Cannot find module 'example-preset.json'" from the `extends` fallback,
|
|
249
|
+
// which names a file that was never the problem. Node's own message names
|
|
250
|
+
// the real one, so report it in ttsc's voice instead of continuing.
|
|
251
|
+
if (error?.code ===
|
|
252
|
+
"ERR_INVALID_PACKAGE_CONFIG") {
|
|
253
|
+
throw new Error(`ttsc: failed to parse the package manifest of ${JSON.stringify(specifier)}: ${error instanceof Error ? error.message : String(error)}`);
|
|
254
|
+
}
|
|
242
255
|
return undefined;
|
|
243
256
|
}
|
|
257
|
+
// A manifest that exists but does not parse is a real configuration error,
|
|
258
|
+
// and it used to be swallowed here: the read returned `undefined`, the caller
|
|
259
|
+
// fell back to Node entrypoint resolution, and the user learned nothing about
|
|
260
|
+
// the file that actually broke. Report it instead.
|
|
261
|
+
//
|
|
262
|
+
// A manifest that parses to something other than an object carries no
|
|
263
|
+
// `tsconfig` field to read, so it falls back rather than throwing on a
|
|
264
|
+
// property access.
|
|
265
|
+
const manifest = (0, readConfigJson_1.readJsonFile)(manifestPath);
|
|
266
|
+
const field = typeof manifest === "object" && manifest !== null
|
|
267
|
+
? manifest.tsconfig
|
|
268
|
+
: undefined;
|
|
244
269
|
if (typeof field !== "string" || field.length === 0) {
|
|
245
270
|
return undefined;
|
|
246
271
|
}
|
|
@@ -258,22 +283,30 @@ function isBarePackageRoot(specifier) {
|
|
|
258
283
|
return !specifier.includes("/");
|
|
259
284
|
}
|
|
260
285
|
/**
|
|
261
|
-
* Given an on-disk location, try the path as-is,
|
|
262
|
-
*
|
|
286
|
+
* Given an on-disk location, try the path as-is and, unless it already ends in
|
|
287
|
+
* `.json`, with that extension appended. Only regular files are valid `extends`
|
|
288
|
+
* targets; TypeScript neither expands a directory into `tsconfig.json` nor
|
|
289
|
+
* probes a double `.json` suffix.
|
|
263
290
|
*/
|
|
264
291
|
function resolveExistingExtendsPath(location) {
|
|
265
|
-
const candidates =
|
|
266
|
-
location
|
|
267
|
-
`${location}.json
|
|
268
|
-
node_path_1.default.join(location, "tsconfig.json"),
|
|
269
|
-
]);
|
|
292
|
+
const candidates = location.endsWith(".json")
|
|
293
|
+
? [location]
|
|
294
|
+
: [location, `${location}.json`];
|
|
270
295
|
for (const candidate of candidates) {
|
|
271
|
-
if (
|
|
296
|
+
if (isFile(candidate)) {
|
|
272
297
|
return resolveRealPath(candidate);
|
|
273
298
|
}
|
|
274
299
|
}
|
|
275
300
|
throw new Error(`ttsc: extended tsconfig not found: ${location}`);
|
|
276
301
|
}
|
|
302
|
+
function isFile(location) {
|
|
303
|
+
try {
|
|
304
|
+
return node_fs_1.default.statSync(location).isFile();
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
277
310
|
/**
|
|
278
311
|
* Return true when `specifier` is a relative path reference: `.`, `..`, or a
|
|
279
312
|
* string starting with `./`, `../`, `.\\`, or `..\\`.
|
|
@@ -286,133 +319,4 @@ function isRelativeSpecifier(specifier) {
|
|
|
286
319
|
specifier.startsWith(".\\") ||
|
|
287
320
|
specifier.startsWith("..\\"));
|
|
288
321
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Parse a JSONC (JSON with Comments) string by stripping comments and trailing
|
|
291
|
-
* commas before handing off to `JSON.parse`.
|
|
292
|
-
*/
|
|
293
|
-
function parseJsonc(input) {
|
|
294
|
-
return JSON.parse(stripTrailingCommas(stripComments(stripLeadingBom(input))));
|
|
295
|
-
}
|
|
296
|
-
function stripLeadingBom(input) {
|
|
297
|
-
return input.charCodeAt(0) === 0xfeff ? input.slice(1) : input;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Remove `//` line comments and `/* block comments *\/` from a JSONC string.
|
|
301
|
-
* Correctly handles strings that contain comment-like character sequences by
|
|
302
|
-
* tracking string boundaries and escape characters.
|
|
303
|
-
*/
|
|
304
|
-
function stripComments(input) {
|
|
305
|
-
let output = "";
|
|
306
|
-
let inBlockComment = false;
|
|
307
|
-
let inLineComment = false;
|
|
308
|
-
let inString = false;
|
|
309
|
-
let quote = "";
|
|
310
|
-
let escape = false;
|
|
311
|
-
for (let i = 0; i < input.length; i += 1) {
|
|
312
|
-
const current = input[i];
|
|
313
|
-
const next = input[i + 1];
|
|
314
|
-
if (inBlockComment) {
|
|
315
|
-
if (current === "*" && next === "/") {
|
|
316
|
-
inBlockComment = false;
|
|
317
|
-
i += 1;
|
|
318
|
-
}
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
if (inLineComment) {
|
|
322
|
-
if (current === "\n") {
|
|
323
|
-
inLineComment = false;
|
|
324
|
-
output += current;
|
|
325
|
-
}
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (inString) {
|
|
329
|
-
output += current;
|
|
330
|
-
if (escape) {
|
|
331
|
-
escape = false;
|
|
332
|
-
}
|
|
333
|
-
else if (current === "\\") {
|
|
334
|
-
escape = true;
|
|
335
|
-
}
|
|
336
|
-
else if (current === quote) {
|
|
337
|
-
inString = false;
|
|
338
|
-
quote = "";
|
|
339
|
-
}
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (current === '"' || current === "'") {
|
|
343
|
-
inString = true;
|
|
344
|
-
quote = current;
|
|
345
|
-
output += current;
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
if (current === "/" && next === "/") {
|
|
349
|
-
inLineComment = true;
|
|
350
|
-
i += 1;
|
|
351
|
-
continue;
|
|
352
|
-
}
|
|
353
|
-
if (current === "/" && next === "*") {
|
|
354
|
-
inBlockComment = true;
|
|
355
|
-
i += 1;
|
|
356
|
-
continue;
|
|
357
|
-
}
|
|
358
|
-
output += current;
|
|
359
|
-
}
|
|
360
|
-
return output;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Remove trailing commas before `}` or `]` from a JSON string (after comments
|
|
364
|
-
* have already been stripped). Handles string boundaries and escape characters
|
|
365
|
-
* to avoid removing commas inside string values.
|
|
366
|
-
*/
|
|
367
|
-
function stripTrailingCommas(input) {
|
|
368
|
-
let output = "";
|
|
369
|
-
let inString = false;
|
|
370
|
-
let quote = "";
|
|
371
|
-
let escape = false;
|
|
372
|
-
for (let i = 0; i < input.length; i += 1) {
|
|
373
|
-
const current = input[i];
|
|
374
|
-
if (inString) {
|
|
375
|
-
output += current;
|
|
376
|
-
if (escape) {
|
|
377
|
-
escape = false;
|
|
378
|
-
}
|
|
379
|
-
else if (current === "\\") {
|
|
380
|
-
escape = true;
|
|
381
|
-
}
|
|
382
|
-
else if (current === quote) {
|
|
383
|
-
inString = false;
|
|
384
|
-
quote = "";
|
|
385
|
-
}
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
if (current === '"' || current === "'") {
|
|
389
|
-
inString = true;
|
|
390
|
-
quote = current;
|
|
391
|
-
output += current;
|
|
392
|
-
continue;
|
|
393
|
-
}
|
|
394
|
-
if (current === ",") {
|
|
395
|
-
const next = nextNonWhitespace(input, i + 1);
|
|
396
|
-
if (next === "}" || next === "]") {
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
output += current;
|
|
401
|
-
}
|
|
402
|
-
return output;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Return the first non-whitespace character at or after position `from` in
|
|
406
|
-
* `input`, or `undefined` when only whitespace remains. Used by
|
|
407
|
-
* `stripTrailingCommas` to detect whether a comma is trailing.
|
|
408
|
-
*/
|
|
409
|
-
function nextNonWhitespace(input, from) {
|
|
410
|
-
for (let i = from; i < input.length; i += 1) {
|
|
411
|
-
const current = input[i];
|
|
412
|
-
if (/\s/.test(current) === false) {
|
|
413
|
-
return current;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
return undefined;
|
|
417
|
-
}
|
|
418
322
|
//# sourceMappingURL=readProjectConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readProjectConfig.js","sourceRoot":"","sources":["../../../../src/compiler/internal/project/readProjectConfig.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,6CAA4C;AAC5C,0DAA6B;AAK7B,iEAAgE;AAEhE;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"readProjectConfig.js","sourceRoot":"","sources":["../../../../src/compiler/internal/project/readProjectConfig.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,6CAA4C;AAC5C,0DAA6B;AAK7B,qDAA+D;AAC/D,iEAAgE;AAEhE;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC;AAkBvE;;;;;;;;GAQG;AACH,2BACE,IAAI,GAA+B,EAAE;IAErC,MAAM,QAAQ,GAAG,IAAA,6CAAsB,EAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC1C,MAAM,eAAe,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAC9D,OAAO;QACL,WAAW,EAAE,eAAe,CAAC,WAAW;QACxC,eAAe,EAAE;YACf,GAAG,eAAe,CAAC,OAAO;YAC1B,MAAM,EAAE,eAAe,CAAC,MAAM;YAC9B,OAAO,EAAE,eAAe,CAAC,OAAO;SACjC;QACD,QAAQ;QACR,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE,eAAe,CAAC,cAAc;QAC9C,IAAI;KACL,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD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C;AAED,SAAS,MAAM,CAAC,QAAgB;IAC9B,IAAI,CAAC;QACH,OAAO,iBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,OAAO,CACL,SAAS,KAAK,GAAG;QACjB,SAAS,KAAK,IAAI;QAClB,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;QAC1B,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3B,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3B,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -13,6 +13,13 @@ export interface ResidentTransformProcessOptions {
|
|
|
13
13
|
binary: string;
|
|
14
14
|
cwd?: string;
|
|
15
15
|
env?: NodeJS.ProcessEnv;
|
|
16
|
+
/** Maximum time one request may wait for the resident host's reply. */
|
|
17
|
+
requestTimeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Per-request lifecycle controls for a resident transform host. */
|
|
20
|
+
export interface ResidentTransformRequestOptions {
|
|
21
|
+
/** Abort this request. An in-flight abort retires the FIFO host. */
|
|
22
|
+
signal?: AbortSignal;
|
|
16
23
|
}
|
|
17
24
|
/**
|
|
18
25
|
* Async client for the long-lived `utility-host serve` process.
|
|
@@ -32,6 +39,7 @@ export declare class ResidentTransformProcess {
|
|
|
32
39
|
private readonly child;
|
|
33
40
|
private readonly reader;
|
|
34
41
|
private readonly pending;
|
|
42
|
+
private readonly requestTimeoutMs;
|
|
35
43
|
private stderr;
|
|
36
44
|
private failure;
|
|
37
45
|
constructor(options: ResidentTransformProcessOptions);
|
|
@@ -43,7 +51,7 @@ export declare class ResidentTransformProcess {
|
|
|
43
51
|
* when the host has already failed or exited, or if writing the request
|
|
44
52
|
* fails.
|
|
45
53
|
*/
|
|
46
|
-
request(payload: Record<string, unknown>, kind: ResidentReplyKind): Promise<Record<string, unknown>>;
|
|
54
|
+
request(payload: Record<string, unknown>, kind: ResidentReplyKind, options?: ResidentTransformRequestOptions): Promise<Record<string, unknown>>;
|
|
47
55
|
/**
|
|
48
56
|
* Terminate the resident process and reject any in-flight requests. Safe to
|
|
49
57
|
* call more than once.
|
|
@@ -53,6 +61,11 @@ export declare class ResidentTransformProcess {
|
|
|
53
61
|
private onReaderClose;
|
|
54
62
|
private fail;
|
|
55
63
|
private rejectAll;
|
|
56
|
-
private
|
|
64
|
+
private settlePending;
|
|
65
|
+
private timeout;
|
|
66
|
+
private cancel;
|
|
67
|
+
private terminate;
|
|
57
68
|
private exitError;
|
|
58
69
|
}
|
|
70
|
+
/** Validate and normalize the caller-visible resident request deadline. */
|
|
71
|
+
export declare function normalizeRequestTimeoutMs(requestTimeoutMs?: number): number;
|