ttsc 0.13.0 → 0.13.1
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 +3 -0
- package/lib/compiler/internal/runBuild.js +149 -38
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/flags/schema.d.ts +42 -43
- package/lib/flags/schema.js +35 -17
- package/lib/flags/schema.js.map +1 -1
- package/lib/structures/ITtscPluginCapabilities.d.ts +19 -8
- package/package.json +8 -8
- package/shim/ast/lint.go +6 -0
- package/src/compiler/internal/runBuild.ts +209 -33
- package/src/flags/schema.ts +62 -43
- package/src/structures/ITtscPluginCapabilities.ts +20 -8
package/lib/flags/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/flags/schema.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,YAAY;AACZ,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,sEAAsE;AACtE,kEAAkE;AAClE,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,kBAAkB;;;;;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/flags/schema.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,YAAY;AACZ,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,sEAAsE;AACtE,kEAAkE;AAClE,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,kBAAkB;;;;;AAsIlB;;;;;;;;;;;;;;;GAeG;AAC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SAAS,CAAC,GAAG,CAAC,aAAa,KAAK,EAAE,CACjG,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -9,19 +9,30 @@
|
|
|
9
9
|
* silently dropping the flag for anything else.
|
|
10
10
|
*
|
|
11
11
|
* Every field is optional and defaults to `false`. Plugin authors opt in by
|
|
12
|
-
* setting only the capabilities their sidecar actually implements; ttsc
|
|
13
|
-
*
|
|
12
|
+
* setting only the capabilities their sidecar actually implements; ttsc keeps
|
|
13
|
+
* the conservative default for everything else.
|
|
14
14
|
*/
|
|
15
15
|
export interface ITtscPluginCapabilities {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the sidecar accepts `--diagnostics` and `--extendedDiagnostics` on
|
|
18
|
+
* its command line and may print plugin-owned timing detail to stdout.
|
|
19
|
+
*
|
|
20
|
+
* When `false` (the default), ttsc keeps diagnostics flags out of native
|
|
21
|
+
* sidecar argv so older strict hosts do not reject them. The ttsc launcher
|
|
22
|
+
* still records the coarse sidecar wall-clock timing itself.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
diagnosticsTiming?: boolean;
|
|
16
27
|
/**
|
|
17
28
|
* Whether the sidecar accepts `--singleThreaded` and `--checkers` on its
|
|
18
|
-
* command line. The lint sidecar parses both flags via
|
|
19
|
-
*
|
|
20
|
-
*
|
|
29
|
+
* command line. The lint sidecar parses both flags via `parseSubcommandFlags`
|
|
30
|
+
* and threads them into `loadProgram` (parse phase) and `engine.SetSerial`
|
|
31
|
+
* (rule walk); other check-stage hosts may not.
|
|
21
32
|
*
|
|
22
|
-
* When `false` (the default), ttsc strips both flags from the sidecar's
|
|
23
|
-
*
|
|
24
|
-
*
|
|
33
|
+
* When `false` (the default), ttsc strips both flags from the sidecar's arg
|
|
34
|
+
* list — the conservative behavior that ad3443a restored after `#113`
|
|
35
|
+
* over-forwarded them to typia/nestia hosts.
|
|
25
36
|
*
|
|
26
37
|
* @default false
|
|
27
38
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttsc",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "General-purpose TypeScript-Go compiler, plugin host, and runtime.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"rimraf": "^6.1.2"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@ttsc/linux-arm": "0.13.
|
|
36
|
-
"@ttsc/linux-
|
|
37
|
-
"@ttsc/linux-
|
|
38
|
-
"@ttsc/darwin-
|
|
39
|
-
"@ttsc/win32-x64": "0.13.
|
|
40
|
-
"@ttsc/
|
|
41
|
-
"@ttsc/
|
|
35
|
+
"@ttsc/linux-arm": "0.13.1",
|
|
36
|
+
"@ttsc/linux-arm64": "0.13.1",
|
|
37
|
+
"@ttsc/linux-x64": "0.13.1",
|
|
38
|
+
"@ttsc/darwin-x64": "0.13.1",
|
|
39
|
+
"@ttsc/win32-x64": "0.13.1",
|
|
40
|
+
"@ttsc/darwin-arm64": "0.13.1",
|
|
41
|
+
"@ttsc/win32-arm64": "0.13.1"
|
|
42
42
|
},
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"files": [
|
package/shim/ast/lint.go
CHANGED
|
@@ -132,6 +132,12 @@ const (
|
|
|
132
132
|
NodeFlagsAwaitContext = innerast.NodeFlagsAwaitContext
|
|
133
133
|
)
|
|
134
134
|
|
|
135
|
+
// ---- Modifier-flag constants ----
|
|
136
|
+
|
|
137
|
+
const (
|
|
138
|
+
ModifierFlagsAmbient = innerast.ModifierFlagsAmbient
|
|
139
|
+
)
|
|
140
|
+
|
|
135
141
|
// ---- Statement / declaration / expression kinds ----
|
|
136
142
|
|
|
137
143
|
const (
|
|
@@ -25,6 +25,12 @@ type RunBuildOptions = TtscBuildOptions & {
|
|
|
25
25
|
forceListEmittedFiles?: boolean;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
type BuildTiming = {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
lines: string[];
|
|
31
|
+
startedAt: bigint;
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* Merge extra environment variables over `process.env`, always injecting
|
|
30
36
|
* `TTSC_NODE_BINARY` so child processes can re-invoke the same Node.js binary
|
|
@@ -39,6 +45,81 @@ function mergeEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
|
39
45
|
return { ...base, ...extra };
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
function createBuildTiming(options: TtscCommonOptions): BuildTiming {
|
|
49
|
+
return {
|
|
50
|
+
enabled: hasDiagnosticsFlag(options),
|
|
51
|
+
lines: [],
|
|
52
|
+
startedAt: process.hrtime.bigint(),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function hasDiagnosticsFlag(options: TtscCommonOptions): boolean {
|
|
57
|
+
return (
|
|
58
|
+
hasEnabledPassthroughFlag(options, "--diagnostics") ||
|
|
59
|
+
hasEnabledPassthroughFlag(options, "--extendedDiagnostics")
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function hasEnabledPassthroughFlag(
|
|
64
|
+
options: TtscCommonOptions,
|
|
65
|
+
flag: string,
|
|
66
|
+
): boolean {
|
|
67
|
+
const passthrough = options.passthrough ?? [];
|
|
68
|
+
for (let i = 0; i < passthrough.length; i++) {
|
|
69
|
+
const token = passthrough[i]!;
|
|
70
|
+
if (token.startsWith(`${flag}=`)) {
|
|
71
|
+
return token.slice(flag.length + 1).toLowerCase() !== "false";
|
|
72
|
+
}
|
|
73
|
+
if (token === flag) {
|
|
74
|
+
if (
|
|
75
|
+
i + 1 < passthrough.length &&
|
|
76
|
+
isBooleanLiteral(passthrough[i + 1]!)
|
|
77
|
+
) {
|
|
78
|
+
return passthrough[i + 1]!.toLowerCase() !== "false";
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function recordTiming(
|
|
87
|
+
timing: BuildTiming,
|
|
88
|
+
label: string,
|
|
89
|
+
startedAt: bigint,
|
|
90
|
+
): void {
|
|
91
|
+
if (!timing.enabled) return;
|
|
92
|
+
timing.lines.push(`${label}: ${formatTimingSeconds(hrtimeMs(startedAt))}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function appendTimingOutput(
|
|
96
|
+
result: TtscBuildResult,
|
|
97
|
+
timing: BuildTiming,
|
|
98
|
+
): TtscBuildResult {
|
|
99
|
+
if (!timing.enabled) return result;
|
|
100
|
+
const lines = [
|
|
101
|
+
...timing.lines,
|
|
102
|
+
`ttsc total time: ${formatTimingSeconds(hrtimeMs(timing.startedAt))}`,
|
|
103
|
+
];
|
|
104
|
+
return {
|
|
105
|
+
...result,
|
|
106
|
+
stdout: appendStdout(result.stdout, lines.join("\n") + "\n"),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function appendStdout(stdout: string, text: string): string {
|
|
111
|
+
if (stdout.length === 0 || stdout.endsWith("\n")) return stdout + text;
|
|
112
|
+
return `${stdout}\n${text}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function hrtimeMs(startedAt: bigint): number {
|
|
116
|
+
return Number(process.hrtime.bigint() - startedAt) / 1e6;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function formatTimingSeconds(ms: number): string {
|
|
120
|
+
return `${(ms / 1000).toFixed(3)}s`;
|
|
121
|
+
}
|
|
122
|
+
|
|
42
123
|
/**
|
|
43
124
|
* Build the environment for a native plugin spawn. Injects `TTSC_TSGO_BINARY`
|
|
44
125
|
* and `TTSC_TTSX_BINARY` alongside the base env from `mergeEnv`. For
|
|
@@ -71,13 +152,26 @@ function nativePluginEnv(
|
|
|
71
152
|
* decide how to surface diagnostics. Does not throw on non-zero exit.
|
|
72
153
|
*/
|
|
73
154
|
export function runBuild(options: RunBuildOptions = {}): TtscBuildResult {
|
|
155
|
+
const timing = createBuildTiming(options);
|
|
156
|
+
const result = runBuildTimed(options, timing);
|
|
157
|
+
return appendTimingOutput(result, timing);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function runBuildTimed(
|
|
161
|
+
options: RunBuildOptions,
|
|
162
|
+
timing: BuildTiming,
|
|
163
|
+
): TtscBuildResult {
|
|
164
|
+
const setupStartedAt = process.hrtime.bigint();
|
|
74
165
|
const execution = resolveExecutionContext(options);
|
|
166
|
+
if (execution.nativePlugins.length > 0) {
|
|
167
|
+
recordTiming(timing, "ttsc plugin setup time", setupStartedAt);
|
|
168
|
+
}
|
|
75
169
|
const buildOptions = applyProjectNoEmit(options, execution);
|
|
76
170
|
if (execution.nativePlugins.length > 0) {
|
|
77
171
|
const compilers = execution.nativePlugins.filter(
|
|
78
172
|
(plugin) => plugin.stage === "transform",
|
|
79
173
|
);
|
|
80
|
-
const checked = runNativeCheckPlugins(buildOptions, execution);
|
|
174
|
+
const checked = runNativeCheckPlugins(buildOptions, execution, timing);
|
|
81
175
|
if (checked.status !== 0) {
|
|
82
176
|
return checked;
|
|
83
177
|
}
|
|
@@ -102,7 +196,12 @@ export function runBuild(options: RunBuildOptions = {}): TtscBuildResult {
|
|
|
102
196
|
assertSharedHostCompatibility(compilers, "emit");
|
|
103
197
|
return appendBuildOutput(
|
|
104
198
|
checked,
|
|
105
|
-
buildWithNativeCompilerPlugins(
|
|
199
|
+
buildWithNativeCompilerPlugins(
|
|
200
|
+
buildOptions,
|
|
201
|
+
execution,
|
|
202
|
+
compilers,
|
|
203
|
+
timing,
|
|
204
|
+
),
|
|
106
205
|
);
|
|
107
206
|
}
|
|
108
207
|
if (checkPluginsReportTypeScriptDiagnostics(execution.nativePlugins)) {
|
|
@@ -119,7 +218,12 @@ export function runBuild(options: RunBuildOptions = {}): TtscBuildResult {
|
|
|
119
218
|
assertSharedHostCompatibility(compilers, "emit");
|
|
120
219
|
result = appendBuildOutput(
|
|
121
220
|
checked,
|
|
122
|
-
buildWithNativeCompilerPlugins(
|
|
221
|
+
buildWithNativeCompilerPlugins(
|
|
222
|
+
buildOptions,
|
|
223
|
+
execution,
|
|
224
|
+
compilers,
|
|
225
|
+
timing,
|
|
226
|
+
),
|
|
123
227
|
);
|
|
124
228
|
} else {
|
|
125
229
|
if (
|
|
@@ -225,15 +329,15 @@ function forwardsTerminalTsgoFlag(options: TtscCommonOptions): boolean {
|
|
|
225
329
|
|
|
226
330
|
/**
|
|
227
331
|
* Report whether the caller forwarded a flag ttsc adds to tsgo internally —
|
|
228
|
-
* e.g. `--listEmittedFiles` (ttsc adds it to learn emitted paths) or
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
332
|
+
* e.g. `--listEmittedFiles` (ttsc adds it to learn emitted paths) or `--noEmit`
|
|
333
|
+
* (ttsc adds it for the pre-emit type-check). When the user also forwards the
|
|
334
|
+
* same flag, post-processing must keep the user-visible effect intact instead
|
|
335
|
+
* of stripping it as ttsc-internal noise.
|
|
232
336
|
*
|
|
233
|
-
* Schema-derived: `FLAG_SCHEMA[*].internalShadow === true`. RC-2 from the
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
337
|
+
* Schema-derived: `FLAG_SCHEMA[*].internalShadow === true`. RC-2 from the RCA
|
|
338
|
+
* (RCA section 3, `--listEmittedFiles` / `--showConfig` swallowed): the
|
|
339
|
+
* per-flag `passthrough.includes("…")` check is now one structural lookup
|
|
340
|
+
* against the schema, not one bespoke `if` per shadow flag.
|
|
237
341
|
*/
|
|
238
342
|
function forwardsInternalShadowFlag(
|
|
239
343
|
options: TtscCommonOptions,
|
|
@@ -262,6 +366,7 @@ function buildWithNativeCompilerPlugins(
|
|
|
262
366
|
options: TtscBuildOptions,
|
|
263
367
|
execution: ReturnType<typeof resolveExecutionContext>,
|
|
264
368
|
plugins: readonly ITtscLoadedNativePlugin[],
|
|
369
|
+
timing: BuildTiming,
|
|
265
370
|
): TtscBuildResult {
|
|
266
371
|
const host = selectSharedHostPlugin(plugins);
|
|
267
372
|
return runNativePluginCommand(
|
|
@@ -270,6 +375,8 @@ function buildWithNativeCompilerPlugins(
|
|
|
270
375
|
options,
|
|
271
376
|
execution,
|
|
272
377
|
"ttsc.build",
|
|
378
|
+
timing,
|
|
379
|
+
transformHostTimingLabel(plugins),
|
|
273
380
|
);
|
|
274
381
|
}
|
|
275
382
|
|
|
@@ -401,13 +508,13 @@ function createTsgoBuildArgs(
|
|
|
401
508
|
*
|
|
402
509
|
* When the user explicitly forwarded `--pretty` (any value), the internal
|
|
403
510
|
* `--pretty false` shadow is dropped so the user wins on the surface. ttsc's
|
|
404
|
-
* own diagnostic parser will then see pretty-formatted output and fall back
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
511
|
+
* own diagnostic parser will then see pretty-formatted output and fall back to
|
|
512
|
+
* surfacing it verbatim — the RC-2 contract that `--pretty`'s `internalShadow:
|
|
513
|
+
* true` flag in `FLAG_SCHEMA` declares. Without this guard the order in
|
|
514
|
+
* `runTsgo` (internal flags first, passthrough last) would still let the user's
|
|
515
|
+
* `--pretty true` override at the tsgo level, but ttsc would have already
|
|
516
|
+
* committed to a structured-diagnostics post-process that no longer matches the
|
|
517
|
+
* actual output.
|
|
411
518
|
*/
|
|
412
519
|
function createTsgoDiagnosticArgs(options: TtscCommonOptions): string[] {
|
|
413
520
|
if (options.structuredDiagnostics !== true) return [];
|
|
@@ -485,6 +592,7 @@ function createNativeCheckArgs(
|
|
|
485
592
|
args.push("--quiet");
|
|
486
593
|
}
|
|
487
594
|
args.push(...createNativeCheckThreadingArgs(options, plugin));
|
|
595
|
+
args.push(...createNativeCheckDiagnosticsArgs(options, plugin));
|
|
488
596
|
args.push(...createNativeTsgoArgs(options));
|
|
489
597
|
return args;
|
|
490
598
|
}
|
|
@@ -505,11 +613,11 @@ function createNativeCheckArgs(
|
|
|
505
613
|
// became a non-measurement. The lint sidecar is built and shipped from this
|
|
506
614
|
// repo, accepts both flags via `parseSubcommandFlags`, and threads them down
|
|
507
615
|
// to `loadProgram` (parse phase) and `engine.SetSerial` (rule walk). The host
|
|
508
|
-
//
|
|
509
|
-
// keeps the strict-host behavior from ad3443a
|
|
510
|
-
//
|
|
511
|
-
//
|
|
512
|
-
//
|
|
616
|
+
// opts in through `capabilities.threadingArgs`, so a third-party check-stage
|
|
617
|
+
// plugin keeps the strict-host behavior from ad3443a unless it declares the
|
|
618
|
+
// same contract. Transform-stage hosts are never reached by this path (they go
|
|
619
|
+
// through `createNativeBuildArgs`), so the typia/nestia regression remains
|
|
620
|
+
// pinned by `test_plugin_corpus_single_threaded_flag_does_not_break_a_native_plugin_build`.
|
|
513
621
|
function createNativeCheckThreadingArgs(
|
|
514
622
|
options: TtscCommonOptions,
|
|
515
623
|
plugin: ITtscLoadedNativePlugin,
|
|
@@ -531,16 +639,16 @@ function createNativeCheckThreadingArgs(
|
|
|
531
639
|
*
|
|
532
640
|
* The lint sidecar (`packages/lint/src/index.ts::createTtscPlugin`) opts in
|
|
533
641
|
* because its `parseSubcommandFlags` handler accepts `--singleThreaded` and
|
|
534
|
-
* `--checkers` directly and threads them into `loadProgram` (parse phase)
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
642
|
+
* `--checkers` directly and threads them into `loadProgram` (parse phase) and
|
|
643
|
+
* `engine.SetSerial` (rule walk). Any other check-stage host that has not
|
|
644
|
+
* declared the capability is treated as a third-party binary whose flag set is
|
|
645
|
+
* unknown, matching the conservative default from commit ad3443a.
|
|
538
646
|
*
|
|
539
|
-
* The capability flag replaces the prior `plugin.name === "@ttsc/lint"`
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
647
|
+
* The capability flag replaces the prior `plugin.name === "@ttsc/lint"` string
|
|
648
|
+
* check: routing on a descriptor field instead of the plugin name lets the next
|
|
649
|
+
* first-party check-stage plugin opt in without ttsc needing to learn its name.
|
|
650
|
+
* See `ITtscPluginCapabilities` and issue #125 for the broader CLI-parser
|
|
651
|
+
* cleanup this is the quick-win step of.
|
|
544
652
|
*/
|
|
545
653
|
function nativeHostAcceptsThreadingArgs(
|
|
546
654
|
plugin: ITtscLoadedNativePlugin,
|
|
@@ -548,6 +656,30 @@ function nativeHostAcceptsThreadingArgs(
|
|
|
548
656
|
return plugin.capabilities?.threadingArgs === true;
|
|
549
657
|
}
|
|
550
658
|
|
|
659
|
+
function createNativeCheckDiagnosticsArgs(
|
|
660
|
+
options: TtscCommonOptions,
|
|
661
|
+
plugin: ITtscLoadedNativePlugin,
|
|
662
|
+
): string[] {
|
|
663
|
+
if (!nativeHostAcceptsDiagnosticsTiming(plugin)) return [];
|
|
664
|
+
if (!hasDiagnosticsFlag(options)) return [];
|
|
665
|
+
return ["--diagnostics"];
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function nativeHostAcceptsDiagnosticsTiming(
|
|
669
|
+
plugin: ITtscLoadedNativePlugin,
|
|
670
|
+
): boolean {
|
|
671
|
+
return plugin.capabilities?.diagnosticsTiming === true;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function transformHostTimingLabel(
|
|
675
|
+
plugins: readonly ITtscLoadedNativePlugin[],
|
|
676
|
+
): string {
|
|
677
|
+
return (
|
|
678
|
+
`ttsc transform host [` +
|
|
679
|
+
`${plugins.map((plugin) => plugin.name).join(", ")}] time`
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
|
|
551
683
|
/**
|
|
552
684
|
* Forward the tsgo flags ttsc did not recognize to a native sidecar as one
|
|
553
685
|
* JSON-encoded `--tsgo-args` flag. The sidecar replays them through tsgo's own
|
|
@@ -556,13 +688,50 @@ function nativeHostAcceptsThreadingArgs(
|
|
|
556
688
|
* single token so the sidecars' unknown-flag filters keep it intact.
|
|
557
689
|
*/
|
|
558
690
|
function createNativeTsgoArgs(options: TtscCommonOptions): string[] {
|
|
559
|
-
const passthrough = options
|
|
691
|
+
const passthrough = nativeTsgoPassthroughArgs(options);
|
|
560
692
|
if (passthrough === undefined || passthrough.length === 0) {
|
|
561
693
|
return [];
|
|
562
694
|
}
|
|
563
695
|
return ["--tsgo-args=" + JSON.stringify(passthrough)];
|
|
564
696
|
}
|
|
565
697
|
|
|
698
|
+
function nativeTsgoPassthroughArgs(
|
|
699
|
+
options: TtscCommonOptions,
|
|
700
|
+
): readonly string[] | undefined {
|
|
701
|
+
const passthrough = options.passthrough;
|
|
702
|
+
if (passthrough === undefined) return undefined;
|
|
703
|
+
const out: string[] = [];
|
|
704
|
+
for (let i = 0; i < passthrough.length; i++) {
|
|
705
|
+
const token = passthrough[i]!;
|
|
706
|
+
if (isDiagnosticsPassthroughFlag(token)) {
|
|
707
|
+
if (
|
|
708
|
+
!token.includes("=") &&
|
|
709
|
+
i + 1 < passthrough.length &&
|
|
710
|
+
isBooleanLiteral(passthrough[i + 1]!)
|
|
711
|
+
) {
|
|
712
|
+
i++;
|
|
713
|
+
}
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
out.push(token);
|
|
717
|
+
}
|
|
718
|
+
return out;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function isDiagnosticsPassthroughFlag(token: string): boolean {
|
|
722
|
+
return (
|
|
723
|
+
token === "--diagnostics" ||
|
|
724
|
+
token.startsWith("--diagnostics=") ||
|
|
725
|
+
token === "--extendedDiagnostics" ||
|
|
726
|
+
token.startsWith("--extendedDiagnostics=")
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function isBooleanLiteral(token: string): boolean {
|
|
731
|
+
const normalized = token.toLowerCase();
|
|
732
|
+
return normalized === "true" || normalized === "false";
|
|
733
|
+
}
|
|
734
|
+
|
|
566
735
|
/**
|
|
567
736
|
* Decide which native plugin subcommand the lint sidecar should run for the
|
|
568
737
|
* current `runBuild` invocation. The launcher selects exactly one of `fix` /
|
|
@@ -598,6 +767,7 @@ function serializeNativePlugins(
|
|
|
598
767
|
function runNativeCheckPlugins(
|
|
599
768
|
options: TtscBuildOptions,
|
|
600
769
|
execution: ReturnType<typeof resolveExecutionContext>,
|
|
770
|
+
timing: BuildTiming,
|
|
601
771
|
): TtscBuildResult {
|
|
602
772
|
let out: TtscBuildResult = {
|
|
603
773
|
diagnostics: [],
|
|
@@ -614,6 +784,8 @@ function runNativeCheckPlugins(
|
|
|
614
784
|
options,
|
|
615
785
|
execution,
|
|
616
786
|
"ttsc.check",
|
|
787
|
+
timing,
|
|
788
|
+
`ttsc check plugin ${plugin.name} time`,
|
|
617
789
|
);
|
|
618
790
|
out = appendBuildOutput(out, result);
|
|
619
791
|
if (result.status !== 0) {
|
|
@@ -634,12 +806,16 @@ function runNativePluginCommand(
|
|
|
634
806
|
options: TtscBuildOptions,
|
|
635
807
|
execution: ReturnType<typeof resolveExecutionContext>,
|
|
636
808
|
label: string,
|
|
809
|
+
timing: BuildTiming,
|
|
810
|
+
timingLabel: string,
|
|
637
811
|
): TtscBuildResult {
|
|
812
|
+
const startedAt = process.hrtime.bigint();
|
|
638
813
|
const res = spawnNative(plugin.binary, args, {
|
|
639
814
|
cwd: execution.projectRoot,
|
|
640
815
|
env: nativePluginEnv(options.env, execution, plugin),
|
|
641
816
|
encoding: "utf8",
|
|
642
817
|
});
|
|
818
|
+
recordTiming(timing, timingLabel, startedAt);
|
|
643
819
|
if (res.error) {
|
|
644
820
|
throw new Error(
|
|
645
821
|
`${label}: failed to spawn ${plugin.binary}: ${res.error.message}`,
|