ttsc 0.26.2 → 0.27.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 +9 -0
- package/cmd/ttsc/api_transform.go +17 -3
- package/cmd/ttscgraph/auxiliary_identity_state_tracks_retargets_not_source_contents_test.go +85 -0
- package/cmd/ttscgraph/disk_realpath_other.go +16 -0
- package/cmd/ttscgraph/disk_realpath_windows.go +56 -0
- package/cmd/ttscgraph/serve.go +104 -35
- package/driver/emit_plugin.go +20 -3
- package/driver/graph.go +64 -11
- package/driver/input_observation.go +273 -0
- package/driver/input_observation_test.go +149 -0
- package/driver/plugins.go +384 -4
- package/driver/program.go +54 -1
- package/driver/resolution_candidates.go +13 -5
- package/driver/rewrite.go +45 -2
- package/lib/TtscCompiler.d.ts +12 -11
- package/lib/TtscCompiler.js +44 -29
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/compiler/internal/captureProcessOutput.js +2 -2
- package/lib/compiler/internal/captureProcessOutput.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.js +4 -3
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +2 -0
- package/lib/compiler/internal/resolveEmittedJavaScript.js +3 -0
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +1 -1
- package/lib/compiler/internal/runBuild.js +80 -34
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.js +2 -2
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/compiler/internal/sharedHostHelpers.d.ts +28 -0
- package/lib/compiler/internal/sharedHostHelpers.js +39 -0
- package/lib/compiler/internal/sharedHostHelpers.js.map +1 -1
- package/lib/compiler/internal/startResidentTransform.js +12 -4
- package/lib/compiler/internal/startResidentTransform.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.d.ts +3 -0
- package/lib/compiler/internal/transformProjectInMemory.js +239 -35
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/flags/schema.js +12 -5
- package/lib/flags/schema.js.map +1 -1
- package/lib/internal/createCanonicalTempDirectory.d.ts +17 -0
- package/lib/internal/createCanonicalTempDirectory.js +42 -0
- package/lib/internal/createCanonicalTempDirectory.js.map +1 -0
- package/lib/internal/projectInputPathIdentity.d.ts +3 -0
- package/lib/internal/projectInputPathIdentity.js +11 -5
- package/lib/internal/projectInputPathIdentity.js.map +1 -1
- package/lib/internal/resolveNodeBinary.d.ts +14 -0
- package/lib/internal/resolveNodeBinary.js +150 -0
- package/lib/internal/resolveNodeBinary.js.map +1 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.d.ts +15 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.js +61 -0
- package/lib/internal/resolveSafeCacheCleanupTargets.js.map +1 -0
- package/lib/launcher/internal/prepareExecution.d.ts +3 -0
- package/lib/launcher/internal/prepareExecution.js +42 -14
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +25 -13
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtscserver.js +18 -3
- package/lib/launcher/internal/runTtscserver.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +2 -0
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtimeHooks.d.ts +37 -1
- package/lib/launcher/internal/runtimeHooks.js +653 -62
- package/lib/launcher/internal/runtimeHooks.js.map +1 -1
- package/lib/plugin/internal/buildSourcePlugin.d.ts +62 -8
- package/lib/plugin/internal/buildSourcePlugin.js +754 -72
- package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/loadProjectPlugins.d.ts +17 -5
- package/lib/plugin/internal/loadProjectPlugins.js +1339 -77
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/register.d.ts +1 -0
- package/lib/register.js +46 -0
- package/lib/register.js.map +1 -0
- package/lib/structures/ITtscCompilerContext.d.ts +6 -3
- package/lib/structures/ITtscCompilerTransformation.d.ts +31 -0
- package/lib/structures/ITtscPlugin.d.ts +33 -0
- package/package.json +16 -9
- package/shim/checker/go.mod +9 -0
- package/shim/checker/go.sum +22 -0
- package/shim/checker/shim.go +75 -0
- package/shim/compiler/incremental.go +45 -8
- package/src/TtscCompiler.ts +55 -33
- package/src/compiler/internal/captureProcessOutput.ts +3 -2
- package/src/compiler/internal/compileProjectInMemory.ts +4 -3
- package/src/compiler/internal/resolveEmittedJavaScript.ts +6 -0
- package/src/compiler/internal/runBuild.ts +102 -39
- package/src/compiler/internal/runSingleFileEmit.ts +2 -2
- package/src/compiler/internal/sharedHostHelpers.ts +44 -0
- package/src/compiler/internal/startResidentTransform.ts +12 -3
- package/src/compiler/internal/transformProjectInMemory.ts +410 -39
- package/src/flags/schema.ts +12 -5
- package/src/internal/createCanonicalTempDirectory.ts +53 -0
- package/src/internal/projectInputPathIdentity.ts +17 -4
- package/src/internal/resolveNodeBinary.ts +173 -0
- package/src/internal/resolveSafeCacheCleanupTargets.ts +85 -0
- package/src/launcher/internal/prepareExecution.ts +50 -14
- package/src/launcher/internal/runTtsc.ts +24 -13
- package/src/launcher/internal/runTtscserver.ts +18 -3
- package/src/launcher/internal/runTtsx.ts +2 -0
- package/src/launcher/internal/runtimeHooks.ts +823 -66
- package/src/plugin/internal/buildSourcePlugin.ts +984 -79
- package/src/plugin/internal/loadProjectPlugins.ts +1718 -104
- package/src/register.ts +47 -0
- package/src/structures/ITtscCompilerContext.ts +6 -3
- package/src/structures/ITtscCompilerTransformation.ts +39 -0
- package/src/structures/ITtscPlugin.ts +36 -0
- package/tools/shim_audit/baseline.json +0 -1
- package/utility/host.go +9 -3
- package/lib/internal/assertSafeExplicitCacheDirectory.d.ts +0 -5
- package/lib/internal/assertSafeExplicitCacheDirectory.js +0 -26
- package/lib/internal/assertSafeExplicitCacheDirectory.js.map +0 -1
- package/src/internal/assertSafeExplicitCacheDirectory.ts +0 -29
package/lib/TtscCompiler.js
CHANGED
|
@@ -11,7 +11,7 @@ const resolveProjectConfig_1 = require("./compiler/internal/project/resolveProje
|
|
|
11
11
|
const resolveBinary_1 = require("./compiler/internal/resolveBinary");
|
|
12
12
|
const runBuild_1 = require("./compiler/internal/runBuild");
|
|
13
13
|
const transformProjectInMemory_1 = require("./compiler/internal/transformProjectInMemory");
|
|
14
|
-
const
|
|
14
|
+
const resolveSafeCacheCleanupTargets_1 = require("./internal/resolveSafeCacheCleanupTargets");
|
|
15
15
|
const buildSourcePlugin_1 = require("./plugin/internal/buildSourcePlugin");
|
|
16
16
|
const loadProjectPlugins_1 = require("./plugin/internal/loadProjectPlugins");
|
|
17
17
|
/**
|
|
@@ -82,15 +82,16 @@ class TtscCompiler {
|
|
|
82
82
|
/**
|
|
83
83
|
* Remove compiled cache artifacts for this compiler instance.
|
|
84
84
|
*
|
|
85
|
-
* Removes
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* project-local caches. A user-provided `GOCACHE` is never removed.
|
|
85
|
+
* Removes an explicit `cacheDir` wholesale. Otherwise removes the plugin
|
|
86
|
+
* binary subdirectory, a safely identified ttsc-owned Go build cache
|
|
87
|
+
* (including an external `TTSC_GO_CACHE_DIR`), and the two legacy
|
|
88
|
+
* project-local caches. A user-provided `GOCACHE` is never removed. Every
|
|
89
|
+
* resolved deletion target is validated before the first removal. The cache
|
|
89
90
|
* location comes from this instance's `cacheDir` and environment
|
|
90
91
|
* (`TTSC_CACHE_DIR` / `TTSC_GO_CACHE_DIR`), defaulting to
|
|
91
|
-
* `<workspaceRoot>/node_modules/.cache/ttsc`.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* `<workspaceRoot>/node_modules/.cache/ttsc`. Any resolved cache target that
|
|
93
|
+
* equals or contains the project, or names a filesystem root, is rejected
|
|
94
|
+
* before any directory is removed.
|
|
94
95
|
*
|
|
95
96
|
* @returns Cache directories that were removed.
|
|
96
97
|
*/
|
|
@@ -101,25 +102,32 @@ class TtscCompiler {
|
|
|
101
102
|
node_path_1.default.join(projectRoot, ".ttsc"),
|
|
102
103
|
];
|
|
103
104
|
const explicitCacheDir = this.resolveCacheDir();
|
|
105
|
+
let targets;
|
|
104
106
|
if (explicitCacheDir !== undefined) {
|
|
105
|
-
(0, assertSafeExplicitCacheDirectory_1.assertSafeExplicitCacheDirectory)(projectRoot, explicitCacheDir);
|
|
106
107
|
// An explicit constructor `cacheDir` names the cache directory for this
|
|
107
108
|
// instance — exactly like `ttsc clean --cache-dir X` on the CLI — so
|
|
108
109
|
// remove it wholesale plus the legacy project-local caches. This keeps
|
|
109
110
|
// the programmatic and CLI clean contracts identical for an explicit
|
|
110
111
|
// cache dir.
|
|
111
|
-
|
|
112
|
+
targets = [explicitCacheDir, ...legacyTargets];
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
else {
|
|
115
|
+
// Default / `context.env.TTSC_CACHE_DIR`: resolve the cache root and the Go
|
|
116
|
+
// build cache (`TTSC_GO_CACHE_DIR`) from this instance's effective
|
|
117
|
+
// environment — the same `{ ...process.env, ...context.env }` that
|
|
118
|
+
// prepare()/compile()/transform() build with — then remove only the
|
|
119
|
+
// ttsc-owned subdirectories, so a possibly-shared root is never deleted and
|
|
120
|
+
// a user-provided `GOCACHE` is never touched. Using the effective env (not
|
|
121
|
+
// ambient `process.env`) makes clean() remove exactly the artifacts this
|
|
122
|
+
// instance owns, including a `TTSC_GO_CACHE_DIR` supplied only in
|
|
123
|
+
// `context.env`.
|
|
124
|
+
targets = (0, buildSourcePlugin_1.resolveCleanTargets)(projectRoot, this.resolvePluginCacheDir(), this.resolveEffectiveEnv());
|
|
125
|
+
}
|
|
126
|
+
// Validate the complete deletion set before removing the first directory.
|
|
127
|
+
// This includes an environment-selected TTSC_GO_CACHE_DIR and project-local
|
|
128
|
+
// legacy locations, not only an explicit constructor cacheDir.
|
|
129
|
+
const safeTargets = (0, resolveSafeCacheCleanupTargets_1.resolveSafeCacheCleanupTargets)(projectRoot, targets);
|
|
130
|
+
return removeExistingDirectories(safeTargets);
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* Compile the configured project.
|
|
@@ -210,10 +218,10 @@ class TtscCompiler {
|
|
|
210
218
|
* The effective environment for this instance's source-plugin builds and
|
|
211
219
|
* clean targets: `context.env` merged over `process.env`, matching the
|
|
212
220
|
* documented {@link ITtscCompilerContext.env} contract that child compiler,
|
|
213
|
-
* native-plugin,
|
|
214
|
-
* fresh object so callers never mutate the shared
|
|
215
|
-
* `context.env` was supplied this is a plain copy of
|
|
216
|
-
* default behavior is unchanged.
|
|
221
|
+
* native-plugin, native-host, and isolated descriptor processes already
|
|
222
|
+
* receive. Returned as a fresh object so callers never mutate the shared
|
|
223
|
+
* `process.env`; when no `context.env` was supplied this is a plain copy of
|
|
224
|
+
* `process.env`, so CLI / default behavior is unchanged.
|
|
217
225
|
*/
|
|
218
226
|
resolveEffectiveEnv() {
|
|
219
227
|
return { ...process.env, ...this.context.env };
|
|
@@ -222,12 +230,16 @@ class TtscCompiler {
|
|
|
222
230
|
exports.TtscCompiler = TtscCompiler;
|
|
223
231
|
function removeExistingDirectories(directories) {
|
|
224
232
|
const removed = [];
|
|
225
|
-
|
|
226
|
-
|
|
233
|
+
const visited = new Set();
|
|
234
|
+
for (const directory of directories) {
|
|
235
|
+
if (visited.has(directory.path))
|
|
236
|
+
continue;
|
|
237
|
+
visited.add(directory.path);
|
|
238
|
+
if (!directory.exists || !node_fs_1.default.existsSync(directory.path)) {
|
|
227
239
|
continue;
|
|
228
240
|
}
|
|
229
|
-
node_fs_1.default.rmSync(directory, { recursive: true, force: true });
|
|
230
|
-
removed.push(directory);
|
|
241
|
+
node_fs_1.default.rmSync(directory.path, { recursive: true, force: true });
|
|
242
|
+
removed.push(directory.requestedPath);
|
|
231
243
|
}
|
|
232
244
|
return removed;
|
|
233
245
|
}
|
|
@@ -324,11 +336,14 @@ function toCompilerResult(project) {
|
|
|
324
336
|
};
|
|
325
337
|
}
|
|
326
338
|
function toCompilerTransformation(project) {
|
|
327
|
-
const { dependencies, dependenciesComplete, graph, result, typescript, volatile, } = project;
|
|
339
|
+
const { dependencies, dependenciesComplete, graph, hostInputHashes, hostInputRealpaths, hostInputs, result, typescript, volatile, } = project;
|
|
328
340
|
const advisoryFields = {
|
|
329
341
|
...(dependencies === undefined ? {} : { dependencies }),
|
|
330
342
|
...(dependenciesComplete === undefined ? {} : { dependenciesComplete }),
|
|
331
343
|
...(graph === undefined ? {} : { graph }),
|
|
344
|
+
...(hostInputHashes === undefined ? {} : { hostInputHashes }),
|
|
345
|
+
...(hostInputRealpaths === undefined ? {} : { hostInputRealpaths }),
|
|
346
|
+
...(hostInputs === undefined ? {} : { hostInputs }),
|
|
332
347
|
...(volatile === undefined ? {} : { volatile }),
|
|
333
348
|
};
|
|
334
349
|
if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
|
package/lib/TtscCompiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2DAAuE;AACvE,2FAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2DAAuE;AACvE,2FAAwF;AACxF,8FAGmD;AACnD,2EAA0E;AAC1E,6EAA0E;AAO1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH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CAAC;QACnD,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAChD,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QACpE,OAAO;YACL,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;gBACjC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;YACxC,GAAG,cAAc;YACjB,IAAI,EAAE,SAAS;YACf,UAAU;SACX,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,cAAc;QACjB,WAAW,EACT,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;YAC7B,CAAC,CAAC,CAAC,IAAA,kCAAuB,EAAC,MAAM,CAAC,CAAC;YACnC,CAAC,CAAC,MAAM,CAAC,WAAW;QACxB,IAAI,EAAE,SAAS;QACf,UAAU;KACX,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,WAA+C;IAE/C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.captureProcessOutput = captureProcessOutput;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
10
10
|
/**
|
|
11
11
|
* A pair of temporary files standing in for a child process's pipes.
|
|
12
12
|
*
|
|
@@ -25,7 +25,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
25
25
|
* bytes.
|
|
26
26
|
*/
|
|
27
27
|
function captureProcessOutput() {
|
|
28
|
-
const directory =
|
|
28
|
+
const directory = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsc-spawn-");
|
|
29
29
|
const stdoutPath = node_path_1.default.join(directory, "stdout");
|
|
30
30
|
const stderrPath = node_path_1.default.join(directory, "stderr");
|
|
31
31
|
const stdoutFd = node_fs_1.default.openSync(stdoutPath, "w+");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"captureProcessOutput.js","sourceRoot":"","sources":["../../../src/compiler/internal/captureProcessOutput.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"captureProcessOutput.js","sourceRoot":"","sources":["../../../src/compiler/internal/captureProcessOutput.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,8FAA2F;AAc3F;;;;;;;;;;;;;;;;GAgBG;AACH;IACE,MAAM,SAAS,GAAG,IAAA,2DAA4B,EAAC,aAAa,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,iBAAE,CAAC,QAAQ,CAAC,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;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,SAAiB;IACtC,IAAI,CAAC;QACH,iBAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.compileProjectInMemory = compileProjectInMemory;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
10
10
|
const loadProjectPlugins_1 = require("../../plugin/internal/loadProjectPlugins");
|
|
11
11
|
const buildNativeCompiler_1 = require("./buildNativeCompiler");
|
|
12
12
|
const paths_1 = require("./paths");
|
|
13
13
|
const readProjectConfig_1 = require("./project/readProjectConfig");
|
|
14
14
|
const runBuild_1 = require("./runBuild");
|
|
15
|
+
const sharedHostHelpers_1 = require("./sharedHostHelpers");
|
|
15
16
|
const spawnNative_1 = require("./spawnNative");
|
|
16
17
|
/**
|
|
17
18
|
* Compile a project and capture emitted files without writing to the project
|
|
@@ -44,7 +45,7 @@ function compileProjectInMemory(options) {
|
|
|
44
45
|
});
|
|
45
46
|
const res = (0, spawnNative_1.spawnNative)(binary, ["api-compile", "--cwd", project.root, "--tsconfig", tsconfig], {
|
|
46
47
|
cwd: project.root,
|
|
47
|
-
env:
|
|
48
|
+
env: (0, sharedHostHelpers_1.inheritedSidecarEnv)(options.env),
|
|
48
49
|
});
|
|
49
50
|
if (res.error) {
|
|
50
51
|
throw new Error(`ttsc: failed to spawn native compiler host ${binary}: ${res.error.message}`);
|
|
@@ -82,7 +83,7 @@ function shouldUsePluginBuild(options, project) {
|
|
|
82
83
|
* read back every file the build wrote so they can be returned as strings.
|
|
83
84
|
*/
|
|
84
85
|
function compileProjectWithPlugins(options, cwd, project) {
|
|
85
|
-
const tempRoot =
|
|
86
|
+
const tempRoot = (0, createCanonicalTempDirectory_1.createCanonicalTempDirectory)("ttsc-api-output-");
|
|
86
87
|
const tempOutDir = node_path_1.default.join(tempRoot, "out");
|
|
87
88
|
try {
|
|
88
89
|
const result = (0, runBuild_1.runBuild)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileProjectInMemory.js","sourceRoot":"","sources":["../../../src/compiler/internal/compileProjectInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"compileProjectInMemory.js","sourceRoot":"","sources":["../../../src/compiler/internal/compileProjectInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,8FAA2F;AAC3F,iFAAmF;AAKnF,+DAA4D;AAC5D,mCAAgE;AAChE,mEAAgE;AAChE,yCAAsC;AACtC,2DAA0D;AAC1D,+CAAwD;AAExD;;;;;;;;;;;;GAYG;AACH,gCAAuC,OAA6B;IAIlE,MAAM,GAAG,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC;QAChC,GAAG;QACH,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;IACH,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC3C,OAAO,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9B,M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,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,gFAAgF;AAChF,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,wBAAwB,CAC/B,MAAc,EACd,MAAc;IAKd,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAG/B,CAAC;QACF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;SAC5B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE;YACvB,+CAA+C,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* Returns `null` when no matching output file is found on disk.
|
|
16
16
|
*/
|
|
17
17
|
export declare function resolveEmittedJavaScript(options: {
|
|
18
|
+
/** Skip trailing-stem recovery when exact source ownership is required. */
|
|
19
|
+
allowStemFallback?: boolean;
|
|
18
20
|
/** Pre-computed list of emitted paths; when absent `outDir` is scanned. */
|
|
19
21
|
emittedFiles?: readonly string[];
|
|
20
22
|
outDir: string;
|
|
@@ -36,6 +36,9 @@ function resolveEmittedJavaScript(options) {
|
|
|
36
36
|
return candidate;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
if (options.allowStemFallback === false) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
39
42
|
// Score the pre-computed emit list first (cheap). When it yields nothing —
|
|
40
43
|
// because the list is incomplete (a native transform host such as typia emits
|
|
41
44
|
// without printing the `--listEmittedFiles` lines) or because the emit landed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEmittedJavaScript.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveEmittedJavaScript.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,mCAAgD;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,kCAAyC,
|
|
1
|
+
{"version":3,"file":"resolveEmittedJavaScript.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveEmittedJavaScript.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,mCAAgD;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,kCAAyC,OAQxC;IACC,MAAM,KAAK,GAAG,wBAAwB,CACpC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,CACnB,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAChE,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,IAAI,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACvE,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,iBAAE,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D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAAgB;IACnD,QAAQ,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7C,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzB;YACE,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,QAAQ,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1E,CAAC"}
|
|
@@ -109,7 +109,7 @@ export type ResidentCheckEntryPlan = {
|
|
|
109
109
|
* Plan every configured check entry while sharing resident processes only by
|
|
110
110
|
* binary/name/argument identity.
|
|
111
111
|
*/
|
|
112
|
-
export declare function planResidentCheckEntries(plugins: readonly ITtscLoadedNativePlugin[], createArgs: (plugin: ITtscLoadedNativePlugin) => string[]): ResidentCheckEntryPlan[];
|
|
112
|
+
export declare function planResidentCheckEntries(plugins: readonly ITtscLoadedNativePlugin[], createArgs: (plugin: ITtscLoadedNativePlugin) => string[], tsgoArgs?: string): ResidentCheckEntryPlan[];
|
|
113
113
|
/** Retain one complete change stream per configured resident check entry. */
|
|
114
114
|
export declare function bufferResidentCheckEntryRequests(pending: Map<number, ResidentCheckRequest>, checks: readonly ResidentCheckEntryPlan[], request: ResidentCheckRequest): void;
|
|
115
115
|
/** Consume exactly one configured entry's buffered request. */
|
|
@@ -18,6 +18,7 @@ exports.normalizeBuildOutput = normalizeBuildOutput;
|
|
|
18
18
|
const node_path_1 = __importDefault(require("node:path"));
|
|
19
19
|
const schema_1 = require("../../flags/schema");
|
|
20
20
|
const projectInputPathIdentity_1 = require("../../internal/projectInputPathIdentity");
|
|
21
|
+
const resolveNodeBinary_1 = require("../../internal/resolveNodeBinary");
|
|
21
22
|
const loadProjectPlugins_1 = require("../../plugin/internal/loadProjectPlugins");
|
|
22
23
|
const createNativeProjectContextArgs_1 = require("./project/createNativeProjectContextArgs");
|
|
23
24
|
const readProjectConfig_1 = require("./project/readProjectConfig");
|
|
@@ -31,14 +32,17 @@ const spawnNative_1 = require("./spawnNative");
|
|
|
31
32
|
* `TTSC_NODE_BINARY` so child processes can re-invoke the same Node.js binary
|
|
32
33
|
* without searching `PATH`.
|
|
33
34
|
*/
|
|
34
|
-
function mergeEnv(extra) {
|
|
35
|
-
const
|
|
35
|
+
function mergeEnv(extra, cwd = process.cwd()) {
|
|
36
|
+
const env = {
|
|
36
37
|
...process.env,
|
|
37
|
-
|
|
38
|
+
...extra,
|
|
38
39
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const node = (0, resolveNodeBinary_1.resolveNodeBinary)(env, cwd);
|
|
41
|
+
if (node === undefined)
|
|
42
|
+
delete env.TTSC_NODE_BINARY;
|
|
43
|
+
else
|
|
44
|
+
env.TTSC_NODE_BINARY = node;
|
|
45
|
+
return env;
|
|
42
46
|
}
|
|
43
47
|
function createBuildTiming(options) {
|
|
44
48
|
return {
|
|
@@ -108,7 +112,7 @@ function formatTimingSeconds(ms) {
|
|
|
108
112
|
* containing any linked sources so they run inside the same process as the host
|
|
109
113
|
* plugin.
|
|
110
114
|
*/
|
|
111
|
-
function nativePluginEnv(extra, execution, plugin) {
|
|
115
|
+
function nativePluginEnv(extra, execution, plugin, tsgoArgs) {
|
|
112
116
|
const env = mergeEnv({
|
|
113
117
|
...(execution.pluginConfigDir === undefined
|
|
114
118
|
? {}
|
|
@@ -117,7 +121,16 @@ function nativePluginEnv(extra, execution, plugin) {
|
|
|
117
121
|
TTSC_TTSX_BINARY: process.env.TTSC_TTSX_BINARY ??
|
|
118
122
|
node_path_1.default.join(__dirname, "..", "..", "launcher", "ttsx.js"),
|
|
119
123
|
...extra,
|
|
120
|
-
});
|
|
124
|
+
}, execution.projectRoot);
|
|
125
|
+
// Forwarded tsgo argv is per-invocation state this host owns, exactly like
|
|
126
|
+
// the config anchor below: publish this run's payload, or drop whatever an
|
|
127
|
+
// ancestor ttsc process left behind when this lane forwards nothing.
|
|
128
|
+
if (tsgoArgs !== undefined) {
|
|
129
|
+
env[sharedHostHelpers_1.TSGO_ARGS_ENV] = tsgoArgs;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
(0, sharedHostHelpers_1.clearInheritedTsgoArgs)(env, extra);
|
|
133
|
+
}
|
|
121
134
|
// The anchor is per-invocation state owned by this host: when this run
|
|
122
135
|
// declared none (and the caller's env does not name one), drop any value
|
|
123
136
|
// inherited from an ancestor ttsc process so a nested build never
|
|
@@ -247,7 +260,8 @@ class ResidentCheckWatchSession {
|
|
|
247
260
|
stderr: "",
|
|
248
261
|
stdout: "",
|
|
249
262
|
};
|
|
250
|
-
const
|
|
263
|
+
const tsgoArgs = createNativeTsgoArgs(options);
|
|
264
|
+
const checks = planResidentCheckEntries(execution.nativePlugins, (plugin) => createNativeCheckArgs(execution, options, plugin), tsgoArgs);
|
|
251
265
|
const request = residentCheckRequest(change, execution.projectRoot);
|
|
252
266
|
// Buffer the cycle for every resident plugin before running any of them.
|
|
253
267
|
// An earlier plugin may fail and short-circuit diagnostics, but a later
|
|
@@ -256,7 +270,7 @@ class ResidentCheckWatchSession {
|
|
|
256
270
|
for (const { args, entryIndex, key, plugin } of checks) {
|
|
257
271
|
let result;
|
|
258
272
|
if (key === undefined) {
|
|
259
|
-
result = runNativePluginCommand(plugin, args, options, execution, "ttsc.check", timing, `ttsc check plugin ${plugin.name} time
|
|
273
|
+
result = runNativePluginCommand(plugin, args, options, execution, "ttsc.check", timing, `ttsc check plugin ${plugin.name} time`, tsgoArgs);
|
|
260
274
|
}
|
|
261
275
|
else {
|
|
262
276
|
const startedAt = process.hrtime.bigint();
|
|
@@ -266,7 +280,7 @@ class ResidentCheckWatchSession {
|
|
|
266
280
|
args: ["check-serve", ...args.slice(1)],
|
|
267
281
|
binary: plugin.binary,
|
|
268
282
|
cwd: execution.projectRoot,
|
|
269
|
-
env: nativePluginEnv(options.env, execution, plugin),
|
|
283
|
+
env: nativePluginEnv(options.env, execution, plugin, tsgoArgs),
|
|
270
284
|
});
|
|
271
285
|
this.processes.set(key, resident);
|
|
272
286
|
}
|
|
@@ -320,14 +334,19 @@ function residentCheckExecutionIsCompatible(options, execution) {
|
|
|
320
334
|
forwardsTerminalTsgoFlag(options) === false &&
|
|
321
335
|
execution.nativePlugins.every((plugin) => plugin.stage === "check"));
|
|
322
336
|
}
|
|
323
|
-
function residentCheckProcessKey(plugin, args) {
|
|
324
|
-
return `${plugin.binary}\0${plugin.name}\0${JSON.stringify(args)}`;
|
|
337
|
+
function residentCheckProcessKey(plugin, args, tsgoArgs) {
|
|
338
|
+
return `${plugin.binary}\0${plugin.name}\0${JSON.stringify(args)}\0${tsgoArgs ?? ""}`;
|
|
325
339
|
}
|
|
326
340
|
/**
|
|
327
341
|
* Plan every configured check entry while sharing resident processes only by
|
|
328
342
|
* binary/name/argument identity.
|
|
329
343
|
*/
|
|
330
|
-
function planResidentCheckEntries(plugins, createArgs
|
|
344
|
+
function planResidentCheckEntries(plugins, createArgs,
|
|
345
|
+
// Part of the process identity even though it never appears in argv: the
|
|
346
|
+
// forwarded tsgo payload rides the environment, and a resident process holds
|
|
347
|
+
// the compiler options it was started with. Two cycles that forward different
|
|
348
|
+
// flags must not share one warm Program.
|
|
349
|
+
tsgoArgs) {
|
|
331
350
|
return plugins
|
|
332
351
|
.filter((candidate) => candidate.stage === "check")
|
|
333
352
|
.map((plugin, entryIndex) => {
|
|
@@ -336,7 +355,7 @@ function planResidentCheckEntries(plugins, createArgs) {
|
|
|
336
355
|
args,
|
|
337
356
|
entryIndex,
|
|
338
357
|
key: plugin.capabilities?.residentCheck === true
|
|
339
|
-
? residentCheckProcessKey(plugin, args)
|
|
358
|
+
? residentCheckProcessKey(plugin, args, tsgoArgs)
|
|
340
359
|
: undefined,
|
|
341
360
|
plugin,
|
|
342
361
|
};
|
|
@@ -541,7 +560,7 @@ function runProjectFreeTerminalFlag(options) {
|
|
|
541
560
|
const tsgo = (0, resolveTsgo_1.resolveTsgo)({ ...options, cwd });
|
|
542
561
|
const res = (0, spawnNative_1.spawnNative)(tsgo.binary, [...(options.passthrough ?? [])], {
|
|
543
562
|
cwd,
|
|
544
|
-
env: mergeEnv(options.env),
|
|
563
|
+
env: mergeEnv(options.env, cwd),
|
|
545
564
|
encoding: "utf8",
|
|
546
565
|
});
|
|
547
566
|
if (res.error) {
|
|
@@ -751,7 +770,7 @@ function forwardsInternalShadowFlag(options, flag) {
|
|
|
751
770
|
*/
|
|
752
771
|
function buildWithNativeCompilerPlugins(options, execution, plugins, timing) {
|
|
753
772
|
const host = (0, sharedHostHelpers_1.selectSharedHostPlugin)(plugins);
|
|
754
|
-
return runNativePluginCommand(host, createNativeBuildArgs(execution, options, plugins), options, execution, "ttsc.build", timing, transformHostTimingLabel(plugins));
|
|
773
|
+
return runNativePluginCommand(host, createNativeBuildArgs(execution, options, plugins), options, execution, "ttsc.build", timing, transformHostTimingLabel(plugins), createNativeBuildTsgoArgs(execution, options));
|
|
755
774
|
}
|
|
756
775
|
/**
|
|
757
776
|
* Run `tsgo -p <tsconfig> [extraArgs]` and return the normalized result. Used
|
|
@@ -767,7 +786,7 @@ function runTsgo(execution, extraArgs, options) {
|
|
|
767
786
|
...(options.passthrough ?? []),
|
|
768
787
|
], {
|
|
769
788
|
cwd: execution.projectRoot,
|
|
770
|
-
env: mergeEnv(options.env),
|
|
789
|
+
env: mergeEnv(options.env, execution.projectRoot),
|
|
771
790
|
encoding: "utf8",
|
|
772
791
|
});
|
|
773
792
|
if (res.error) {
|
|
@@ -790,7 +809,7 @@ function runTsgo(execution, extraArgs, options) {
|
|
|
790
809
|
function runTsgoBuild(execution, options, args) {
|
|
791
810
|
const res = (0, spawnNative_1.spawnNative)(execution.tsgo.binary, args, {
|
|
792
811
|
cwd: execution.projectRoot,
|
|
793
|
-
env: mergeEnv(options.env),
|
|
812
|
+
env: mergeEnv(options.env, execution.projectRoot),
|
|
794
813
|
encoding: "utf8",
|
|
795
814
|
});
|
|
796
815
|
if (res.error) {
|
|
@@ -978,12 +997,18 @@ function createNativeBuildArgs(execution, options, plugins) {
|
|
|
978
997
|
args.push("--quiet");
|
|
979
998
|
}
|
|
980
999
|
}
|
|
981
|
-
// The sidecar builds its Program in-process, so the pinned `rootDir` has to
|
|
982
|
-
// travel the same channel every other tsgo option takes to it — the host flag
|
|
983
|
-
// set does not declare `--rootDir`, and `filterHostArgs` would strip it.
|
|
984
|
-
args.push(...createNativeTsgoArgs(options, pinnedRootDirArgs(execution, options)));
|
|
985
1000
|
return args;
|
|
986
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* The forwarded-tsgo payload for a native `build`/`check` emit invocation.
|
|
1004
|
+
*
|
|
1005
|
+
* The sidecar builds its Program in-process, so the pinned `rootDir` has to
|
|
1006
|
+
* travel the same channel every other tsgo option takes to it — the host flag
|
|
1007
|
+
* set does not declare `--rootDir`, and `filterHostArgs` would strip it.
|
|
1008
|
+
*/
|
|
1009
|
+
function createNativeBuildTsgoArgs(execution, options) {
|
|
1010
|
+
return createNativeTsgoArgs(options, pinnedRootDirArgs(execution, options));
|
|
1011
|
+
}
|
|
987
1012
|
/** Build the argument list for a native plugin check/fix/format invocation. */
|
|
988
1013
|
function createNativeCheckArgs(execution, options, plugin) {
|
|
989
1014
|
const args = [
|
|
@@ -1006,7 +1031,6 @@ function createNativeCheckArgs(execution, options, plugin) {
|
|
|
1006
1031
|
}
|
|
1007
1032
|
args.push(...createNativeCheckThreadingArgs(options, plugin));
|
|
1008
1033
|
args.push(...createNativeCheckDiagnosticsArgs(options, plugin));
|
|
1009
|
-
args.push(...createNativeTsgoArgs(options));
|
|
1010
1034
|
return args;
|
|
1011
1035
|
}
|
|
1012
1036
|
function createNativeProjectInputsArgs(execution, plugin) {
|
|
@@ -1090,10 +1114,32 @@ function transformHostTimingLabel(plugins) {
|
|
|
1090
1114
|
}
|
|
1091
1115
|
/**
|
|
1092
1116
|
* Forward the tsgo flags ttsc did not recognize to a native sidecar as one
|
|
1093
|
-
* JSON-encoded
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1117
|
+
* JSON-encoded payload. The sidecar replays them through tsgo's own option
|
|
1118
|
+
* parser onto `CompilerOptions`, so a flag like `ttsc --strict` reaches a
|
|
1119
|
+
* plugin build the same way it reaches the plain tsgo lane.
|
|
1120
|
+
*
|
|
1121
|
+
* The payload travels in the `TTSC_TSGO_ARGS` environment variable, not on the
|
|
1122
|
+
* sidecar's command line. #113 shipped it as a `--tsgo-args` flag, which is an
|
|
1123
|
+
* addition to a plugin protocol third-party hosts had already frozen: a Go
|
|
1124
|
+
* `flag.FlagSet` created with `flag.ContinueOnError` treats an undeclared flag
|
|
1125
|
+
* as fatal, so every pre-#113 sidecar answered `flag provided but not defined:
|
|
1126
|
+
* -tsgo-args` and exited 2. That took down `ttsc --strict`, `ttsc
|
|
1127
|
+
* --declaration`, `ttsx --strict` and — because {@link isolatedTsgoOutputArgs}
|
|
1128
|
+
* makes this payload non-empty on its own — plain `ttsc <file.ts>`, on every
|
|
1129
|
+
* project carrying a typia/nestia-era transform host (issue #1188).
|
|
1130
|
+
*
|
|
1131
|
+
* The environment is the channel ttsc already uses for host-owned payloads that
|
|
1132
|
+
* must not collide with a third-party flag set (`TTSC_LINKED_PLUGINS_JSON`,
|
|
1133
|
+
* `TTSC_PLUGIN_CONFIG_DIR`). It reaches those hosts without any change on their
|
|
1134
|
+
* side, because `buildSourcePlugin.ts::sourceBuildWorkspaceReplacements` builds
|
|
1135
|
+
* every source plugin against the installed ttsc's own driver, and
|
|
1136
|
+
* `driver.LoadProgram` reads the variable whenever the caller supplied no
|
|
1137
|
+
* explicit argv. It is strictly better than the capability gate `ad3443a` used
|
|
1138
|
+
* for `--singleThreaded` / `--checkers`: that one drops the flag for hosts that
|
|
1139
|
+
* cannot take it, which is acceptable for a threading knob and not for
|
|
1140
|
+
* `--strict`.
|
|
1141
|
+
*
|
|
1142
|
+
* Returns the JSON payload, or `undefined` when this lane forwards nothing.
|
|
1097
1143
|
*/
|
|
1098
1144
|
function createNativeTsgoArgs(options, leading = []) {
|
|
1099
1145
|
const passthrough = [
|
|
@@ -1104,9 +1150,9 @@ function createNativeTsgoArgs(options, leading = []) {
|
|
|
1104
1150
|
...isolatedTsgoOutputArgs(options),
|
|
1105
1151
|
];
|
|
1106
1152
|
if (passthrough.length === 0) {
|
|
1107
|
-
return
|
|
1153
|
+
return undefined;
|
|
1108
1154
|
}
|
|
1109
|
-
return
|
|
1155
|
+
return JSON.stringify(passthrough);
|
|
1110
1156
|
}
|
|
1111
1157
|
function isolatedTsgoOutputArgs(options) {
|
|
1112
1158
|
const target = "isolateOutputsTo" in options &&
|
|
@@ -1189,7 +1235,7 @@ function runNativeCheckPlugins(options, execution, timing) {
|
|
|
1189
1235
|
stderr: "",
|
|
1190
1236
|
};
|
|
1191
1237
|
for (const plugin of execution.nativePlugins.filter((plugin) => plugin.stage === "check")) {
|
|
1192
|
-
const result = runNativePluginCommand(plugin, createNativeCheckArgs(execution, options, plugin), options, execution, "ttsc.check", timing, `ttsc check plugin ${plugin.name} time
|
|
1238
|
+
const result = runNativePluginCommand(plugin, createNativeCheckArgs(execution, options, plugin), options, execution, "ttsc.check", timing, `ttsc check plugin ${plugin.name} time`, createNativeTsgoArgs(options));
|
|
1193
1239
|
out = appendBuildOutput(out, result);
|
|
1194
1240
|
if (result.status !== 0) {
|
|
1195
1241
|
return out;
|
|
@@ -1379,11 +1425,11 @@ function isStringArray(value) {
|
|
|
1379
1425
|
* normalized build result. `label` is used in the thrown error message so the
|
|
1380
1426
|
* caller's context (e.g. `"ttsc.check"` or `"ttsc.build"`) is preserved.
|
|
1381
1427
|
*/
|
|
1382
|
-
function runNativePluginCommand(plugin, args, options, execution, label, timing, timingLabel) {
|
|
1428
|
+
function runNativePluginCommand(plugin, args, options, execution, label, timing, timingLabel, tsgoArgs) {
|
|
1383
1429
|
const startedAt = process.hrtime.bigint();
|
|
1384
1430
|
const res = (0, spawnNative_1.spawnNative)(plugin.binary, args, {
|
|
1385
1431
|
cwd: execution.projectRoot,
|
|
1386
|
-
env: nativePluginEnv(options.env, execution, plugin),
|
|
1432
|
+
env: nativePluginEnv(options.env, execution, plugin, tsgoArgs),
|
|
1387
1433
|
encoding: "utf8",
|
|
1388
1434
|
});
|
|
1389
1435
|
recordTiming(timing, timingLabel, startedAt);
|
|
@@ -1454,7 +1500,7 @@ function resolveExecutionContext(options) {
|
|
|
1454
1500
|
cacheDir: options.cacheDir ?? options.env?.TTSC_CACHE_DIR,
|
|
1455
1501
|
cwd,
|
|
1456
1502
|
entries: options.plugins,
|
|
1457
|
-
env:
|
|
1503
|
+
env: (0, sharedHostHelpers_1.inheritedSidecarEnv)(options.env),
|
|
1458
1504
|
onWatchInputs: options.onWatchInputs,
|
|
1459
1505
|
pluginConfigDir: options.pluginConfigDir,
|
|
1460
1506
|
projectRoot,
|