ttsc 0.8.0 → 0.9.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 +75 -66
- package/cmd/ttsc/api_compile.go +5 -1
- package/driver/program.go +23 -1
- package/driver/rewrite.go +126 -9
- package/driver/rewrite_test.go +52 -0
- package/lib/TtscCompiler.js +28 -46
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/compiler/internal/buildNativeCompiler.js +8 -38
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.js +36 -63
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/project/readProjectConfig.js +108 -60
- package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
- package/lib/compiler/internal/project/resolveProjectConfig.js +15 -45
- package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -1
- package/lib/compiler/internal/resolveBinary.js +10 -40
- package/lib/compiler/internal/resolveBinary.js.map +1 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.js +21 -48
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
- package/lib/compiler/internal/resolveTsgo.js +14 -44
- package/lib/compiler/internal/resolveTsgo.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +7 -0
- package/lib/compiler/internal/runBuild.js +47 -66
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.js +18 -48
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.js +41 -75
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/launcher/internal/getCompilerVersionText.js +7 -37
- package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
- package/lib/launcher/internal/prepareExecution.js +48 -69
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +53 -64
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +328 -57
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/plugin/internal/buildSourcePlugin.d.ts +8 -0
- package/lib/plugin/internal/buildSourcePlugin.js +179 -125
- package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/loadProjectPlugins.d.ts +2 -0
- package/lib/plugin/internal/loadProjectPlugins.js +197 -9
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/structures/ITtscCompilerContext.d.ts +16 -3
- package/lib/structures/ITtscCompilerResult.d.ts +4 -0
- package/lib/structures/ITtscCompilerTransformation.d.ts +2 -0
- package/lib/structures/ITtscPluginFactoryContext.d.ts +6 -3
- package/lib/structures/ITtscProjectPluginConfig.d.ts +8 -7
- package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +2 -0
- package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +2 -0
- package/lib/structures/internal/TtscCommonOptions.d.ts +2 -0
- package/package.json +9 -14
- package/shim/diagnosticwriter/lint.go +8 -0
- package/src/TtscCompiler.ts +20 -5
- package/src/compiler/internal/buildNativeCompiler.ts +2 -2
- package/src/compiler/internal/compileProjectInMemory.ts +21 -16
- package/src/compiler/internal/project/readProjectConfig.ts +134 -35
- package/src/compiler/internal/project/resolveProjectConfig.ts +2 -2
- package/src/compiler/internal/resolveBinary.ts +2 -2
- package/src/compiler/internal/resolveEmittedJavaScript.ts +11 -7
- package/src/compiler/internal/resolveTsgo.ts +2 -2
- package/src/compiler/internal/runBuild.ts +34 -21
- package/src/compiler/internal/runSingleFileEmit.ts +3 -3
- package/src/compiler/internal/transformProjectInMemory.ts +37 -37
- package/src/launcher/internal/getCompilerVersionText.ts +2 -2
- package/src/launcher/internal/prepareExecution.ts +14 -4
- package/src/launcher/internal/runTtsc.ts +30 -4
- package/src/launcher/internal/runTtsx.ts +377 -26
- package/src/plugin/internal/buildSourcePlugin.ts +127 -32
- package/src/plugin/internal/loadProjectPlugins.ts +266 -10
- package/src/structures/ITtscCompilerContext.ts +17 -3
- package/src/structures/ITtscCompilerResult.ts +5 -0
- package/src/structures/ITtscCompilerTransformation.ts +3 -0
- package/src/structures/ITtscPluginFactoryContext.ts +6 -3
- package/src/structures/ITtscProjectPluginConfig.ts +8 -7
- package/src/structures/internal/ITtscParsedProjectConfig.ts +2 -0
- package/src/structures/internal/ITtscProjectLocatorOptions.ts +2 -0
- package/src/structures/internal/TtscCommonOptions.ts +2 -0
- package/utility/host.go +610 -18
- package/utility/host_test.go +162 -0
- package/test/compiler.test.ts +0 -422
- package/test/platform.test.ts +0 -12
- package/test/project.test.ts +0 -197
- package/test/source-build.test.ts +0 -45
- package/test/tsgo.test.ts +0 -69
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadProjectPlugins = loadProjectPlugins;
|
|
7
|
+
exports.hasProjectPluginEntries = hasProjectPluginEntries;
|
|
7
8
|
const node_module_1 = require("node:module");
|
|
8
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -13,11 +14,12 @@ function loadProjectPlugins(options) {
|
|
|
13
14
|
const project = (0, readProjectConfig_1.readProjectConfig)({
|
|
14
15
|
cwd: options.cwd,
|
|
15
16
|
file: options.file,
|
|
17
|
+
projectRoot: options.projectRoot,
|
|
16
18
|
tsconfig: options.tsconfig,
|
|
17
19
|
});
|
|
18
20
|
const entries = options.entries === false
|
|
19
21
|
? []
|
|
20
|
-
:
|
|
22
|
+
: resolvePluginEntries(project, options.entries).filter((entry) => entry.config.enabled !== false);
|
|
21
23
|
if (entries.length === 0) {
|
|
22
24
|
return {
|
|
23
25
|
nativePlugins: [],
|
|
@@ -30,7 +32,7 @@ function loadProjectPlugins(options) {
|
|
|
30
32
|
projectRoot: project.root,
|
|
31
33
|
tsconfig: project.path,
|
|
32
34
|
};
|
|
33
|
-
const plugins = entries.map((entry) => loadPluginEntry(entry, { ...context, plugin: entry }));
|
|
35
|
+
const plugins = entries.map((entry) => loadPluginEntry(entry.config, { ...context, plugin: entry.config }, entry.baseDir));
|
|
34
36
|
const nativePlugins = [];
|
|
35
37
|
const ttscVersion = readTtscVersion();
|
|
36
38
|
const tsgoVersion = readTsgoVersion(context.projectRoot);
|
|
@@ -47,23 +49,201 @@ function loadProjectPlugins(options) {
|
|
|
47
49
|
});
|
|
48
50
|
nativePlugins.push({
|
|
49
51
|
binary,
|
|
50
|
-
config: entries[index],
|
|
52
|
+
config: entries[index].config,
|
|
51
53
|
name: plugin.name,
|
|
52
54
|
source: plugin.source,
|
|
53
55
|
stage,
|
|
54
56
|
});
|
|
55
57
|
});
|
|
56
58
|
return {
|
|
57
|
-
nativePlugins,
|
|
59
|
+
nativePlugins: orderNativePlugins(nativePlugins),
|
|
58
60
|
project,
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
|
-
function
|
|
63
|
+
function hasProjectPluginEntries(project, entries) {
|
|
64
|
+
if (entries === false) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return resolvePluginEntries(project, entries).some((entry) => entry.config.enabled !== false);
|
|
68
|
+
}
|
|
69
|
+
function resolvePluginEntries(project, entries) {
|
|
70
|
+
if (entries !== undefined) {
|
|
71
|
+
return entries.map((config) => ({
|
|
72
|
+
baseDir: project.root,
|
|
73
|
+
config,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
const configured = project.compilerOptions.plugins.map((config, index) => ({
|
|
77
|
+
baseDir: project.pluginBaseDirs[index] ?? project.root,
|
|
78
|
+
config,
|
|
79
|
+
}));
|
|
80
|
+
return [...configured, ...discoverPackagePluginEntries(project, configured)];
|
|
81
|
+
}
|
|
82
|
+
function discoverPackagePluginEntries(project, configured) {
|
|
83
|
+
const projectPackageJson = findNearestPackageJson(project.root);
|
|
84
|
+
if (projectPackageJson === undefined) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const projectPackageRoot = node_path_1.default.dirname(projectPackageJson);
|
|
88
|
+
const projectManifest = readPackageManifest(projectPackageJson);
|
|
89
|
+
if (projectManifest === undefined) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
const configuredTransforms = createConfiguredTransformSet(configured);
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const name of directDependencyNames(projectManifest)) {
|
|
95
|
+
const packageJson = resolveDependencyPackageJson(name, projectPackageRoot);
|
|
96
|
+
if (packageJson === undefined) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const manifest = readPackageManifest(packageJson);
|
|
100
|
+
const config = readPackagePluginConfig(name, manifest);
|
|
101
|
+
if (config === undefined || config.enabled === false) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const packageRoot = node_path_1.default.dirname(packageJson);
|
|
105
|
+
const transform = config.transform;
|
|
106
|
+
if (typeof transform !== "string") {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const baseDir = isRelativePluginSpecifier(transform)
|
|
110
|
+
? packageRoot
|
|
111
|
+
: projectPackageRoot;
|
|
112
|
+
const resolved = resolvePluginRequest(transform, baseDir);
|
|
113
|
+
if (hasConfiguredTransform(configuredTransforms, transform, resolved)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
out.push({
|
|
117
|
+
baseDir,
|
|
118
|
+
config,
|
|
119
|
+
});
|
|
120
|
+
addConfiguredTransform(configuredTransforms, transform, resolved);
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
function createConfiguredTransformSet(entries) {
|
|
125
|
+
const raw = new Set();
|
|
126
|
+
const resolved = new Set();
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
const transform = entry.config.transform;
|
|
129
|
+
if (typeof transform !== "string" || transform.length === 0) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (!isRelativePluginSpecifier(transform)) {
|
|
133
|
+
raw.add(transform);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
resolved.add(resolvePluginRequest(transform, entry.baseDir));
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Keep the normal plugin loading error path for invalid explicit entries.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { raw, resolved };
|
|
143
|
+
}
|
|
144
|
+
function hasConfiguredTransform(configuredTransforms, transform, resolved) {
|
|
145
|
+
return (configuredTransforms.resolved.has(resolved) ||
|
|
146
|
+
(!isRelativePluginSpecifier(transform) &&
|
|
147
|
+
configuredTransforms.raw.has(transform)));
|
|
148
|
+
}
|
|
149
|
+
function addConfiguredTransform(configuredTransforms, transform, resolved) {
|
|
150
|
+
if (!isRelativePluginSpecifier(transform)) {
|
|
151
|
+
configuredTransforms.raw.add(transform);
|
|
152
|
+
}
|
|
153
|
+
configuredTransforms.resolved.add(resolved);
|
|
154
|
+
}
|
|
155
|
+
function directDependencyNames(manifest) {
|
|
156
|
+
const seen = new Set();
|
|
157
|
+
const out = [];
|
|
158
|
+
for (const dependencies of [
|
|
159
|
+
manifest.dependencies,
|
|
160
|
+
manifest.devDependencies,
|
|
161
|
+
]) {
|
|
162
|
+
if (!isRecord(dependencies)) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
for (const name of Object.keys(dependencies)) {
|
|
166
|
+
if (seen.has(name)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
seen.add(name);
|
|
170
|
+
out.push(name);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return out;
|
|
174
|
+
}
|
|
175
|
+
function resolveDependencyPackageJson(name, projectRoot) {
|
|
176
|
+
const direct = node_path_1.default.join(projectRoot, "node_modules", ...name.split("/"));
|
|
177
|
+
const directManifest = node_path_1.default.join(direct, "package.json");
|
|
178
|
+
if (node_fs_1.default.existsSync(directManifest)) {
|
|
179
|
+
return resolveRealPath(directManifest);
|
|
180
|
+
}
|
|
181
|
+
const projectPackage = node_path_1.default.join(projectRoot, "package.json");
|
|
182
|
+
const projectRequire = (0, node_module_1.createRequire)(projectPackage);
|
|
183
|
+
try {
|
|
184
|
+
return resolveRealPath(projectRequire.resolve(`${name}/package.json`));
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
try {
|
|
188
|
+
return findNearestPackageJson(projectRequire.resolve(name));
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function findNearestPackageJson(location) {
|
|
196
|
+
let current = node_fs_1.default.statSync(location).isDirectory()
|
|
197
|
+
? location
|
|
198
|
+
: node_path_1.default.dirname(location);
|
|
199
|
+
while (true) {
|
|
200
|
+
const manifest = node_path_1.default.join(current, "package.json");
|
|
201
|
+
if (node_fs_1.default.existsSync(manifest)) {
|
|
202
|
+
return resolveRealPath(manifest);
|
|
203
|
+
}
|
|
204
|
+
const parent = node_path_1.default.dirname(current);
|
|
205
|
+
if (parent === current) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
current = parent;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function readPackageManifest(file) {
|
|
212
|
+
if (!node_fs_1.default.existsSync(file)) {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
const parsed = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
|
|
216
|
+
return isRecord(parsed) ? parsed : undefined;
|
|
217
|
+
}
|
|
218
|
+
function readPackagePluginConfig(packageName, manifest) {
|
|
219
|
+
const ttsc = manifest?.ttsc;
|
|
220
|
+
if (!isRecord(ttsc) || !("plugin" in ttsc)) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
const plugin = ttsc.plugin;
|
|
224
|
+
if (!isRecord(plugin) || Array.isArray(plugin)) {
|
|
225
|
+
throw new Error(`ttsc: package ${JSON.stringify(packageName)} declares invalid "ttsc.plugin"; expected an object`);
|
|
226
|
+
}
|
|
227
|
+
if (typeof plugin.transform !== "string" || plugin.transform.length === 0) {
|
|
228
|
+
throw new Error(`ttsc: package ${JSON.stringify(packageName)} declares invalid "ttsc.plugin.transform"; expected a non-empty string`);
|
|
229
|
+
}
|
|
230
|
+
return { ...plugin };
|
|
231
|
+
}
|
|
232
|
+
function isRecord(value) {
|
|
233
|
+
return typeof value === "object" && value !== null;
|
|
234
|
+
}
|
|
235
|
+
function orderNativePlugins(plugins) {
|
|
236
|
+
return [
|
|
237
|
+
...plugins.filter((plugin) => plugin.stage === "check"),
|
|
238
|
+
...plugins.filter((plugin) => plugin.stage === "transform"),
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
function loadPluginEntry(entry, context, baseDir) {
|
|
62
242
|
const specifier = entry.transform;
|
|
63
243
|
if (typeof specifier !== "string" || specifier.length === 0) {
|
|
64
244
|
throw new Error(`ttsc: plugin entry is missing a string "transform" field`);
|
|
65
245
|
}
|
|
66
|
-
const request = resolvePluginRequest(specifier,
|
|
246
|
+
const request = resolvePluginRequest(specifier, baseDir);
|
|
67
247
|
const mod = require(request);
|
|
68
248
|
const candidate = mod.createTtscPlugin ??
|
|
69
249
|
mod.default ??
|
|
@@ -117,12 +297,20 @@ function isPluginStage(value) {
|
|
|
117
297
|
}
|
|
118
298
|
function resolvePluginRequest(specifier, projectRoot) {
|
|
119
299
|
if (node_path_1.default.isAbsolute(specifier)) {
|
|
120
|
-
return specifier;
|
|
300
|
+
return resolveRealPath(specifier);
|
|
121
301
|
}
|
|
122
302
|
if (isRelativePluginSpecifier(specifier)) {
|
|
123
|
-
return node_path_1.default.resolve(projectRoot, specifier);
|
|
303
|
+
return resolveRealPath(node_path_1.default.resolve(projectRoot, specifier));
|
|
304
|
+
}
|
|
305
|
+
return resolveRealPath(require.resolve(specifier, { paths: [projectRoot] }));
|
|
306
|
+
}
|
|
307
|
+
function resolveRealPath(location) {
|
|
308
|
+
try {
|
|
309
|
+
return node_fs_1.default.realpathSync(location);
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
return location;
|
|
124
313
|
}
|
|
125
|
-
return require.resolve(specifier, { paths: [projectRoot] });
|
|
126
314
|
}
|
|
127
315
|
function isRelativePluginSpecifier(specifier) {
|
|
128
316
|
return (specifier === "." ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadProjectPlugins.js","sourceRoot":"","sources":["../../../src/plugin/internal/loadProjectPlugins.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,sDAAyB;AACzB,0DAA6B;AAE7B,yFAAsF;AAOtF,2DAAwD;AAMxD,4BAAmC,OAOlC;IAIC,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;IACH,MAAM,OAAO,GACX,OAAO,CAAC,OAAO,KAAK,KAAK;QACvB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAC9D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CACnC,CAAC;IACR,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;YACL,aAAa,EAAE,EAAE;YACjB,OAAO;SACR,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC/C,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,QAA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S,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -32,6 +32,16 @@ export interface ITtscCompilerContext {
|
|
|
32
32
|
* `jsconfig.json` from the working directory.
|
|
33
33
|
*/
|
|
34
34
|
tsconfig?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Project root override for generated config wrappers.
|
|
37
|
+
*
|
|
38
|
+
* Most callers should leave this unset so the project root is the directory
|
|
39
|
+
* containing {@link ITtscCompilerContext.tsconfig}. Embedders that synthesize
|
|
40
|
+
* a temporary config extending a real project config can set this to keep
|
|
41
|
+
* plugin resolution, cache paths, and native sidecar `--cwd` anchored to the
|
|
42
|
+
* real project.
|
|
43
|
+
*/
|
|
44
|
+
projectRoot?: string;
|
|
35
45
|
/**
|
|
36
46
|
* Explicit TypeScript-Go executable for controlled embedding.
|
|
37
47
|
*
|
|
@@ -67,9 +77,12 @@ export interface ITtscCompilerContext {
|
|
|
67
77
|
/**
|
|
68
78
|
* Plugin entries for this compiler instance.
|
|
69
79
|
*
|
|
70
|
-
* - `undefined`: read `compilerOptions.plugins`
|
|
71
|
-
*
|
|
72
|
-
* -
|
|
80
|
+
* - `undefined`: read project plugins from `compilerOptions.plugins` and
|
|
81
|
+
* directly installed package markers.
|
|
82
|
+
* - `false`: ignore project config plugins and package markers for this
|
|
83
|
+
* compiler instance.
|
|
84
|
+
* - array: use these plugin entries instead of project config entries and
|
|
85
|
+
* package markers.
|
|
73
86
|
*
|
|
74
87
|
* Plugin entries are resolved once per operation from this instance context.
|
|
75
88
|
* Per-call plugin overrides are intentionally not part of the public API.
|
|
@@ -28,6 +28,10 @@ export declare namespace ITtscCompilerResult {
|
|
|
28
28
|
* Indicates that the compilation was successful.
|
|
29
29
|
*/
|
|
30
30
|
type: "success";
|
|
31
|
+
/**
|
|
32
|
+
* Non-fatal diagnostics reported during compilation.
|
|
33
|
+
*/
|
|
34
|
+
diagnostics?: ITtscCompilerDiagnostic[];
|
|
31
35
|
/**
|
|
32
36
|
* The generated compiler output.
|
|
33
37
|
*
|
|
@@ -13,6 +13,8 @@ export declare namespace ITtscCompilerTransformation {
|
|
|
13
13
|
interface ISuccess {
|
|
14
14
|
/** Indicates that transformation completed without diagnostics. */
|
|
15
15
|
type: "success";
|
|
16
|
+
/** Non-fatal diagnostics reported during transformation. */
|
|
17
|
+
diagnostics?: ITtscCompilerDiagnostic[];
|
|
16
18
|
/** Transformed TypeScript source text keyed by project file path. */
|
|
17
19
|
typescript: Record<string, string>;
|
|
18
20
|
}
|
|
@@ -39,10 +39,13 @@ export interface ITtscPluginFactoryContext<T = ITtscProjectPluginConfig> {
|
|
|
39
39
|
*/
|
|
40
40
|
plugin: T;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Project root used as the native plugin working directory and package
|
|
43
|
+
* discovery base.
|
|
43
44
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
45
|
+
* By default this is the directory containing the resolved tsconfig/jsconfig.
|
|
46
|
+
* Callers may override it when a wrapper config lives outside the project.
|
|
47
|
+
* Relative `source` paths returned by a plugin descriptor resolve from this
|
|
48
|
+
* directory.
|
|
46
49
|
*/
|
|
47
50
|
projectRoot: string;
|
|
48
51
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Raw `compilerOptions.plugins[]`
|
|
2
|
+
* Raw plugin entry read from `compilerOptions.plugins[]` or from a directly
|
|
3
|
+
* installed package's `package.json#ttsc.plugin` marker.
|
|
3
4
|
*
|
|
4
|
-
* This is the project-facing config shape that users write in
|
|
5
|
-
* `
|
|
6
|
-
* packages own their own config fields.
|
|
5
|
+
* This is the project-facing config shape that users write in `tsconfig.json`
|
|
6
|
+
* or plugin packages expose through `package.json`. ttsc deliberately keeps it
|
|
7
|
+
* open-ended because plugin packages own their own config fields.
|
|
7
8
|
*
|
|
8
9
|
* ttsc interprets only two properties:
|
|
9
10
|
*
|
|
@@ -27,9 +28,9 @@ export interface ITtscProjectPluginConfig {
|
|
|
27
28
|
/**
|
|
28
29
|
* Plugin module specifier, relative path, or absolute path to load.
|
|
29
30
|
*
|
|
30
|
-
* Relative paths are resolved from the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Relative paths are resolved from the tsconfig/jsconfig file that declared
|
|
32
|
+
* the plugin entry. Package specifiers are resolved with Node's package
|
|
33
|
+
* resolution from that same directory.
|
|
33
34
|
*
|
|
34
35
|
* The loaded JavaScript module must export an {@link ITtscPlugin} descriptor
|
|
35
36
|
* or a `createTtscPlugin(context)` factory. The Go implementation itself is
|
|
@@ -10,6 +10,8 @@ export interface ITtscParsedProjectConfig {
|
|
|
10
10
|
} & Record<string, unknown>;
|
|
11
11
|
/** Absolute path to the resolved tsconfig/jsconfig. */
|
|
12
12
|
path: string;
|
|
13
|
+
/** Directory that declared each inherited plugin entry. */
|
|
14
|
+
pluginBaseDirs: string[];
|
|
13
15
|
/** Directory containing the resolved tsconfig/jsconfig. */
|
|
14
16
|
root: string;
|
|
15
17
|
}
|
|
@@ -4,6 +4,8 @@ export interface ITtscProjectLocatorOptions {
|
|
|
4
4
|
cwd?: string;
|
|
5
5
|
/** Source file used as the starting point for nearest-config discovery. */
|
|
6
6
|
file?: string;
|
|
7
|
+
/** Project root override for generated tsconfig wrappers. */
|
|
8
|
+
projectRoot?: string;
|
|
7
9
|
/** Explicit tsconfig/jsconfig path. */
|
|
8
10
|
tsconfig?: string;
|
|
9
11
|
}
|
|
@@ -10,6 +10,8 @@ export interface TtscCommonOptions {
|
|
|
10
10
|
binary?: string;
|
|
11
11
|
/** Working directory for config discovery and relative file paths. */
|
|
12
12
|
cwd?: string;
|
|
13
|
+
/** Project root override for generated tsconfig wrappers. */
|
|
14
|
+
projectRoot?: string;
|
|
13
15
|
/** Environment variables merged over `process.env` for child processes. */
|
|
14
16
|
env?: NodeJS.ProcessEnv;
|
|
15
17
|
/** Explicit root directory for compiled source-plugin cache artifacts. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttsc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
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.
|
|
30
|
+
"@typescript/native-preview": "7.0.0-dev.20260508.1",
|
|
31
31
|
"rimraf": "^6.1.2"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@ttsc/linux-x64": "0.
|
|
35
|
-
"@ttsc/
|
|
36
|
-
"@ttsc/darwin-arm64": "0.
|
|
37
|
-
"@ttsc/
|
|
38
|
-
"@ttsc/
|
|
39
|
-
"@ttsc/
|
|
40
|
-
"@ttsc/
|
|
34
|
+
"@ttsc/linux-x64": "0.9.0",
|
|
35
|
+
"@ttsc/linux-arm": "0.9.0",
|
|
36
|
+
"@ttsc/darwin-arm64": "0.9.0",
|
|
37
|
+
"@ttsc/linux-arm64": "0.9.0",
|
|
38
|
+
"@ttsc/darwin-x64": "0.9.0",
|
|
39
|
+
"@ttsc/win32-x64": "0.9.0",
|
|
40
|
+
"@ttsc/win32-arm64": "0.9.0"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"files": [
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"lib",
|
|
51
51
|
"shim",
|
|
52
52
|
"src",
|
|
53
|
-
"test",
|
|
54
53
|
"tools",
|
|
55
54
|
"utility"
|
|
56
55
|
],
|
|
@@ -63,11 +62,7 @@
|
|
|
63
62
|
],
|
|
64
63
|
"scripts": {
|
|
65
64
|
"build": "rimraf lib && tsgo && cp ../../README.md README.md",
|
|
66
|
-
"test": "pnpm run test:ts && pnpm run test:go",
|
|
67
|
-
"test:ts": "node --test --test-reporter=spec --experimental-strip-types --experimental-specifier-resolution=node test/**/*.test.ts",
|
|
68
|
-
"test:go": "node ../../scripts/go.cjs test ./...",
|
|
69
65
|
"go:build": "node ../../scripts/go.cjs build-native",
|
|
70
|
-
"go:test": "node ../../scripts/go.cjs test ./...",
|
|
71
66
|
"go:vet": "node ../../scripts/go.cjs vet ./..."
|
|
72
67
|
}
|
|
73
68
|
}
|
|
@@ -83,6 +83,14 @@ func (d *LintDiagnostic) Localize(_ locale.Locale) string { return d.mess
|
|
|
83
83
|
func (d *LintDiagnostic) MessageChain() []inner.Diagnostic { return nil }
|
|
84
84
|
func (d *LintDiagnostic) RelatedInformation() []inner.Diagnostic { return nil }
|
|
85
85
|
|
|
86
|
+
// Message returns the already-localized lint message.
|
|
87
|
+
func (d *LintDiagnostic) Message() string {
|
|
88
|
+
if d == nil {
|
|
89
|
+
return ""
|
|
90
|
+
}
|
|
91
|
+
return d.message
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
// IsError reports whether the diagnostic should fail the build. Lint plugins
|
|
87
95
|
// use this to compute their exit code separately from the renderer.
|
|
88
96
|
func (d *LintDiagnostic) IsError() bool { return d.category == LintCategoryError }
|
package/src/TtscCompiler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
import { compileProjectInMemory } from "./compiler/internal/compileProjectInMemory";
|
|
5
5
|
import { resolveProjectConfig } from "./compiler/internal/project/resolveProjectConfig";
|
|
@@ -66,6 +66,7 @@ export class TtscCompiler {
|
|
|
66
66
|
cacheDir: this.resolvePluginCacheDir(),
|
|
67
67
|
cwd: execution.cwd,
|
|
68
68
|
entries: this.context.plugins,
|
|
69
|
+
projectRoot: execution.projectRoot,
|
|
69
70
|
tsconfig: execution.tsconfig,
|
|
70
71
|
});
|
|
71
72
|
return loaded.nativePlugins.map((plugin) => plugin.binary);
|
|
@@ -161,7 +162,9 @@ export class TtscCompiler {
|
|
|
161
162
|
});
|
|
162
163
|
return {
|
|
163
164
|
cwd,
|
|
164
|
-
projectRoot:
|
|
165
|
+
projectRoot: this.context.projectRoot
|
|
166
|
+
? path.resolve(cwd, this.context.projectRoot)
|
|
167
|
+
: path.dirname(tsconfig),
|
|
165
168
|
tsconfig,
|
|
166
169
|
};
|
|
167
170
|
}
|
|
@@ -243,8 +246,11 @@ function runTransformation(
|
|
|
243
246
|
|
|
244
247
|
function toCompilerResult(project: ProjectResult): ITtscCompilerResult {
|
|
245
248
|
const { output, result } = project;
|
|
246
|
-
if (result.status === 0 && result.diagnostics
|
|
249
|
+
if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
|
|
247
250
|
return {
|
|
251
|
+
...(result.diagnostics.length === 0
|
|
252
|
+
? {}
|
|
253
|
+
: { diagnostics: result.diagnostics }),
|
|
248
254
|
output,
|
|
249
255
|
type: "success",
|
|
250
256
|
};
|
|
@@ -277,8 +283,11 @@ function toCompilerTransformation(
|
|
|
277
283
|
project: ProjectTransformation,
|
|
278
284
|
): ITtscCompilerTransformation {
|
|
279
285
|
const { result, typescript } = project;
|
|
280
|
-
if (result.status === 0 && result.diagnostics
|
|
286
|
+
if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
|
|
281
287
|
return {
|
|
288
|
+
...(result.diagnostics.length === 0
|
|
289
|
+
? {}
|
|
290
|
+
: { diagnostics: result.diagnostics }),
|
|
282
291
|
type: "success",
|
|
283
292
|
typescript,
|
|
284
293
|
};
|
|
@@ -293,6 +302,12 @@ function toCompilerTransformation(
|
|
|
293
302
|
};
|
|
294
303
|
}
|
|
295
304
|
|
|
305
|
+
function hasErrorDiagnostics(
|
|
306
|
+
diagnostics: readonly ITtscCompilerDiagnostic[],
|
|
307
|
+
): boolean {
|
|
308
|
+
return diagnostics.some((diagnostic) => diagnostic.category === "error");
|
|
309
|
+
}
|
|
310
|
+
|
|
296
311
|
function normalizeError(error: unknown): unknown {
|
|
297
312
|
if (!(error instanceof Error)) {
|
|
298
313
|
return error;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
|
|
6
|
+
import { hasProjectPluginEntries } from "../../plugin/internal/loadProjectPlugins";
|
|
6
7
|
import type { ITtscCompilerContext } from "../../structures/ITtscCompilerContext";
|
|
7
8
|
import type { ITtscCompilerDiagnostic } from "../../structures/ITtscCompilerDiagnostic";
|
|
8
|
-
import type { ITtscProjectPluginConfig } from "../../structures/ITtscProjectPluginConfig";
|
|
9
9
|
import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscParsedProjectConfig";
|
|
10
10
|
import type { TtscBuildResult } from "../../structures/internal/TtscBuildResult";
|
|
11
11
|
import { buildNativeCompiler } from "./buildNativeCompiler";
|
|
@@ -20,22 +20,23 @@ export function compileProjectInMemory(options: ITtscCompilerContext): {
|
|
|
20
20
|
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
21
21
|
const project = readProjectConfig({
|
|
22
22
|
cwd,
|
|
23
|
+
projectRoot: options.projectRoot,
|
|
23
24
|
tsconfig: options.tsconfig,
|
|
24
25
|
});
|
|
25
|
-
if (
|
|
26
|
+
if (hasConfiguredPlugins(options, project)) {
|
|
26
27
|
return compileProjectWithPlugins(options, cwd, project);
|
|
27
28
|
}
|
|
28
29
|
const tsconfig = project.path;
|
|
29
30
|
const binary = buildNativeCompiler({
|
|
30
|
-
cacheBaseDir:
|
|
31
|
+
cacheBaseDir: project.root,
|
|
31
32
|
cacheDir: options.cacheDir,
|
|
32
33
|
packageRoot: packageRootDir(),
|
|
33
34
|
});
|
|
34
35
|
const res = spawnSync(
|
|
35
36
|
binary,
|
|
36
|
-
["api-compile", "--cwd",
|
|
37
|
+
["api-compile", "--cwd", project.root, "--tsconfig", tsconfig],
|
|
37
38
|
{
|
|
38
|
-
cwd:
|
|
39
|
+
cwd: project.root,
|
|
39
40
|
encoding: "utf8",
|
|
40
41
|
env: { ...process.env, ...options.env },
|
|
41
42
|
maxBuffer: 1024 * 1024 * 256,
|
|
@@ -60,15 +61,11 @@ export function compileProjectInMemory(options: ITtscCompilerContext): {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
function
|
|
64
|
+
function hasConfiguredPlugins(
|
|
64
65
|
options: ITtscCompilerContext,
|
|
65
66
|
project: ITtscParsedProjectConfig,
|
|
66
|
-
):
|
|
67
|
-
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
const entries = options.plugins ?? project.compilerOptions.plugins;
|
|
71
|
-
return entries.filter((entry) => entry.enabled !== false);
|
|
67
|
+
): boolean {
|
|
68
|
+
return hasProjectPluginEntries(project, options.plugins);
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
function compileProjectWithPlugins(
|
|
@@ -109,13 +106,21 @@ function outputKeyMapper(
|
|
|
109
106
|
return (relativePath) => relativePath;
|
|
110
107
|
}
|
|
111
108
|
const relativeOutDir = path.relative(project.root, outDir);
|
|
112
|
-
if (relativeOutDir !== "" && !relativeOutDir
|
|
109
|
+
if (relativeOutDir !== "" && !isOutsideRelativePath(relativeOutDir)) {
|
|
113
110
|
const prefix = pathToKey(relativeOutDir);
|
|
114
111
|
return (relativePath) => path.posix.join(prefix, relativePath);
|
|
115
112
|
}
|
|
116
113
|
return (relativePath) => pathToKey(path.join(outDir, relativePath));
|
|
117
114
|
}
|
|
118
115
|
|
|
116
|
+
function isOutsideRelativePath(relative: string): boolean {
|
|
117
|
+
return (
|
|
118
|
+
relative === ".." ||
|
|
119
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
120
|
+
path.isAbsolute(relative)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
119
124
|
function readOutputDirectory(
|
|
120
125
|
directory: string,
|
|
121
126
|
keyOf: (relativePath: string) => string,
|