ttsc 0.6.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 (271) hide show
  1. package/cmd/platform/main.go +1 -1
  2. package/cmd/ttsc/api_compile.go +134 -0
  3. package/cmd/ttsc/api_transform.go +64 -0
  4. package/cmd/ttsc/build.go +1 -7
  5. package/cmd/ttsc/main.go +6 -20
  6. package/driver/program.go +13 -3
  7. package/lib/TtscCompiler.d.ts +96 -0
  8. package/lib/TtscCompiler.js +294 -0
  9. package/lib/TtscCompiler.js.map +1 -0
  10. package/lib/compiler/internal/buildNativeCompiler.d.ts +6 -0
  11. package/lib/compiler/internal/buildNativeCompiler.js +72 -0
  12. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -0
  13. package/lib/compiler/internal/compileProjectInMemory.d.ts +7 -0
  14. package/lib/compiler/internal/compileProjectInMemory.js +176 -0
  15. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -0
  16. package/lib/compiler/internal/project/readProjectConfig.d.ts +4 -0
  17. package/lib/{project.js → compiler/internal/project/readProjectConfig.js} +12 -82
  18. package/lib/compiler/internal/project/readProjectConfig.js.map +1 -0
  19. package/lib/compiler/internal/project/resolveProjectConfig.d.ts +3 -0
  20. package/lib/compiler/internal/project/resolveProjectConfig.js +94 -0
  21. package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -0
  22. package/lib/compiler/internal/resolveBinary.d.ts +4 -0
  23. package/lib/compiler/internal/resolveBinary.js +65 -0
  24. package/lib/compiler/internal/resolveBinary.js.map +1 -0
  25. package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +7 -0
  26. package/lib/compiler/internal/resolveEmittedJavaScript.js +118 -0
  27. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -0
  28. package/lib/compiler/internal/resolveTsgo.d.ts +20 -0
  29. package/lib/{tsgo.js → compiler/internal/resolveTsgo.js} +5 -10
  30. package/lib/compiler/internal/resolveTsgo.js.map +1 -0
  31. package/lib/compiler/internal/runBuild.d.ts +10 -0
  32. package/lib/compiler/internal/runBuild.js +480 -0
  33. package/lib/compiler/internal/runBuild.js.map +1 -0
  34. package/lib/compiler/internal/runSingleFileEmit.d.ts +3 -0
  35. package/lib/compiler/internal/runSingleFileEmit.js +102 -0
  36. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -0
  37. package/lib/compiler/internal/transformProjectInMemory.d.ts +7 -0
  38. package/lib/compiler/internal/transformProjectInMemory.js +275 -0
  39. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -0
  40. package/lib/index.d.ts +6 -15
  41. package/lib/index.js +6 -15
  42. package/lib/index.js.map +1 -1
  43. package/lib/launcher/internal/getCompilerVersionText.d.ts +3 -0
  44. package/lib/launcher/internal/getCompilerVersionText.js +71 -0
  45. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -0
  46. package/lib/launcher/internal/prepareExecution.d.ts +10 -0
  47. package/lib/launcher/internal/prepareExecution.js +120 -0
  48. package/lib/launcher/internal/prepareExecution.js.map +1 -0
  49. package/lib/launcher/internal/runTtsc.d.ts +1 -0
  50. package/lib/{cli.js → launcher/internal/runTtsc.js} +45 -118
  51. package/lib/launcher/internal/runTtsc.js.map +1 -0
  52. package/lib/launcher/internal/runTtsx.d.ts +1 -0
  53. package/lib/{runner/cli.js → launcher/internal/runTtsx.js} +13 -35
  54. package/lib/launcher/internal/runTtsx.js.map +1 -0
  55. package/lib/launcher/ttsc.js +2 -2
  56. package/lib/launcher/ttsc.js.map +1 -1
  57. package/lib/launcher/ttsx.js +2 -2
  58. package/lib/launcher/ttsx.js.map +1 -1
  59. package/lib/plugin/internal/buildSourcePlugin.d.ts +12 -0
  60. package/lib/{source-build.js → plugin/internal/buildSourcePlugin.js} +77 -84
  61. package/lib/plugin/internal/buildSourcePlugin.js.map +1 -0
  62. package/lib/plugin/internal/loadProjectPlugins.d.ts +14 -0
  63. package/lib/{plugin.js → plugin/internal/loadProjectPlugins.js} +38 -76
  64. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -0
  65. package/lib/structures/ITtscCompilerContext.d.ts +78 -0
  66. package/lib/structures/ITtscCompilerContext.js +3 -0
  67. package/lib/structures/ITtscCompilerContext.js.map +1 -0
  68. package/lib/structures/ITtscCompilerDiagnostic.d.ts +83 -0
  69. package/lib/structures/ITtscCompilerDiagnostic.js +3 -0
  70. package/lib/structures/ITtscCompilerDiagnostic.js.map +1 -0
  71. package/lib/structures/ITtscCompilerResult.d.ts +83 -0
  72. package/lib/structures/{ITtscCacheKeyInput.js → ITtscCompilerResult.js} +1 -1
  73. package/lib/structures/ITtscCompilerResult.js.map +1 -0
  74. package/lib/structures/ITtscCompilerTransformation.d.ts +35 -0
  75. package/lib/structures/ITtscCompilerTransformation.js +3 -0
  76. package/lib/structures/ITtscCompilerTransformation.js.map +1 -0
  77. package/lib/structures/ITtscPlugin.d.ts +52 -7
  78. package/lib/structures/ITtscPluginFactoryContext.d.ts +47 -0
  79. package/lib/structures/ITtscProjectPluginConfig.d.ts +41 -0
  80. package/lib/structures/TtscPluginStage.d.ts +18 -0
  81. package/lib/structures/{ITtscBuildResult.js → TtscPluginStage.js} +1 -1
  82. package/lib/structures/TtscPluginStage.js.map +1 -0
  83. package/lib/structures/index.d.ts +8 -0
  84. package/lib/structures/index.js +25 -0
  85. package/lib/structures/index.js.map +1 -0
  86. package/lib/structures/internal/ITtscLoadedNativePlugin.d.ts +13 -0
  87. package/lib/structures/internal/ITtscLoadedNativePlugin.js.map +1 -0
  88. package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +15 -0
  89. package/lib/structures/internal/ITtscParsedProjectConfig.js.map +1 -0
  90. package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +9 -0
  91. package/lib/structures/internal/ITtscProjectLocatorOptions.js.map +1 -0
  92. package/lib/structures/internal/TtscBuildOptions.d.ts +18 -0
  93. package/lib/structures/{ITtscBuildOptions.js → internal/TtscBuildOptions.js} +1 -1
  94. package/lib/structures/internal/TtscBuildOptions.js.map +1 -0
  95. package/lib/structures/internal/TtscBuildResult.d.ts +14 -0
  96. package/lib/structures/{ITtscCheckOptions.js → internal/TtscBuildResult.js} +1 -1
  97. package/lib/structures/internal/TtscBuildResult.js.map +1 -0
  98. package/lib/structures/internal/TtscCommonOptions.d.ts +27 -0
  99. package/lib/structures/{ITtscNativeSource.js → internal/TtscCommonOptions.js} +1 -1
  100. package/lib/structures/internal/TtscCommonOptions.js.map +1 -0
  101. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +14 -0
  102. package/lib/structures/internal/TtscSingleFileEmitOptions.js +3 -0
  103. package/lib/structures/internal/TtscSingleFileEmitOptions.js.map +1 -0
  104. package/package.json +9 -9
  105. package/src/TtscCompiler.ts +305 -0
  106. package/src/compiler/internal/buildNativeCompiler.ts +43 -0
  107. package/src/compiler/internal/compileProjectInMemory.ts +189 -0
  108. package/src/{project.ts → compiler/internal/project/readProjectConfig.ts} +36 -111
  109. package/src/compiler/internal/project/resolveProjectConfig.ts +67 -0
  110. package/src/compiler/internal/resolveBinary.ts +41 -0
  111. package/src/compiler/internal/resolveEmittedJavaScript.ts +102 -0
  112. package/src/{tsgo.ts → compiler/internal/resolveTsgo.ts} +20 -23
  113. package/src/compiler/internal/runBuild.ts +644 -0
  114. package/src/compiler/internal/runSingleFileEmit.ts +73 -0
  115. package/src/compiler/internal/transformProjectInMemory.ts +368 -0
  116. package/src/index.ts +6 -15
  117. package/src/launcher/internal/getCompilerVersionText.ts +44 -0
  118. package/src/launcher/internal/prepareExecution.ts +115 -0
  119. package/src/{cli.ts → launcher/internal/runTtsc.ts} +58 -140
  120. package/src/{runner/cli.ts → launcher/internal/runTtsx.ts} +21 -49
  121. package/src/launcher/ttsc.ts +2 -2
  122. package/src/launcher/ttsx.ts +2 -2
  123. package/src/{source-build.ts → plugin/internal/buildSourcePlugin.ts} +121 -115
  124. package/src/plugin/internal/loadProjectPlugins.ts +214 -0
  125. package/src/structures/ITtscCompilerContext.ts +84 -0
  126. package/src/structures/ITtscCompilerDiagnostic.ts +91 -0
  127. package/src/structures/ITtscCompilerResult.ts +94 -0
  128. package/src/structures/ITtscCompilerTransformation.ts +46 -0
  129. package/src/structures/ITtscPlugin.ts +54 -7
  130. package/src/structures/ITtscPluginFactoryContext.ts +51 -0
  131. package/src/structures/ITtscProjectPluginConfig.ts +43 -0
  132. package/src/structures/TtscPluginStage.ts +18 -0
  133. package/src/structures/index.ts +8 -0
  134. package/src/structures/internal/ITtscLoadedNativePlugin.ts +14 -0
  135. package/src/structures/internal/ITtscParsedProjectConfig.ts +16 -0
  136. package/src/structures/internal/ITtscProjectLocatorOptions.ts +9 -0
  137. package/src/structures/internal/TtscBuildOptions.ts +19 -0
  138. package/src/structures/internal/TtscBuildResult.ts +15 -0
  139. package/src/structures/internal/TtscCommonOptions.ts +28 -0
  140. package/src/structures/internal/TtscSingleFileEmitOptions.ts +15 -0
  141. package/test/compiler.test.ts +422 -0
  142. package/test/platform.test.ts +1 -45
  143. package/test/project.test.ts +3 -1
  144. package/test/source-build.test.ts +33 -220
  145. package/test/tsgo.test.ts +1 -8
  146. package/cmd/ttsc/transform.go +0 -166
  147. package/lib/api.d.ts +0 -40
  148. package/lib/api.js +0 -680
  149. package/lib/api.js.map +0 -1
  150. package/lib/cli.d.ts +0 -1
  151. package/lib/cli.js.map +0 -1
  152. package/lib/native.d.ts +0 -8
  153. package/lib/native.js +0 -42
  154. package/lib/native.js.map +0 -1
  155. package/lib/platform.d.ts +0 -52
  156. package/lib/platform.js +0 -175
  157. package/lib/platform.js.map +0 -1
  158. package/lib/plugin.d.ts +0 -13
  159. package/lib/plugin.js.map +0 -1
  160. package/lib/project.d.ts +0 -14
  161. package/lib/project.js.map +0 -1
  162. package/lib/runner/cli.d.ts +0 -1
  163. package/lib/runner/cli.js.map +0 -1
  164. package/lib/runner/register.d.ts +0 -6
  165. package/lib/runner/register.js +0 -358
  166. package/lib/runner/register.js.map +0 -1
  167. package/lib/source-build.d.ts +0 -19
  168. package/lib/source-build.js.map +0 -1
  169. package/lib/structures/ITtscBuildOptions.d.ts +0 -14
  170. package/lib/structures/ITtscBuildOptions.js.map +0 -1
  171. package/lib/structures/ITtscBuildResult.d.ts +0 -6
  172. package/lib/structures/ITtscBuildResult.js.map +0 -1
  173. package/lib/structures/ITtscBuildSourcePluginOptions.d.ts +0 -8
  174. package/lib/structures/ITtscBuildSourcePluginOptions.js +0 -3
  175. package/lib/structures/ITtscBuildSourcePluginOptions.js.map +0 -1
  176. package/lib/structures/ITtscCacheKeyInput.d.ts +0 -7
  177. package/lib/structures/ITtscCacheKeyInput.js.map +0 -1
  178. package/lib/structures/ITtscCheckOptions.d.ts +0 -2
  179. package/lib/structures/ITtscCheckOptions.js.map +0 -1
  180. package/lib/structures/ITtscCommonOptions.d.ts +0 -22
  181. package/lib/structures/ITtscCommonOptions.js +0 -3
  182. package/lib/structures/ITtscCommonOptions.js.map +0 -1
  183. package/lib/structures/ITtscLoadPluginsOptions.d.ts +0 -8
  184. package/lib/structures/ITtscLoadPluginsOptions.js +0 -3
  185. package/lib/structures/ITtscLoadPluginsOptions.js.map +0 -1
  186. package/lib/structures/ITtscLoadedNativePlugin.d.ts +0 -7
  187. package/lib/structures/ITtscLoadedNativePlugin.js.map +0 -1
  188. package/lib/structures/ITtscLoadedPlugins.d.ts +0 -11
  189. package/lib/structures/ITtscLoadedPlugins.js +0 -3
  190. package/lib/structures/ITtscLoadedPlugins.js.map +0 -1
  191. package/lib/structures/ITtscNativeBackend.d.ts +0 -10
  192. package/lib/structures/ITtscNativeBackend.js +0 -3
  193. package/lib/structures/ITtscNativeBackend.js.map +0 -1
  194. package/lib/structures/ITtscNativePluginContractVersion.d.ts +0 -1
  195. package/lib/structures/ITtscNativePluginContractVersion.js +0 -3
  196. package/lib/structures/ITtscNativePluginContractVersion.js.map +0 -1
  197. package/lib/structures/ITtscNativePluginShape.d.ts +0 -8
  198. package/lib/structures/ITtscNativePluginShape.js +0 -3
  199. package/lib/structures/ITtscNativePluginShape.js.map +0 -1
  200. package/lib/structures/ITtscNativeRewriteMode.d.ts +0 -1
  201. package/lib/structures/ITtscNativeRewriteMode.js +0 -3
  202. package/lib/structures/ITtscNativeRewriteMode.js.map +0 -1
  203. package/lib/structures/ITtscNativeSource.d.ts +0 -4
  204. package/lib/structures/ITtscNativeSource.js.map +0 -1
  205. package/lib/structures/ITtscParsedProjectConfig.d.ts +0 -9
  206. package/lib/structures/ITtscParsedProjectConfig.js.map +0 -1
  207. package/lib/structures/ITtscPluginFactory.d.ts +0 -4
  208. package/lib/structures/ITtscPluginFactory.js +0 -3
  209. package/lib/structures/ITtscPluginFactory.js.map +0 -1
  210. package/lib/structures/ITtscPluginModule.d.ts +0 -3
  211. package/lib/structures/ITtscPluginModule.js +0 -3
  212. package/lib/structures/ITtscPluginModule.js.map +0 -1
  213. package/lib/structures/ITtscPreparedExecution.d.ts +0 -5
  214. package/lib/structures/ITtscPreparedExecution.js +0 -3
  215. package/lib/structures/ITtscPreparedExecution.js.map +0 -1
  216. package/lib/structures/ITtscProjectLocatorOptions.d.ts +0 -5
  217. package/lib/structures/ITtscProjectLocatorOptions.js.map +0 -1
  218. package/lib/structures/ITtscRegisterOptions.d.ts +0 -6
  219. package/lib/structures/ITtscRegisterOptions.js +0 -3
  220. package/lib/structures/ITtscRegisterOptions.js.map +0 -1
  221. package/lib/structures/ITtscResolveGoBinaryOptions.d.ts +0 -7
  222. package/lib/structures/ITtscResolveGoBinaryOptions.js +0 -3
  223. package/lib/structures/ITtscResolveGoBinaryOptions.js.map +0 -1
  224. package/lib/structures/ITtscResolveOptions.d.ts +0 -20
  225. package/lib/structures/ITtscResolveOptions.js +0 -3
  226. package/lib/structures/ITtscResolveOptions.js.map +0 -1
  227. package/lib/structures/ITtscResolvedTsgo.d.ts +0 -8
  228. package/lib/structures/ITtscResolvedTsgo.js +0 -3
  229. package/lib/structures/ITtscResolvedTsgo.js.map +0 -1
  230. package/lib/structures/ITtscTransformOptions.d.ts +0 -12
  231. package/lib/structures/ITtscTransformOptions.js +0 -3
  232. package/lib/structures/ITtscTransformOptions.js.map +0 -1
  233. package/lib/structures/ITtscTsgoResolveOptions.d.ts +0 -14
  234. package/lib/structures/ITtscTsgoResolveOptions.js +0 -3
  235. package/lib/structures/ITtscTsgoResolveOptions.js.map +0 -1
  236. package/lib/tsgo.d.ts +0 -6
  237. package/lib/tsgo.js.map +0 -1
  238. package/src/api.ts +0 -872
  239. package/src/native.ts +0 -64
  240. package/src/platform.ts +0 -151
  241. package/src/plugin.ts +0 -253
  242. package/src/runner/register.ts +0 -406
  243. package/src/structures/ITtscBuildOptions.ts +0 -19
  244. package/src/structures/ITtscBuildResult.ts +0 -6
  245. package/src/structures/ITtscBuildSourcePluginOptions.ts +0 -9
  246. package/src/structures/ITtscCacheKeyInput.ts +0 -7
  247. package/src/structures/ITtscCheckOptions.ts +0 -3
  248. package/src/structures/ITtscCommonOptions.ts +0 -23
  249. package/src/structures/ITtscLoadPluginsOptions.ts +0 -9
  250. package/src/structures/ITtscLoadedNativePlugin.ts +0 -8
  251. package/src/structures/ITtscLoadedPlugins.ts +0 -12
  252. package/src/structures/ITtscNativeBackend.ts +0 -11
  253. package/src/structures/ITtscNativePluginContractVersion.ts +0 -1
  254. package/src/structures/ITtscNativePluginShape.ts +0 -9
  255. package/src/structures/ITtscNativeRewriteMode.ts +0 -1
  256. package/src/structures/ITtscNativeSource.ts +0 -4
  257. package/src/structures/ITtscParsedProjectConfig.ts +0 -10
  258. package/src/structures/ITtscPluginFactory.ts +0 -7
  259. package/src/structures/ITtscPluginModule.ts +0 -4
  260. package/src/structures/ITtscPreparedExecution.ts +0 -5
  261. package/src/structures/ITtscProjectLocatorOptions.ts +0 -5
  262. package/src/structures/ITtscRegisterOptions.ts +0 -7
  263. package/src/structures/ITtscResolveGoBinaryOptions.ts +0 -7
  264. package/src/structures/ITtscResolveOptions.ts +0 -20
  265. package/src/structures/ITtscResolvedTsgo.ts +0 -8
  266. package/src/structures/ITtscTransformOptions.ts +0 -13
  267. package/src/structures/ITtscTsgoResolveOptions.ts +0 -14
  268. package/test/native.test.ts +0 -103
  269. /package/lib/structures/{ITtscLoadedNativePlugin.js → internal/ITtscLoadedNativePlugin.js} +0 -0
  270. /package/lib/structures/{ITtscParsedProjectConfig.js → internal/ITtscParsedProjectConfig.js} +0 -0
  271. /package/lib/structures/{ITtscProjectLocatorOptions.js → internal/ITtscProjectLocatorOptions.js} +0 -0
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITtscCompilerDiagnostic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscCompilerDiagnostic.js","sourceRoot":"","sources":["../../src/structures/ITtscCompilerDiagnostic.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ import type { ITtscCompilerDiagnostic } from "./ITtscCompilerDiagnostic";
2
+ /**
3
+ * Result of a ttsc TypeScript-Go compilation operation.
4
+ *
5
+ * Represents the possible outcomes of {@link TtscCompiler.compile}, which can
6
+ * be either a successful compilation, a compilation that completed with
7
+ * diagnostics, or an unexpected host error during the compilation process.
8
+ *
9
+ * This type follows the legacy `embed-typescript` result model, but stores all
10
+ * emitted text artifacts in {@link ITtscCompilerResult.ISuccess.output} and
11
+ * {@link ITtscCompilerResult.IFailure.output}. TypeScript-Go may emit
12
+ * JavaScript, declaration files, source maps, and declaration maps from one
13
+ * compile operation, so the public result is not limited to JavaScript.
14
+ *
15
+ * @author Jeongho Nam - https://github.com/samchon
16
+ */
17
+ export type ITtscCompilerResult = ITtscCompilerResult.ISuccess | ITtscCompilerResult.IFailure | ITtscCompilerResult.IException;
18
+ export declare namespace ITtscCompilerResult {
19
+ /**
20
+ * Represents a successful ttsc compilation result.
21
+ *
22
+ * This interface is returned when TypeScript-Go completes without
23
+ * diagnostics, containing every text output captured from the native
24
+ * compiler host's `WriteFile` callback.
25
+ */
26
+ interface ISuccess {
27
+ /**
28
+ * Indicates that the compilation was successful.
29
+ */
30
+ type: "success";
31
+ /**
32
+ * The generated compiler output.
33
+ *
34
+ * A record mapping project-relative output file paths to their generated
35
+ * text content. This includes JavaScript, declaration files, source maps,
36
+ * declaration maps, and any other text artifact emitted through
37
+ * TypeScript-Go's `WriteFile` callback.
38
+ */
39
+ output: Record<string, string>;
40
+ }
41
+ /**
42
+ * Represents a ttsc compilation that completed but had diagnostics.
43
+ *
44
+ * This interface is returned when the compiler reports errors, warnings, or
45
+ * other diagnostics during normal compilation. It contains both structured
46
+ * diagnostic information and any output that was still generated despite the
47
+ * diagnostics.
48
+ */
49
+ interface IFailure {
50
+ /**
51
+ * Indicates that compilation completed with diagnostics.
52
+ */
53
+ type: "failure";
54
+ /**
55
+ * Array of diagnostic messages describing the compilation issues.
56
+ */
57
+ diagnostics: ITtscCompilerDiagnostic[];
58
+ /**
59
+ * Any compiler output that was generated despite the diagnostics.
60
+ *
61
+ * This may be partial or empty depending on the severity of the issues and
62
+ * how far TypeScript-Go progressed before returning diagnostics.
63
+ */
64
+ output: Record<string, string>;
65
+ }
66
+ /**
67
+ * Represents an unexpected error during the compilation process.
68
+ *
69
+ * This interface is returned when ttsc cannot prepare, build, or spawn the
70
+ * native compiler host. Normal TypeScript diagnostics are represented by
71
+ * {@link IFailure}; this variant is reserved for host-level exceptions.
72
+ */
73
+ interface IException {
74
+ /**
75
+ * Indicates that an unexpected host error occurred.
76
+ */
77
+ type: "exception";
78
+ /**
79
+ * The error that was thrown while preparing or running the compiler host.
80
+ */
81
+ error: unknown;
82
+ }
83
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscCacheKeyInput.js.map
3
+ //# sourceMappingURL=ITtscCompilerResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscCompilerResult.js","sourceRoot":"","sources":["../../src/structures/ITtscCompilerResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { ITtscCompilerDiagnostic } from "./ITtscCompilerDiagnostic";
2
+ /**
3
+ * Result of a TypeScript source-to-source transformation operation.
4
+ *
5
+ * This mirrors `embed-typescript`'s `IEmbedTypeScriptTransformation` model.
6
+ * Unlike {@link ITtscCompilerResult}, this contract is not an emit contract:
7
+ * the `typescript` map must contain TypeScript source text, not generated
8
+ * JavaScript, declaration files, or source maps.
9
+ */
10
+ export type ITtscCompilerTransformation = ITtscCompilerTransformation.ISuccess | ITtscCompilerTransformation.IFailure | ITtscCompilerTransformation.IException;
11
+ export declare namespace ITtscCompilerTransformation {
12
+ /** Successful source-to-source transformation result. */
13
+ interface ISuccess {
14
+ /** Indicates that transformation completed without diagnostics. */
15
+ type: "success";
16
+ /** Transformed TypeScript source text keyed by project file path. */
17
+ typescript: Record<string, string>;
18
+ }
19
+ /** Source-to-source transformation result that completed with diagnostics. */
20
+ interface IFailure {
21
+ /** Indicates that transformation completed with diagnostics. */
22
+ type: "failure";
23
+ /** Transformed or partially transformed TypeScript source text. */
24
+ typescript: Record<string, string>;
25
+ /** Diagnostics reported during transformation. */
26
+ diagnostics: ITtscCompilerDiagnostic[];
27
+ }
28
+ /** Unexpected host-level error during transformation. */
29
+ interface IException {
30
+ /** Indicates that transformation could not complete normally. */
31
+ type: "exception";
32
+ /** Raw error thrown by the ttsc host. */
33
+ error: unknown;
34
+ }
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITtscCompilerTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscCompilerTransformation.js","sourceRoot":"","sources":["../../src/structures/ITtscCompilerTransformation.ts"],"names":[],"mappings":""}
@@ -1,10 +1,55 @@
1
- import type { ITtscNativeBackend } from "./ITtscNativeBackend";
2
- import type { ITtscNativeRewriteMode } from "./ITtscNativeRewriteMode";
1
+ import type { TtscPluginStage } from "./TtscPluginStage";
2
+ /**
3
+ * Runtime descriptor returned by a ttsc plugin module.
4
+ *
5
+ * A JavaScript plugin entry in `compilerOptions.plugins[]` is only the loading
6
+ * point. After ttsc resolves that JavaScript module, the module must return an
7
+ * `ITtscPlugin` descriptor either directly, as `default`, as `plugin`, or from
8
+ * `createTtscPlugin(context)`.
9
+ *
10
+ * The descriptor tells ttsc which Go command package implements the native
11
+ * sidecar and where that sidecar participates in the TypeScript-Go pipeline.
12
+ * ttsc then builds the Go source lazily with the bundled Go toolchain and
13
+ * passes the original project plugin config to the sidecar through
14
+ * `--plugins-json`.
15
+ */
3
16
  export interface ITtscPlugin {
17
+ /**
18
+ * Stable plugin name used in diagnostics, build messages, and native plugin
19
+ * manifests.
20
+ *
21
+ * Keep this stable across releases. Native sidecars and downstream tooling
22
+ * can use the name to select their own config from the ordered
23
+ * `--plugins-json` payload.
24
+ */
4
25
  name: string;
5
- native?: ITtscNativeBackend;
6
- /** @deprecated Use `native.mode` instead. */
7
- nativeMode?: ITtscNativeRewriteMode;
8
- /** @deprecated Use `native.binary` instead. */
9
- nativeBinary?: string;
26
+ /**
27
+ * Go command package directory, or a `go.mod` file, that ttsc lazily builds.
28
+ *
29
+ * ttsc accepts source only. It does not accept a prebuilt binary path: the
30
+ * package-local Go compiler builds this source into the ttsc plugin cache on
31
+ * demand.
32
+ *
33
+ * Directory sources search upward at most 3 parent directories for `go.mod`;
34
+ * direct `go.mod` sources build the module root as `.`.
35
+ *
36
+ * Common layouts:
37
+ *
38
+ * - `source: "src"` when the plugin package keeps its Go command in `src`.
39
+ * - `source: "plugin"` when the repository has a dedicated Go plugin folder.
40
+ * - `source: "lib"` only when the published package intentionally ships Go
41
+ * source under `lib` instead of compiled JavaScript.
42
+ * - `source: "go.mod"` when the module root itself is the command package.
43
+ */
44
+ source: string;
45
+ /**
46
+ * Pipeline stage implemented by the sidecar.
47
+ *
48
+ * Omit this field for normal compiler-transform plugins. Explicit stages are
49
+ * intended for tools that only validate (`"check"`) or rewrite already
50
+ * emitted files (`"output"`).
51
+ *
52
+ * @default "transform"
53
+ */
54
+ stage?: TtscPluginStage;
10
55
  }
@@ -1,8 +1,55 @@
1
1
  import type { ITtscProjectPluginConfig } from "./ITtscProjectPluginConfig";
2
+ /**
3
+ * Project context passed to `createTtscPlugin()` factories.
4
+ *
5
+ * Plugin packages may export a static {@link ITtscPlugin} descriptor when the
6
+ * descriptor never depends on the consuming project. Export a
7
+ * `createTtscPlugin(context)` factory instead when the descriptor needs to
8
+ * inspect the original plugin config, the resolved tsconfig path, or the
9
+ * project root.
10
+ *
11
+ * The factory runs in Node.js while ttsc is loading `compilerOptions.plugins`.
12
+ * It should only create the descriptor. Heavy validation and TypeScript-Go
13
+ * work belong in the Go sidecar selected by {@link ITtscPlugin.source}.
14
+ */
2
15
  export interface ITtscPluginFactoryContext<T = ITtscProjectPluginConfig> {
16
+ /**
17
+ * Absolute ttsc native helper binary selected for this invocation.
18
+ *
19
+ * This is the package's own native helper, not the plugin sidecar and not the
20
+ * JavaScript launcher. Most plugins do not need it; it is provided for
21
+ * advanced factories that need to derive behavior from the active ttsc
22
+ * native host.
23
+ */
3
24
  binary: string;
25
+ /**
26
+ * Current working directory requested by the caller.
27
+ *
28
+ * This is the cwd used for project discovery and relative command-line
29
+ * inputs. It can differ from {@link ITtscPluginFactoryContext.projectRoot}
30
+ * when the caller points at a tsconfig in another directory.
31
+ */
4
32
  cwd: string;
33
+ /**
34
+ * Original `compilerOptions.plugins[]` entry that loaded this plugin.
35
+ *
36
+ * ttsc reserves `transform` and `enabled`. Every other property is
37
+ * plugin-owned config and is later serialized unchanged into the native
38
+ * sidecar manifest.
39
+ */
5
40
  plugin: T;
41
+ /**
42
+ * Directory containing the resolved tsconfig/jsconfig.
43
+ *
44
+ * Relative plugin module specifiers and plugin source paths are resolved from
45
+ * this directory, matching TypeScript plugin config behavior.
46
+ */
6
47
  projectRoot: string;
48
+ /**
49
+ * Absolute path to the resolved tsconfig/jsconfig.
50
+ *
51
+ * Factories can use this to select descriptor variants for monorepos or
52
+ * multiple project configs without reparsing command-line arguments.
53
+ */
7
54
  tsconfig: string;
8
55
  }
@@ -1,5 +1,46 @@
1
+ /**
2
+ * Raw `compilerOptions.plugins[]` entry read from tsconfig/jsconfig.
3
+ *
4
+ * This is the project-facing config shape that users write in
5
+ * `tsconfig.json`. ttsc deliberately keeps it open-ended because plugin
6
+ * packages own their own config fields.
7
+ *
8
+ * ttsc interprets only two properties:
9
+ *
10
+ * - `transform`: the JavaScript module specifier used to load the plugin
11
+ * descriptor or factory.
12
+ * - `enabled`: an opt-out switch that keeps the config entry in the file while
13
+ * preventing ttsc from loading it.
14
+ *
15
+ * Every other property is preserved as plugin config. After ttsc loads and
16
+ * builds the plugin, the original entry is serialized into the native sidecar
17
+ * manifest so Go code can read exactly the same plugin-specific options.
18
+ */
1
19
  export interface ITtscProjectPluginConfig {
20
+ /**
21
+ * Set to `false` to keep the entry while disabling it for ttsc.
22
+ *
23
+ * This is useful for sharing one tsconfig across environments while turning
24
+ * selected plugins on or off without deleting their config.
25
+ */
2
26
  enabled?: boolean;
27
+ /**
28
+ * Plugin module specifier, relative path, or absolute path to load.
29
+ *
30
+ * Relative paths are resolved from the resolved project root, which is the
31
+ * directory containing the active tsconfig/jsconfig. Package specifiers are
32
+ * resolved with Node's package resolution from that same project root.
33
+ *
34
+ * The loaded JavaScript module must export an {@link ITtscPlugin} descriptor
35
+ * or a `createTtscPlugin(context)` factory. The Go implementation itself is
36
+ * declared by the descriptor's {@link ITtscPlugin.source} field.
37
+ */
3
38
  transform?: string;
39
+ /**
40
+ * Plugin-specific config passed through unchanged to the native sidecar.
41
+ *
42
+ * ttsc does not validate these fields. Plugin packages should document their
43
+ * own config contract and validate it inside their factory or Go sidecar.
44
+ */
4
45
  [key: string]: unknown;
5
46
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Pipeline stage where a plugin's lazily built Go sidecar participates.
3
+ *
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.
11
+ * - `"check"`: runs before emit and reports diagnostics only. Use this for
12
+ * lint or validation plugins that should fail the compile before JavaScript
13
+ * or declaration output is generated.
14
+ * - `"output"`: runs after emit for each emitted output file. Use this for
15
+ * post-processing plugins such as banner insertion, import-path rewriting,
16
+ * or output stripping that operate on `.js`, `.d.ts`, or map files.
17
+ */
18
+ export type TtscPluginStage = "transform" | "check" | "output";
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscBuildResult.js.map
3
+ //# sourceMappingURL=TtscPluginStage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscPluginStage.js","sourceRoot":"","sources":["../../src/structures/TtscPluginStage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export * from "./ITtscCompilerContext";
2
+ export * from "./ITtscCompilerDiagnostic";
3
+ export * from "./ITtscCompilerResult";
4
+ export * from "./ITtscCompilerTransformation";
5
+ export * from "./ITtscPlugin";
6
+ export * from "./ITtscPluginFactoryContext";
7
+ export * from "./ITtscProjectPluginConfig";
8
+ export * from "./TtscPluginStage";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ITtscCompilerContext"), exports);
18
+ __exportStar(require("./ITtscCompilerDiagnostic"), exports);
19
+ __exportStar(require("./ITtscCompilerResult"), exports);
20
+ __exportStar(require("./ITtscCompilerTransformation"), exports);
21
+ __exportStar(require("./ITtscPlugin"), exports);
22
+ __exportStar(require("./ITtscPluginFactoryContext"), exports);
23
+ __exportStar(require("./ITtscProjectPluginConfig"), exports);
24
+ __exportStar(require("./TtscPluginStage"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,wDAAsC;AACtC,gEAA8C;AAC9C,gDAA8B;AAC9B,8DAA4C;AAC5C,6DAA2C;AAC3C,oDAAkC"}
@@ -0,0 +1,13 @@
1
+ import type { ITtscProjectPluginConfig } from "../ITtscProjectPluginConfig";
2
+ import type { TtscPluginStage } from "../TtscPluginStage";
3
+ /** Native sidecar selected and built from one plugin descriptor. */
4
+ export interface ITtscLoadedNativePlugin {
5
+ /** Executable produced by the lazy Go source build cache. */
6
+ binary: string;
7
+ /** Original tsconfig plugin entry passed unchanged to the sidecar. */
8
+ config: ITtscProjectPluginConfig;
9
+ /** Stable plugin name used in diagnostics and native manifests. */
10
+ name: string;
11
+ /** Pipeline stage where the sidecar participates. */
12
+ stage: TtscPluginStage;
13
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscLoadedNativePlugin.js","sourceRoot":"","sources":["../../../src/structures/internal/ITtscLoadedNativePlugin.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { ITtscProjectPluginConfig } from "../ITtscProjectPluginConfig";
2
+ /** Resolved project config subset used inside the ttsc host. */
3
+ export interface ITtscParsedProjectConfig {
4
+ /** Compiler options after extends inheritance has been applied. */
5
+ compilerOptions: {
6
+ /** Absolute output directory when configured. */
7
+ outDir?: string;
8
+ /** Project plugin entries after inheritance resolution. */
9
+ plugins: ITtscProjectPluginConfig[];
10
+ } & Record<string, unknown>;
11
+ /** Absolute path to the resolved tsconfig/jsconfig. */
12
+ path: string;
13
+ /** Directory containing the resolved tsconfig/jsconfig. */
14
+ root: string;
15
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscParsedProjectConfig.js","sourceRoot":"","sources":["../../../src/structures/internal/ITtscParsedProjectConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /** Inputs for locating the tsconfig/jsconfig that owns an invocation. */
2
+ export interface ITtscProjectLocatorOptions {
3
+ /** Working directory for relative paths and upward config discovery. */
4
+ cwd?: string;
5
+ /** Source file used as the starting point for nearest-config discovery. */
6
+ file?: string;
7
+ /** Explicit tsconfig/jsconfig path. */
8
+ tsconfig?: string;
9
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscProjectLocatorOptions.js","sourceRoot":"","sources":["../../../src/structures/internal/ITtscProjectLocatorOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { TtscCommonOptions } from "./TtscCommonOptions";
2
+ /** Internal options for a TypeScript-Go project build. */
3
+ export interface TtscBuildOptions extends TtscCommonOptions {
4
+ /** Project config file to compile. Relative paths are resolved from `cwd`. */
5
+ tsconfig?: string;
6
+ /**
7
+ * Emit override for the current call.
8
+ *
9
+ * - `true`: force file writes even when the project has `noEmit`.
10
+ * - `false`: force diagnostics/check-only behavior.
11
+ * - `undefined`: follow the resolved tsconfig exactly.
12
+ */
13
+ emit?: boolean;
14
+ /** Per-call TypeScript-Go `outDir` override. */
15
+ outDir?: string;
16
+ /** Suppress summary banners from ttsc/native sidecars. Defaults to `true`. */
17
+ quiet?: boolean;
18
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscBuildOptions.js.map
3
+ //# sourceMappingURL=TtscBuildOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscBuildOptions.js","sourceRoot":"","sources":["../../../src/structures/internal/TtscBuildOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { ITtscCompilerDiagnostic } from "../ITtscCompilerDiagnostic";
2
+ /** Internal result captured from TypeScript-Go or native plugin sidecars. */
3
+ export interface TtscBuildResult {
4
+ /** Structured diagnostics collected from compiler output. */
5
+ diagnostics: ITtscCompilerDiagnostic[];
6
+ /** Files written by the build when emitted-file listing was requested. */
7
+ emittedFiles?: string[];
8
+ /** Process-style exit status. `0` means success. */
9
+ status: number;
10
+ /** Captured stdout from TypeScript-Go or native plugin sidecars. */
11
+ stdout: string;
12
+ /** Captured stderr from TypeScript-Go or native plugin sidecars. */
13
+ stderr: string;
14
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscCheckOptions.js.map
3
+ //# sourceMappingURL=TtscBuildResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscBuildResult.js","sourceRoot":"","sources":["../../../src/structures/internal/TtscBuildResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import type { ITtscProjectPluginConfig } from "../ITtscProjectPluginConfig";
2
+ /** Internal options shared by the CLI build, single-file emit, and runtime paths. */
3
+ export interface TtscCommonOptions {
4
+ /**
5
+ * Explicit TypeScript-Go executable.
6
+ *
7
+ * When supplied, ttsc skips package-based tsgo resolution and shells out to
8
+ * this binary directly.
9
+ */
10
+ binary?: string;
11
+ /** Working directory for config discovery and relative file paths. */
12
+ cwd?: string;
13
+ /** Environment variables merged over `process.env` for child processes. */
14
+ env?: NodeJS.ProcessEnv;
15
+ /** Explicit root directory for compiled source-plugin cache artifacts. */
16
+ cacheDir?: string;
17
+ /** Normalize compiler output so diagnostics can be parsed structurally. */
18
+ structuredDiagnostics?: boolean;
19
+ /**
20
+ * Override project plugin loading for this invocation.
21
+ *
22
+ * - `false`: ignore `compilerOptions.plugins` completely.
23
+ * - array: use these plugin entries instead of the project config entries.
24
+ * - `undefined`: use the project config entries as written.
25
+ */
26
+ plugins?: readonly ITtscProjectPluginConfig[] | false;
27
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscNativeSource.js.map
3
+ //# sourceMappingURL=TtscCommonOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscCommonOptions.js","sourceRoot":"","sources":["../../../src/structures/internal/TtscCommonOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { TtscCommonOptions } from "./TtscCommonOptions";
2
+ /** Internal options for emitting one source file through the file-argument path. */
3
+ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
4
+ /** Source file to emit. Absolute paths and `cwd`-relative paths work. */
5
+ file: string;
6
+ /** Project config owning `file`; discovered from `file` when omitted. */
7
+ tsconfig?: string;
8
+ /** Optional output file path. */
9
+ out?: string;
10
+ /** Suppress summary banners from ttsc/native sidecars. Defaults to `true`. */
11
+ quiet?: boolean;
12
+ /** Normalize compiler output so diagnostics can be parsed structurally. */
13
+ structuredDiagnostics?: boolean;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TtscSingleFileEmitOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscSingleFileEmitOptions.js","sourceRoot":"","sources":["../../../src/structures/internal/TtscSingleFileEmitOptions.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttsc",
3
- "version": "0.6.0",
3
+ "version": "0.7.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",
@@ -27,17 +27,17 @@
27
27
  "homepage": "https://github.com/samchon/ttsc",
28
28
  "devDependencies": {
29
29
  "@types/node": "^25.3.0",
30
- "@typescript/native-preview": "7.0.0-dev.20260429.1",
30
+ "@typescript/native-preview": "7.0.0-dev.20260430.1",
31
31
  "rimraf": "^6.1.2"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@ttsc/linux-x64": "0.6.0",
35
- "@ttsc/darwin-x64": "0.6.0",
36
- "@ttsc/darwin-arm64": "0.6.0",
37
- "@ttsc/win32-x64": "0.6.0",
38
- "@ttsc/linux-arm64": "0.6.0",
39
- "@ttsc/win32-arm64": "0.6.0",
40
- "@ttsc/linux-arm": "0.6.0"
34
+ "@ttsc/linux-arm": "0.7.1",
35
+ "@ttsc/linux-arm64": "0.7.1",
36
+ "@ttsc/linux-x64": "0.7.1",
37
+ "@ttsc/win32-x64": "0.7.1",
38
+ "@ttsc/darwin-x64": "0.7.1",
39
+ "@ttsc/win32-arm64": "0.7.1",
40
+ "@ttsc/darwin-arm64": "0.7.1"
41
41
  },
42
42
  "sideEffects": false,
43
43
  "files": [