ttsc 0.7.0 → 0.7.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.
Files changed (41) hide show
  1. package/cmd/platform/main.go +1 -1
  2. package/cmd/ttsc/api_transform.go +64 -0
  3. package/cmd/ttsc/main.go +4 -18
  4. package/driver/program.go +2 -2
  5. package/lib/TtscCompiler.d.ts +20 -0
  6. package/lib/TtscCompiler.js +49 -0
  7. package/lib/TtscCompiler.js.map +1 -1
  8. package/lib/compiler/internal/runSingleFileEmit.d.ts +3 -0
  9. package/lib/compiler/internal/{runTransform.js → runSingleFileEmit.js} +10 -8
  10. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -0
  11. package/lib/compiler/internal/transformProjectInMemory.d.ts +7 -0
  12. package/lib/compiler/internal/transformProjectInMemory.js +275 -0
  13. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -0
  14. package/lib/launcher/internal/runTtsc.js +2 -76
  15. package/lib/launcher/internal/runTtsc.js.map +1 -1
  16. package/lib/structures/ITtscCompilerTransformation.d.ts +35 -0
  17. package/lib/structures/ITtscCompilerTransformation.js +3 -0
  18. package/lib/structures/ITtscCompilerTransformation.js.map +1 -0
  19. package/lib/structures/TtscPluginStage.d.ts +7 -4
  20. package/lib/structures/index.d.ts +1 -0
  21. package/lib/structures/index.js +1 -0
  22. package/lib/structures/index.js.map +1 -1
  23. package/lib/structures/internal/TtscCommonOptions.d.ts +1 -1
  24. package/lib/structures/internal/{TtscTransformOptions.d.ts → TtscSingleFileEmitOptions.d.ts} +4 -4
  25. package/lib/structures/internal/{TtscTransformOptions.js → TtscSingleFileEmitOptions.js} +1 -1
  26. package/lib/structures/internal/TtscSingleFileEmitOptions.js.map +1 -0
  27. package/package.json +8 -8
  28. package/src/TtscCompiler.ts +64 -0
  29. package/src/compiler/internal/{runTransform.ts → runSingleFileEmit.ts} +11 -7
  30. package/src/compiler/internal/transformProjectInMemory.ts +368 -0
  31. package/src/launcher/internal/runTtsc.ts +6 -79
  32. package/src/structures/ITtscCompilerTransformation.ts +46 -0
  33. package/src/structures/TtscPluginStage.ts +7 -4
  34. package/src/structures/index.ts +1 -0
  35. package/src/structures/internal/TtscCommonOptions.ts +1 -1
  36. package/src/structures/internal/{TtscTransformOptions.ts → TtscSingleFileEmitOptions.ts} +4 -4
  37. package/test/compiler.test.ts +196 -8
  38. package/cmd/ttsc/transform.go +0 -160
  39. package/lib/compiler/internal/runTransform.d.ts +0 -3
  40. package/lib/compiler/internal/runTransform.js.map +0 -1
  41. package/lib/structures/internal/TtscTransformOptions.js.map +0 -1
@@ -0,0 +1,368 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+
5
+ import { loadProjectPlugins } from "../../plugin/internal/loadProjectPlugins";
6
+ import type { ITtscCompilerContext } from "../../structures/ITtscCompilerContext";
7
+ import type { ITtscCompilerDiagnostic } from "../../structures/ITtscCompilerDiagnostic";
8
+ import type { ITtscProjectPluginConfig } from "../../structures/ITtscProjectPluginConfig";
9
+ import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin";
10
+ import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscParsedProjectConfig";
11
+ import type { TtscBuildResult } from "../../structures/internal/TtscBuildResult";
12
+ import { buildNativeCompiler } from "./buildNativeCompiler";
13
+ import { readProjectConfig } from "./project/readProjectConfig";
14
+ import { resolveBinary } from "./resolveBinary";
15
+ import { resolveTsgo } from "./resolveTsgo";
16
+
17
+ /** Transform a project and capture TypeScript source output in memory. */
18
+ export function transformProjectInMemory(options: ITtscCompilerContext): {
19
+ result: TtscBuildResult;
20
+ typescript: Record<string, string>;
21
+ } {
22
+ const cwd = path.resolve(options.cwd ?? process.cwd());
23
+ const project = readProjectConfig({
24
+ cwd,
25
+ tsconfig: options.tsconfig,
26
+ });
27
+ if (configuredPlugins(options, project).length !== 0) {
28
+ return transformProjectWithPlugins(options, cwd, project);
29
+ }
30
+ return transformProjectWithNativeHost(options, project);
31
+ }
32
+
33
+ function configuredPlugins(
34
+ options: ITtscCompilerContext,
35
+ project: ITtscParsedProjectConfig,
36
+ ): ITtscProjectPluginConfig[] {
37
+ if (options.plugins === false) {
38
+ return [];
39
+ }
40
+ const entries = options.plugins ?? project.compilerOptions.plugins;
41
+ return entries.filter((entry) => entry.enabled !== false);
42
+ }
43
+
44
+ function transformProjectWithNativeHost(
45
+ options: ITtscCompilerContext,
46
+ project: ITtscParsedProjectConfig,
47
+ ): {
48
+ result: TtscBuildResult;
49
+ typescript: Record<string, string>;
50
+ } {
51
+ const binary = buildNativeCompiler({
52
+ cacheBaseDir: project.root,
53
+ cacheDir: options.cacheDir,
54
+ packageRoot: packageRootDir(),
55
+ });
56
+ const res = spawnNative(
57
+ binary,
58
+ ["api-transform", "--cwd", project.root, "--tsconfig", project.path],
59
+ {
60
+ cwd: project.root,
61
+ env: { ...process.env, ...options.env },
62
+ },
63
+ );
64
+ if (res.error) {
65
+ throw new Error(
66
+ `ttsc: failed to spawn native compiler host ${binary}: ${res.error.message}`,
67
+ );
68
+ }
69
+
70
+ const output = parseNativeTransformOutput(
71
+ outputText(res.stdout),
72
+ outputText(res.stderr),
73
+ );
74
+ return {
75
+ result: {
76
+ diagnostics: output.diagnostics,
77
+ status: res.status ?? 1,
78
+ stdout: "",
79
+ stderr: outputText(res.stderr),
80
+ },
81
+ typescript: output.typescript,
82
+ };
83
+ }
84
+
85
+ function transformProjectWithPlugins(
86
+ options: ITtscCompilerContext,
87
+ cwd: string,
88
+ project: ITtscParsedProjectConfig,
89
+ ): {
90
+ result: TtscBuildResult;
91
+ typescript: Record<string, string>;
92
+ } {
93
+ const loaded = loadProjectPlugins({
94
+ binary: resolveBinary(options) ?? "",
95
+ cacheDir: options.cacheDir ?? options.env?.TTSC_CACHE_DIR,
96
+ cwd,
97
+ entries: options.plugins,
98
+ tsconfig: project.path,
99
+ });
100
+ const checks = loaded.nativePlugins.filter(
101
+ (plugin) => plugin.stage === "check",
102
+ );
103
+ const transformers = loaded.nativePlugins.filter(
104
+ (plugin) => plugin.stage === "transform",
105
+ );
106
+ const checked = runNativeChecks(
107
+ options,
108
+ project,
109
+ loaded.nativePlugins,
110
+ checks,
111
+ );
112
+ if (checked.status !== 0) {
113
+ return {
114
+ result: checked,
115
+ typescript: {},
116
+ };
117
+ }
118
+ if (transformers.length === 0) {
119
+ return transformProjectWithNativeHost(options, project);
120
+ }
121
+ assertSingleTransformHost(transformers);
122
+
123
+ const plugin = transformers[0]!;
124
+ const res = spawnNative(
125
+ plugin.binary,
126
+ createNativeTransformArgs(project, transformers),
127
+ {
128
+ cwd: project.root,
129
+ env: nativePluginEnv(options, project.root),
130
+ },
131
+ );
132
+ if (res.error) {
133
+ throw new Error(
134
+ `ttsc.transform: failed to spawn ${plugin.binary}: ${res.error.message}`,
135
+ );
136
+ }
137
+ const output = parseNativeTransformOutput(
138
+ outputText(res.stdout),
139
+ outputText(res.stderr),
140
+ );
141
+ return {
142
+ result: {
143
+ diagnostics: output.diagnostics,
144
+ status: res.status ?? 1,
145
+ stdout: "",
146
+ stderr: outputText(res.stderr),
147
+ },
148
+ typescript: output.typescript,
149
+ };
150
+ }
151
+
152
+ function runNativeChecks(
153
+ options: ITtscCompilerContext,
154
+ project: ITtscParsedProjectConfig,
155
+ nativePlugins: readonly ITtscLoadedNativePlugin[],
156
+ checks: readonly ITtscLoadedNativePlugin[],
157
+ ): TtscBuildResult {
158
+ let result: TtscBuildResult = {
159
+ diagnostics: [],
160
+ status: 0,
161
+ stdout: "",
162
+ stderr: "",
163
+ };
164
+ for (const plugin of checks) {
165
+ const res = spawnNative(
166
+ plugin.binary,
167
+ createNativeCheckArgs(project, nativePlugins),
168
+ {
169
+ cwd: project.root,
170
+ env: nativePluginEnv(options, project.root),
171
+ },
172
+ );
173
+ if (res.error) {
174
+ throw new Error(
175
+ `ttsc.transform.check: failed to spawn ${plugin.binary}: ${res.error.message}`,
176
+ );
177
+ }
178
+ result = appendBuildResult(result, {
179
+ diagnostics: [],
180
+ status: res.status ?? 1,
181
+ stdout: outputText(res.stdout),
182
+ stderr: outputText(res.stderr),
183
+ });
184
+ if (result.status !== 0) {
185
+ return result;
186
+ }
187
+ }
188
+ return result;
189
+ }
190
+
191
+ function createNativeTransformArgs(
192
+ project: ITtscParsedProjectConfig,
193
+ plugins: readonly ITtscLoadedNativePlugin[],
194
+ ): string[] {
195
+ return [
196
+ "transform",
197
+ "--tsconfig=" + project.path,
198
+ "--plugins-json=" + serializeNativePlugins(plugins),
199
+ "--cwd=" + project.root,
200
+ ];
201
+ }
202
+
203
+ function createNativeCheckArgs(
204
+ project: ITtscParsedProjectConfig,
205
+ plugins: readonly ITtscLoadedNativePlugin[],
206
+ ): string[] {
207
+ return [
208
+ "check",
209
+ "--tsconfig=" + project.path,
210
+ "--plugins-json=" + serializeNativePlugins(plugins),
211
+ "--cwd=" + project.root,
212
+ ];
213
+ }
214
+
215
+ function serializeNativePlugins(
216
+ plugins: readonly ITtscLoadedNativePlugin[],
217
+ ): string {
218
+ return JSON.stringify(
219
+ plugins.map((plugin) => ({
220
+ config: plugin.config,
221
+ name: plugin.name,
222
+ stage: plugin.stage,
223
+ })),
224
+ );
225
+ }
226
+
227
+ function assertSingleTransformHost(
228
+ plugins: readonly ITtscLoadedNativePlugin[],
229
+ ): void {
230
+ const binaries = [...new Set(plugins.map((plugin) => plugin.binary))];
231
+ if (binaries.length > 1) {
232
+ throw new Error(
233
+ "ttsc: multiple transform native backends cannot share one source-to-source pass",
234
+ );
235
+ }
236
+ }
237
+
238
+ function appendBuildResult(
239
+ left: TtscBuildResult,
240
+ right: TtscBuildResult,
241
+ ): TtscBuildResult {
242
+ return {
243
+ diagnostics: [...left.diagnostics, ...right.diagnostics],
244
+ status: right.status !== 0 ? right.status : left.status,
245
+ stdout: left.stdout + right.stdout,
246
+ stderr: left.stderr + right.stderr,
247
+ };
248
+ }
249
+
250
+ function nativePluginEnv(
251
+ options: ITtscCompilerContext,
252
+ projectRoot: string,
253
+ ): NodeJS.ProcessEnv {
254
+ const tsgo = resolveTsgo({ ...options, cwd: projectRoot });
255
+ return {
256
+ ...process.env,
257
+ TTSC_NODE_BINARY: process.env.TTSC_NODE_BINARY ?? process.execPath,
258
+ TTSC_TSGO_BINARY: process.env.TTSC_TSGO_BINARY ?? tsgo.binary,
259
+ TTSC_TTSX_BINARY:
260
+ process.env.TTSC_TTSX_BINARY ??
261
+ path.join(__dirname, "..", "..", "launcher", "ttsx.js"),
262
+ ...options.env,
263
+ };
264
+ }
265
+
266
+ function spawnNative(
267
+ binary: string,
268
+ args: readonly string[],
269
+ options: {
270
+ cwd?: string;
271
+ env?: NodeJS.ProcessEnv;
272
+ },
273
+ ) {
274
+ const viaNode = /\.(?:[cm]?js|ts)$/i.test(binary);
275
+ if (!viaNode) {
276
+ ensureExecutable(binary);
277
+ }
278
+ return spawnSync(
279
+ viaNode ? process.execPath : binary,
280
+ viaNode ? [binary, ...args] : [...args],
281
+ {
282
+ cwd: options.cwd,
283
+ encoding: "utf8",
284
+ env: options.env,
285
+ maxBuffer: 1024 * 1024 * 256,
286
+ windowsHide: true,
287
+ },
288
+ );
289
+ }
290
+
291
+ function ensureExecutable(binary: string): void {
292
+ if (process.platform === "win32") {
293
+ return;
294
+ }
295
+ try {
296
+ const mode = fs.statSync(binary).mode & 0o777;
297
+ if ((mode & 0o111) !== 0) {
298
+ return;
299
+ }
300
+ fs.chmodSync(binary, mode | 0o755);
301
+ } catch {
302
+ /* keep the original spawn error path */
303
+ }
304
+ }
305
+
306
+ function outputText(value: string | Buffer | null | undefined): string {
307
+ if (value == null) {
308
+ return "";
309
+ }
310
+ return typeof value === "string" ? value : value.toString("utf8");
311
+ }
312
+
313
+ function parseNativeTransformOutput(
314
+ stdout: string,
315
+ stderr: string,
316
+ ): {
317
+ diagnostics: ITtscCompilerDiagnostic[];
318
+ typescript: Record<string, string>;
319
+ } {
320
+ try {
321
+ const parsed = JSON.parse(stdout) as {
322
+ diagnostics?: ITtscCompilerDiagnostic[];
323
+ typescript?: Record<string, string>;
324
+ };
325
+ if (!isTextRecord(parsed.typescript)) {
326
+ throw new Error(
327
+ "ttsc: native transform host did not return a TypeScript source map",
328
+ );
329
+ }
330
+ return {
331
+ diagnostics: Array.isArray(parsed.diagnostics) ? parsed.diagnostics : [],
332
+ typescript: parsed.typescript,
333
+ };
334
+ } catch (error) {
335
+ if (error instanceof Error && !(error instanceof SyntaxError)) {
336
+ throw error;
337
+ }
338
+ throw new Error(
339
+ (stderr || stdout).trim() ||
340
+ "ttsc: native transform host returned no output",
341
+ );
342
+ }
343
+ }
344
+
345
+ function isTextRecord(value: unknown): value is Record<string, string> {
346
+ return (
347
+ typeof value === "object" &&
348
+ value !== null &&
349
+ Object.values(value).every((entry) => typeof entry === "string")
350
+ );
351
+ }
352
+
353
+ function packageRootDir(): string {
354
+ let current = path.resolve(__dirname);
355
+ while (true) {
356
+ if (
357
+ fs.existsSync(path.join(current, "package.json")) &&
358
+ fs.existsSync(path.join(current, "go.mod"))
359
+ ) {
360
+ return fs.realpathSync.native?.(current) ?? fs.realpathSync(current);
361
+ }
362
+ const parent = path.dirname(current);
363
+ if (parent === current) {
364
+ throw new Error("ttsc: package root not found for native compiler build");
365
+ }
366
+ current = parent;
367
+ }
368
+ }
@@ -4,13 +4,14 @@ import * as path from "node:path";
4
4
 
5
5
  import { resolveBinary } from "../../compiler/internal/resolveBinary";
6
6
  import { runBuild } from "../../compiler/internal/runBuild";
7
- import { runTransform } from "../../compiler/internal/runTransform";
7
+ import { runSingleFileEmit } from "../../compiler/internal/runSingleFileEmit";
8
8
  import { resolveProjectConfig } from "../../compiler/internal/project/resolveProjectConfig";
9
9
  import type { TtscBuildOptions } from "../../structures/internal/TtscBuildOptions";
10
- import type { TtscTransformOptions } from "../../structures/internal/TtscTransformOptions";
11
10
  import { getCompilerVersionText } from "./getCompilerVersionText";
12
11
 
13
- export function runTtsc(argv: readonly string[] = process.argv.slice(2)): number {
12
+ export function runTtsc(
13
+ argv: readonly string[] = process.argv.slice(2),
14
+ ): number {
14
15
  try {
15
16
  if (argv.length === 0) {
16
17
  return runCompatibleBuild([], false);
@@ -34,8 +35,6 @@ export function runTtsc(argv: readonly string[] = process.argv.slice(2)): number
34
35
  return runCompatibleBuild(rest, true);
35
36
  case "clean":
36
37
  return runClean(rest);
37
- case "transform":
38
- return runTransformCommand(rest);
39
38
  case "demo":
40
39
  return delegateToNative(argv);
41
40
  case "-p":
@@ -83,15 +82,6 @@ function runCompatibleBuild(
83
82
  return result.status;
84
83
  }
85
84
 
86
- function runTransformCommand(argv: readonly string[]): number {
87
- const options = parseTransformArgs(argv);
88
- const text = runTransform(options);
89
- if (!options.out) {
90
- process.stdout.write(text);
91
- }
92
- return 0;
93
- }
94
-
95
85
  function runClean(argv: readonly string[]): number {
96
86
  const options = parseCleanArgs(argv);
97
87
  const cwd = path.resolve(options.cwd ?? process.cwd());
@@ -216,10 +206,7 @@ function parseCleanArgs(argv: readonly string[]) {
216
206
  return { cwd, tsconfig };
217
207
  }
218
208
 
219
- function parseBuildArgs(
220
- argv: readonly string[],
221
- checkOnly: boolean,
222
- ) {
209
+ function parseBuildArgs(argv: readonly string[], checkOnly: boolean) {
223
210
  let binary: string | undefined;
224
211
  let cwd: string | undefined;
225
212
  let emit: boolean | undefined = checkOnly ? false : undefined;
@@ -306,64 +293,6 @@ function parseBuildArgs(
306
293
  };
307
294
  }
308
295
 
309
- function parseTransformArgs(argv: readonly string[]): TtscTransformOptions {
310
- let binary: string | undefined;
311
- let cwd: string | undefined;
312
- let file: string | undefined;
313
- let out: string | undefined;
314
- let tsconfig: string | undefined;
315
-
316
- const rest = [...argv];
317
- while (rest.length !== 0) {
318
- const current = rest.shift()!;
319
- switch (current) {
320
- case "--binary":
321
- binary = takeValue(current, rest);
322
- break;
323
- case "--cwd":
324
- cwd = takeValue(current, rest);
325
- break;
326
- case "--file":
327
- file = takeValue(current, rest);
328
- break;
329
- case "--out":
330
- out = takeValue(current, rest);
331
- break;
332
- case "--tsconfig":
333
- case "--project":
334
- tsconfig = takeValue(current, rest);
335
- break;
336
- default:
337
- if (current.startsWith("--binary=")) {
338
- binary = current.slice("--binary=".length);
339
- } else if (current.startsWith("--cwd=")) {
340
- cwd = current.slice("--cwd=".length);
341
- } else if (current.startsWith("--file=")) {
342
- file = current.slice("--file=".length);
343
- } else if (current.startsWith("--out=")) {
344
- out = current.slice("--out=".length);
345
- } else if (current.startsWith("--tsconfig=")) {
346
- tsconfig = current.slice("--tsconfig=".length);
347
- } else if (current.startsWith("--project=")) {
348
- tsconfig = current.slice("--project=".length);
349
- } else {
350
- throw new Error(`ttsc: unknown option ${current}`);
351
- }
352
- break;
353
- }
354
- }
355
- if (!file) {
356
- throw new Error("ttsc: transform requires --file");
357
- }
358
- return {
359
- binary,
360
- cwd,
361
- file,
362
- out,
363
- tsconfig,
364
- };
365
- }
366
-
367
296
  function printHelp(): void {
368
297
  process.stdout.write(
369
298
  [
@@ -375,7 +304,6 @@ function printHelp(): void {
375
304
  " ttsc --watch",
376
305
  " ttsc --noEmit",
377
306
  " ttsc clean [options]",
378
- " ttsc transform --file <path> [options]",
379
307
  " ttsc version",
380
308
  " ttsc --help",
381
309
  "",
@@ -390,7 +318,6 @@ function printHelp(): void {
390
318
  " --outDir <dir> Override compilerOptions.outDir for this invocation",
391
319
  " --quiet Keep build output quiet (default)",
392
320
  " --verbose Print the build summary and emitted files",
393
- " --out <path> Write transform output to a file instead of stdout",
394
321
  " --binary <path> Use an explicit tsgo binary",
395
322
  "",
396
323
  "Plugin contract:",
@@ -416,7 +343,7 @@ function runSingleFile(options: ReturnType<typeof parseBuildArgs>): number {
416
343
  const cwd = path.resolve(options.cwd ?? process.cwd());
417
344
  const file = path.resolve(cwd, options.files[0]!);
418
345
  const out = resolveSingleFileOut(file, cwd, options.outDir);
419
- const text = runTransform({
346
+ const text = runSingleFileEmit({
420
347
  binary: options.binary,
421
348
  cwd,
422
349
  file,
@@ -0,0 +1,46 @@
1
+ import type { ITtscCompilerDiagnostic } from "./ITtscCompilerDiagnostic";
2
+
3
+ /**
4
+ * Result of a TypeScript source-to-source transformation operation.
5
+ *
6
+ * This mirrors `embed-typescript`'s `IEmbedTypeScriptTransformation` model.
7
+ * Unlike {@link ITtscCompilerResult}, this contract is not an emit contract:
8
+ * the `typescript` map must contain TypeScript source text, not generated
9
+ * JavaScript, declaration files, or source maps.
10
+ */
11
+ export type ITtscCompilerTransformation =
12
+ | ITtscCompilerTransformation.ISuccess
13
+ | ITtscCompilerTransformation.IFailure
14
+ | ITtscCompilerTransformation.IException;
15
+
16
+ export namespace ITtscCompilerTransformation {
17
+ /** Successful source-to-source transformation result. */
18
+ export interface ISuccess {
19
+ /** Indicates that transformation completed without diagnostics. */
20
+ type: "success";
21
+
22
+ /** Transformed TypeScript source text keyed by project file path. */
23
+ typescript: Record<string, string>;
24
+ }
25
+
26
+ /** Source-to-source transformation result that completed with diagnostics. */
27
+ export interface IFailure {
28
+ /** Indicates that transformation completed with diagnostics. */
29
+ type: "failure";
30
+
31
+ /** Transformed or partially transformed TypeScript source text. */
32
+ typescript: Record<string, string>;
33
+
34
+ /** Diagnostics reported during transformation. */
35
+ diagnostics: ITtscCompilerDiagnostic[];
36
+ }
37
+
38
+ /** Unexpected host-level error during transformation. */
39
+ export interface IException {
40
+ /** Indicates that transformation could not complete normally. */
41
+ type: "exception";
42
+
43
+ /** Raw error thrown by the ttsc host. */
44
+ error: unknown;
45
+ }
46
+ }
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Pipeline stage where a plugin's lazily built Go sidecar participates.
3
3
  *
4
- * - `"transform"`: owns the TypeScript-Go emit pass. This is the default and
5
- * is the right stage for compiler-transform plugins such as typia-style
6
- * source rewrites. A transform sidecar receives the ordered plugin manifest
7
- * and is responsible for producing the project's emitted output.
4
+ * - `"transform"`: owns the TypeScript transform/emit pass. This is the
5
+ * default and is the right stage for compiler-transform plugins such as
6
+ * typia-style source rewrites. During compilation, a transform sidecar
7
+ * produces the project's emitted output. During
8
+ * {@link TtscCompiler.transform}, the same sidecar may expose a
9
+ * source-to-source `transform` command that returns transformed TypeScript
10
+ * text.
8
11
  * - `"check"`: runs before emit and reports diagnostics only. Use this for
9
12
  * lint or validation plugins that should fail the compile before JavaScript
10
13
  * or declaration output is generated.
@@ -1,6 +1,7 @@
1
1
  export * from "./ITtscCompilerContext";
2
2
  export * from "./ITtscCompilerDiagnostic";
3
3
  export * from "./ITtscCompilerResult";
4
+ export * from "./ITtscCompilerTransformation";
4
5
  export * from "./ITtscPlugin";
5
6
  export * from "./ITtscPluginFactoryContext";
6
7
  export * from "./ITtscProjectPluginConfig";
@@ -1,6 +1,6 @@
1
1
  import type { ITtscProjectPluginConfig } from "../ITtscProjectPluginConfig";
2
2
 
3
- /** Internal options shared by the CLI build, transform, and runtime paths. */
3
+ /** Internal options shared by the CLI build, single-file emit, and runtime paths. */
4
4
  export interface TtscCommonOptions {
5
5
  /**
6
6
  * Explicit TypeScript-Go executable.
@@ -1,12 +1,12 @@
1
1
  import type { TtscCommonOptions } from "./TtscCommonOptions";
2
2
 
3
- /** Internal options for transforming one source file through the CLI path. */
4
- export interface TtscTransformOptions extends TtscCommonOptions {
5
- /** Source file to transform. Absolute paths and `cwd`-relative paths work. */
3
+ /** Internal options for emitting one source file through the file-argument path. */
4
+ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
5
+ /** Source file to emit. Absolute paths and `cwd`-relative paths work. */
6
6
  file: string;
7
7
  /** Project config owning `file`; discovered from `file` when omitted. */
8
8
  tsconfig?: string;
9
- /** Optional output file path. Omit to return emitted text from stdout. */
9
+ /** Optional output file path. */
10
10
  out?: string;
11
11
  /** Suppress summary banners from ttsc/native sidecars. Defaults to `true`. */
12
12
  quiet?: boolean;