ttsc 0.31.1 → 0.31.3
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/lib/compiler/internal/build/BuildExecution.d.ts +6 -3
- package/lib/compiler/internal/build/BuildExecution.js +40 -12
- package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
- package/lib/compiler/internal/build/RunBuildOptions.d.ts +2 -1
- package/lib/compiler/internal/startResidentTransform.js +5 -4
- package/lib/compiler/internal/startResidentTransform.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.js +9 -7
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/internal/javascriptRuntimeCapabilities.d.ts +13 -4
- package/lib/internal/javascriptRuntimeCapabilities.js +56 -6
- package/lib/internal/javascriptRuntimeCapabilities.js.map +1 -1
- package/lib/internal/pluginSource.d.ts +1 -0
- package/lib/internal/pluginSource.js +1 -0
- package/lib/internal/pluginSource.js.map +1 -1
- package/lib/internal/resolveNodeBinary.d.ts +6 -1
- package/lib/internal/resolveNodeBinary.js +6 -2
- package/lib/internal/resolveNodeBinary.js.map +1 -1
- package/lib/internal/runtimeExecutableIdentity.d.ts +22 -13
- package/lib/internal/runtimeExecutableIdentity.js +192 -102
- package/lib/internal/runtimeExecutableIdentity.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +2 -2
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runtime/installRuntimeHooks.js +58 -4
- package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.d.ts +5 -1
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js +7 -2
- package/lib/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.js.map +1 -1
- package/lib/launcher/internal/ttscserver/runTtscserver.js +8 -1
- package/lib/launcher/internal/ttscserver/runTtscserver.js.map +1 -1
- package/lib/launcher/internal/watch/WatchTopology.d.ts +20 -3
- package/lib/launcher/internal/watch/WatchTopology.js +31 -9
- package/lib/launcher/internal/watch/WatchTopology.js.map +1 -1
- package/lib/plugin/internal/CapabilityResolutionFormat.d.ts +21 -62
- package/lib/plugin/internal/CapabilityResolutionFormat.js +15 -106
- package/lib/plugin/internal/CapabilityResolutionFormat.js.map +1 -1
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +6 -0
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +4 -4
- package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.d.ts +17 -3
- package/lib/plugin/internal/load/loadProjectPlugins.js +86 -23
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/readCapabilityResolution.d.ts +6 -0
- package/lib/plugin/internal/readCapabilityResolution.js +8 -5
- package/lib/plugin/internal/readCapabilityResolution.js.map +1 -1
- package/lib/plugin/internal/source/GoEnvironmentReading.d.ts +9 -3
- package/lib/plugin/internal/source/GoEnvironmentReading.js +53 -7
- package/lib/plugin/internal/source/GoEnvironmentReading.js.map +1 -1
- package/lib/plugin/internal/source/NativeSourcePackages.d.ts +44 -6
- package/lib/plugin/internal/source/NativeSourcePackages.js +150 -8
- package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +21 -3
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +32 -7
- package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -1
- package/lib/plugin/internal/source/PluginContentIdentities.d.ts +265 -0
- package/lib/plugin/internal/source/PluginContentIdentities.js +452 -0
- package/lib/plugin/internal/source/PluginContentIdentities.js.map +1 -0
- package/lib/plugin/internal/source/PluginLoadAnswers.d.ts +63 -0
- package/lib/plugin/internal/source/PluginLoadAnswers.js +128 -0
- package/lib/plugin/internal/source/PluginLoadAnswers.js.map +1 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.d.ts +10 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js +12 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +13 -2
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +140 -4
- package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
- package/lib/plugin/internal/source/buildSourcePlugin.d.ts +15 -2
- package/lib/plugin/internal/source/buildSourcePlugin.js +27 -4
- package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/source/computeCacheKey.d.ts +21 -5
- package/lib/plugin/internal/source/computeCacheKey.js +71 -29
- package/lib/plugin/internal/source/computeCacheKey.js.map +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +7 -3
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +74 -35
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
- package/lib/plugin/internal/source/pluginBuildEnvironment.d.ts +8 -3
- package/lib/plugin/internal/source/pluginBuildEnvironment.js +8 -4
- package/lib/plugin/internal/source/pluginBuildEnvironment.js.map +1 -1
- package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js +12 -2
- package/lib/plugin/internal/source/pluginBuildEnvironmentWorker.js.map +1 -1
- package/lib/plugin/internal/source/pluginBuildVersions.d.ts +2 -2
- package/lib/plugin/internal/source/pluginBuildVersions.js +4 -17
- package/lib/plugin/internal/source/pluginBuildVersions.js.map +1 -1
- package/lib/plugin/internal/source/pluginSourceState.d.ts +6 -2
- package/lib/plugin/internal/source/pluginSourceState.js +20 -8
- package/lib/plugin/internal/source/pluginSourceState.js.map +1 -1
- package/lib/plugin/internal/source/pluginSourceStateHolds.d.ts +7 -2
- package/lib/plugin/internal/source/pluginSourceStateHolds.js +12 -7
- package/lib/plugin/internal/source/pluginSourceStateHolds.js.map +1 -1
- package/lib/plugin/internal/source/processPluginBuildEnvironment.d.ts +7 -2
- package/lib/plugin/internal/source/processPluginBuildEnvironment.js +8 -3
- package/lib/plugin/internal/source/processPluginBuildEnvironment.js.map +1 -1
- package/lib/plugin/internal/source/provenPluginSourceDigest.d.ts +28 -0
- package/lib/plugin/internal/source/provenPluginSourceDigest.js +41 -0
- package/lib/plugin/internal/source/provenPluginSourceDigest.js.map +1 -0
- package/lib/plugin/internal/source/pruneCacheFileRoot.d.ts +3 -2
- package/lib/plugin/internal/source/pruneCacheFileRoot.js +3 -2
- package/lib/plugin/internal/source/pruneCacheFileRoot.js.map +1 -1
- package/lib/plugin/internal/source/ttscPackageVersion.d.ts +26 -0
- package/lib/plugin/internal/source/ttscPackageVersion.js +47 -0
- package/lib/plugin/internal/source/ttscPackageVersion.js.map +1 -0
- package/lib/plugin/internal/writeCapabilityResolution.d.ts +6 -0
- package/lib/plugin/internal/writeCapabilityResolution.js +11 -7
- package/lib/plugin/internal/writeCapabilityResolution.js.map +1 -1
- package/lib/plugin/resolveCapabilityPlugins.js +67 -15
- package/lib/plugin/resolveCapabilityPlugins.js.map +1 -1
- package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +5 -1
- package/package.json +8 -8
- package/src/compiler/internal/build/BuildExecution.ts +48 -14
- package/src/compiler/internal/build/RunBuildOptions.ts +2 -1
- package/src/compiler/internal/startResidentTransform.ts +12 -3
- package/src/compiler/internal/transformProjectInMemory.ts +10 -2
- package/src/internal/javascriptRuntimeCapabilities.ts +71 -5
- package/src/internal/pluginSource.ts +1 -0
- package/src/internal/resolveNodeBinary.ts +12 -1
- package/src/internal/runtimeExecutableIdentity.ts +227 -141
- package/src/launcher/internal/runTtsc.ts +6 -2
- package/src/launcher/internal/runtime/installRuntimeHooks.ts +68 -3
- package/src/launcher/internal/ttscserver/captureLSPPluginSelectionInputs.ts +11 -2
- package/src/launcher/internal/ttscserver/runTtscserver.ts +18 -1
- package/src/launcher/internal/watch/WatchTopology.ts +38 -9
- package/src/plugin/internal/CapabilityResolutionFormat.ts +23 -107
- package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +14 -4
- package/src/plugin/internal/load/loadProjectPlugins.ts +226 -98
- package/src/plugin/internal/readCapabilityResolution.ts +17 -6
- package/src/plugin/internal/source/GoEnvironmentReading.ts +74 -5
- package/src/plugin/internal/source/NativeSourcePackages.ts +262 -5
- package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +41 -5
- package/src/plugin/internal/source/PluginContentIdentities.ts +563 -0
- package/src/plugin/internal/source/PluginLoadAnswers.ts +151 -0
- package/src/plugin/internal/source/SourceBuildCacheLayout.ts +14 -0
- package/src/plugin/internal/source/SourcePluginWorkspace.ts +176 -2
- package/src/plugin/internal/source/buildSourcePlugin.ts +43 -3
- package/src/plugin/internal/source/computeCacheKey.ts +103 -47
- package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +144 -29
- package/src/plugin/internal/source/pluginBuildEnvironment.ts +9 -2
- package/src/plugin/internal/source/pluginBuildEnvironmentWorker.ts +18 -2
- package/src/plugin/internal/source/pluginBuildVersions.ts +5 -26
- package/src/plugin/internal/source/pluginSourceState.ts +28 -12
- package/src/plugin/internal/source/pluginSourceStateHolds.ts +15 -8
- package/src/plugin/internal/source/processPluginBuildEnvironment.ts +8 -2
- package/src/plugin/internal/source/provenPluginSourceDigest.ts +45 -0
- package/src/plugin/internal/source/pruneCacheFileRoot.ts +3 -2
- package/src/plugin/internal/source/ttscPackageVersion.ts +45 -0
- package/src/plugin/internal/writeCapabilityResolution.ts +29 -8
- package/src/plugin/resolveCapabilityPlugins.ts +87 -13
- package/src/structures/internal/TtscSingleFileEmitOptions.ts +8 -1
|
@@ -16,6 +16,7 @@ const CapabilityPluginResult_1 = require("./internal/CapabilityPluginResult");
|
|
|
16
16
|
const CapabilityResolutionFormat_1 = require("./internal/CapabilityResolutionFormat");
|
|
17
17
|
const loadProjectPlugins_1 = require("./internal/load/loadProjectPlugins");
|
|
18
18
|
const readCapabilityResolution_1 = require("./internal/readCapabilityResolution");
|
|
19
|
+
const PluginContentIdentities_1 = require("./internal/source/PluginContentIdentities");
|
|
19
20
|
const writeCapabilityResolution_1 = require("./internal/writeCapabilityResolution");
|
|
20
21
|
/**
|
|
21
22
|
* The built sidecars of a project's configured plugins that declare one
|
|
@@ -88,12 +89,26 @@ function resolveCapabilityPluginResolution(options) {
|
|
|
88
89
|
// the same cwd. NUL cannot occur in a filename, so this discovery key cannot
|
|
89
90
|
// collide with an explicitly supplied path.
|
|
90
91
|
const tsconfig = options.tsconfig ?? `${String.fromCharCode(0)}discovered`;
|
|
91
|
-
|
|
92
|
+
// WARNING (#1725): every lookup proved the runtime by streaming it, and a hit
|
|
93
|
+
// proved the plugin sources and the whole GOROOT by their bytes, in each
|
|
94
|
+
// process. One store of the project's plugin cache serves every proof of
|
|
95
|
+
// this resolution, opened only once the runtime may be cached at all.
|
|
96
|
+
const identities = capabilityRecordStore(cwd);
|
|
97
|
+
const runtimeProved = capabilityRuntimeAuthorityComplete(cwd, identities);
|
|
92
98
|
const authority = runtimeProved
|
|
93
|
-
? CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
99
|
+
? CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
100
|
+
cwd,
|
|
101
|
+
tsconfig,
|
|
102
|
+
identities: identities(),
|
|
103
|
+
})
|
|
94
104
|
: null;
|
|
95
105
|
const cached = runtimeProved
|
|
96
|
-
? (0, readCapabilityResolution_1.readCapabilityResolution)({
|
|
106
|
+
? (0, readCapabilityResolution_1.readCapabilityResolution)({
|
|
107
|
+
cwd,
|
|
108
|
+
tsconfig,
|
|
109
|
+
version,
|
|
110
|
+
identities: identities(),
|
|
111
|
+
})
|
|
97
112
|
: null;
|
|
98
113
|
E2ETrace_1.E2ETrace.capabilityResolution("lookup", {
|
|
99
114
|
cwd,
|
|
@@ -104,7 +119,7 @@ function resolveCapabilityPluginResolution(options) {
|
|
|
104
119
|
cacheHit: cached !== null,
|
|
105
120
|
});
|
|
106
121
|
if (cached !== null)
|
|
107
|
-
return resolved(cached, options.capability, cwd, tsconfig, authority);
|
|
122
|
+
return resolved(cached, options.capability, cwd, tsconfig, authority, identities);
|
|
108
123
|
const binary = (0, resolveBinary_1.resolveBinary)();
|
|
109
124
|
if (binary === null || binary === undefined)
|
|
110
125
|
return CapabilityPluginResult_1.CapabilityPluginResult.unavailable();
|
|
@@ -153,11 +168,20 @@ function resolveCapabilityPluginResolution(options) {
|
|
|
153
168
|
const recorded = runtimeProved &&
|
|
154
169
|
authority !== null &&
|
|
155
170
|
(authorityUnchanged =
|
|
156
|
-
CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
157
|
-
|
|
171
|
+
CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
172
|
+
cwd,
|
|
173
|
+
tsconfig,
|
|
174
|
+
identities: identities(),
|
|
175
|
+
}) === authority) &&
|
|
158
176
|
loaded.descriptorReadsDeclared &&
|
|
159
177
|
loaded.discoveryInputsComplete
|
|
160
|
-
? (0, writeCapabilityResolution_1.writeCapabilityResolution)({
|
|
178
|
+
? (0, writeCapabilityResolution_1.writeCapabilityResolution)({
|
|
179
|
+
cwd,
|
|
180
|
+
tsconfig,
|
|
181
|
+
version,
|
|
182
|
+
expectedAuthority: authority,
|
|
183
|
+
identities: identities(),
|
|
184
|
+
}, answer)
|
|
161
185
|
: null;
|
|
162
186
|
E2ETrace_1.E2ETrace.capabilityResolution("answer", {
|
|
163
187
|
cwd,
|
|
@@ -184,9 +208,29 @@ function resolveCapabilityPluginResolution(options) {
|
|
|
184
208
|
plugins: CapabilityPluginResult_1.CapabilityPluginResult.select(answer, options.capability),
|
|
185
209
|
status: "resolved",
|
|
186
210
|
}
|
|
187
|
-
: resolved(recorded, options.capability, cwd, tsconfig, authority);
|
|
211
|
+
: resolved(recorded, options.capability, cwd, tsconfig, authority, identities);
|
|
188
212
|
});
|
|
189
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* The record store of `cwd`'s plugin cache, opened on first use and kept for
|
|
216
|
+
* the resolution and its later freshness queries, or `undefined` when none can
|
|
217
|
+
* be opened. A kept store's references only grow older, which can make fewer
|
|
218
|
+
* stamps separable but never more.
|
|
219
|
+
*/
|
|
220
|
+
function capabilityRecordStore(cwd) {
|
|
221
|
+
let opened = false;
|
|
222
|
+
let store;
|
|
223
|
+
return () => {
|
|
224
|
+
if (!opened) {
|
|
225
|
+
opened = true;
|
|
226
|
+
store = PluginContentIdentities_1.PluginContentIdentities.open({
|
|
227
|
+
projectRoot: cwd,
|
|
228
|
+
env: process.env,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return store;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
190
234
|
/**
|
|
191
235
|
* Whether the keyed executable is the actual sole descriptor runtime.
|
|
192
236
|
*
|
|
@@ -198,7 +242,7 @@ function resolveCapabilityPluginResolution(options) {
|
|
|
198
242
|
* operation's existing decision and preserves short-circuited comparisons as
|
|
199
243
|
* unobserved, without repeating native queries.
|
|
200
244
|
*/
|
|
201
|
-
function capabilityRuntimeAuthorityComplete(cwd) {
|
|
245
|
+
function capabilityRuntimeAuthorityComplete(cwd, identities) {
|
|
202
246
|
if (SidecarEnvironment_1.SidecarEnvironment.read(process.env, "NODE_OPTIONS")?.trim()) {
|
|
203
247
|
E2ETrace_1.E2ETrace.capabilityResolution("runtime-authority", {
|
|
204
248
|
cwd,
|
|
@@ -219,7 +263,7 @@ function capabilityRuntimeAuthorityComplete(cwd) {
|
|
|
219
263
|
return false;
|
|
220
264
|
}
|
|
221
265
|
try {
|
|
222
|
-
const capabilities = (0, javascriptRuntimeCapabilities_1.javascriptRuntimeCapabilities)(runtime, process.env, cwd);
|
|
266
|
+
const capabilities = (0, javascriptRuntimeCapabilities_1.javascriptRuntimeCapabilities)(runtime, process.env, cwd, identities());
|
|
223
267
|
let executableMatches;
|
|
224
268
|
const proved = !capabilities.bun &&
|
|
225
269
|
capabilities.registerHooks &&
|
|
@@ -249,17 +293,25 @@ function capabilityRuntimeAuthorityComplete(cwd) {
|
|
|
249
293
|
}
|
|
250
294
|
}
|
|
251
295
|
/** A complete accepted cache generation and its owning validity query. */
|
|
252
|
-
function resolved(entry, capability, cwd, tsconfig, authority) {
|
|
296
|
+
function resolved(entry, capability, cwd, tsconfig, authority, identities) {
|
|
253
297
|
const proof = JSON.stringify(entry);
|
|
254
298
|
return {
|
|
255
299
|
isCurrent: () => {
|
|
256
300
|
try {
|
|
257
301
|
if (authority === null ||
|
|
258
|
-
!capabilityRuntimeAuthorityComplete(cwd) ||
|
|
259
|
-
CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
260
|
-
|
|
302
|
+
!capabilityRuntimeAuthorityComplete(cwd, identities) ||
|
|
303
|
+
CapabilityResolutionFormat_1.CapabilityResolutionFormat.resolutionFile({
|
|
304
|
+
cwd,
|
|
305
|
+
tsconfig,
|
|
306
|
+
identities: identities(),
|
|
307
|
+
}) !== authority)
|
|
261
308
|
return false;
|
|
262
|
-
const current = (0, readCapabilityResolution_1.readCapabilityResolution)({
|
|
309
|
+
const current = (0, readCapabilityResolution_1.readCapabilityResolution)({
|
|
310
|
+
cwd,
|
|
311
|
+
tsconfig,
|
|
312
|
+
version,
|
|
313
|
+
identities: identities(),
|
|
314
|
+
});
|
|
263
315
|
return current !== null && JSON.stringify(current) === proof;
|
|
264
316
|
}
|
|
265
317
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCapabilityPlugins.js","sourceRoot":"","sources":["../../src/plugin/resolveCapabilityPlugins.ts"],"names":[],"mappings":";;;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,gHAA6G;AAC7G,sEAAmE;AACnE,2FAAwF;AACxF,mDAAgD;AAChD,6FAA0F;AAK1F,8EAA2E;AAC3E,sFAAmF;AAEnF,2EAAwE;AACxE,kFAA+E;AAC/E,oFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;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AAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginContentIdentities } from "../../plugin/internal/source/PluginContentIdentities";
|
|
1
2
|
import type { ITtscProjectInputSnapshot } from "./ITtscProjectInputSnapshot";
|
|
2
3
|
import type { TtscCommonOptions } from "./TtscCommonOptions";
|
|
3
4
|
/**
|
|
@@ -32,6 +33,9 @@ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
|
|
|
32
33
|
* Executable modules, linked source roots, contributors and external local
|
|
33
34
|
* module replacements can be reported. ttsc's own package sources are omitted;
|
|
34
35
|
* this notification is not the complete compiler or project-rule input graph.
|
|
36
|
+
* The reporting load also hands over its record store, if it opened one, so the
|
|
37
|
+
* owner proves each root's state from the plugin cache's records instead of
|
|
38
|
+
* reading the sources the load is about to prove (#1728).
|
|
35
39
|
*
|
|
36
40
|
* @evidence contracts/common.md#principled-implementation Readonly roots describe the actual native-plugin sources whose later edits need observation.
|
|
37
41
|
* @evidence contracts/common.md#clear-and-simple-design A void notification leaves watcher construction and lifetime with the invocation owner.
|
|
@@ -42,7 +46,7 @@ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
|
|
|
42
46
|
* @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
|
|
43
47
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
44
48
|
*/
|
|
45
|
-
export type TtscPluginSourceInputsHandler = (inputs: readonly string[]) => void;
|
|
49
|
+
export type TtscPluginSourceInputsHandler = (inputs: readonly string[], identities?: PluginContentIdentities.Store) => void;
|
|
46
50
|
/**
|
|
47
51
|
* Receive the discovered project-rule filesystem topology for the watch owner.
|
|
48
52
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttsc",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.3",
|
|
4
4
|
"description": "General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
63
|
"fsevents": "^2.3.3",
|
|
64
|
-
"@ttsc/linux-
|
|
65
|
-
"@ttsc/linux-
|
|
66
|
-
"@ttsc/linux-arm64": "0.31.
|
|
67
|
-
"@ttsc/darwin-
|
|
68
|
-
"@ttsc/darwin-
|
|
69
|
-
"@ttsc/win32-
|
|
70
|
-
"@ttsc/win32-
|
|
64
|
+
"@ttsc/linux-arm": "0.31.3",
|
|
65
|
+
"@ttsc/linux-x64": "0.31.3",
|
|
66
|
+
"@ttsc/linux-arm64": "0.31.3",
|
|
67
|
+
"@ttsc/darwin-arm64": "0.31.3",
|
|
68
|
+
"@ttsc/darwin-x64": "0.31.3",
|
|
69
|
+
"@ttsc/win32-x64": "0.31.3",
|
|
70
|
+
"@ttsc/win32-arm64": "0.31.3"
|
|
71
71
|
},
|
|
72
72
|
"sideEffects": [
|
|
73
73
|
"./lib/register.js",
|
|
@@ -5,12 +5,14 @@ import { createCanonicalTempDirectory } from "../../../internal/createCanonicalT
|
|
|
5
5
|
import { resolveNodeBinary } from "../../../internal/resolveNodeBinary";
|
|
6
6
|
import { hasProjectPluginEntries } from "../../../plugin/internal/load/hasProjectPluginEntries";
|
|
7
7
|
import { loadProjectPlugins } from "../../../plugin/internal/load/loadProjectPlugins";
|
|
8
|
+
import { PluginContentIdentities } from "../../../plugin/internal/source/PluginContentIdentities";
|
|
8
9
|
import type { ITtscLoadedNativePlugin } from "../../../structures/internal/ITtscLoadedNativePlugin";
|
|
9
10
|
import type { ITtscParsedProjectConfig } from "../../../structures/internal/ITtscParsedProjectConfig";
|
|
10
11
|
import type { ITtscProjectInputSnapshot } from "../../../structures/internal/ITtscProjectInputSnapshot";
|
|
11
12
|
import type { TtscBuildOptions } from "../../../structures/internal/TtscBuildOptions";
|
|
12
13
|
import type { TtscBuildResult } from "../../../structures/internal/TtscBuildResult";
|
|
13
14
|
import type { TtscCommonOptions } from "../../../structures/internal/TtscCommonOptions";
|
|
15
|
+
import type { TtscPluginSourceInputsHandler } from "../../../structures/internal/TtscSingleFileEmitOptions";
|
|
14
16
|
import { outputText } from "../outputText";
|
|
15
17
|
import { readProjectConfig } from "../project/readProjectConfig";
|
|
16
18
|
import { CompilerProjectSelection } from "../project/CompilerProjectSelection";
|
|
@@ -70,19 +72,37 @@ export namespace BuildExecution {
|
|
|
70
72
|
* Merge extra environment variables over `process.env`, always injecting
|
|
71
73
|
* `TTSC_NODE_BINARY` selected by the runtime capability owner. Explicit
|
|
72
74
|
* compatible overrides can select a different Node executable; this is not
|
|
73
|
-
* necessarily the current process binary.
|
|
75
|
+
* necessarily the current process binary. An invocation that loaded plugins
|
|
76
|
+
* passes its record store, so the runtime is proven from metadata instead of
|
|
77
|
+
* streamed again before every native spawn (#1723).
|
|
74
78
|
*/
|
|
75
79
|
function mergeEnv(
|
|
76
|
-
extra
|
|
77
|
-
cwd: string
|
|
80
|
+
extra: NodeJS.ProcessEnv | undefined,
|
|
81
|
+
cwd: string,
|
|
82
|
+
identities: PluginContentIdentities.Store | undefined,
|
|
78
83
|
...later: readonly (NodeJS.ProcessEnv | undefined)[]
|
|
79
84
|
): NodeJS.ProcessEnv {
|
|
80
85
|
const env = SidecarEnvironment.merge(process.env, extra, ...later);
|
|
81
|
-
const node = resolveNodeBinary(env, cwd);
|
|
86
|
+
const node = resolveNodeBinary(env, cwd, identities);
|
|
82
87
|
SidecarEnvironment.write(env, "TTSC_NODE_BINARY", node);
|
|
83
88
|
return env;
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Merge extra environment variables over `process.env` for a spawn of the
|
|
93
|
+
* selected TypeScript-Go compiler itself.
|
|
94
|
+
*
|
|
95
|
+
* WARNING (#1726): the compiler never reads `TTSC_NODE_BINARY`, which only
|
|
96
|
+
* plugin sidecars consume (`mergeEnv`). Selecting it streamed the 85 MB Node
|
|
97
|
+
* executable twice and probed it on every launch, plugins or not, about 0.2 s
|
|
98
|
+
* of a 0.5 s build without plugins.
|
|
99
|
+
*/
|
|
100
|
+
function compilerEnv(
|
|
101
|
+
extra: NodeJS.ProcessEnv | undefined,
|
|
102
|
+
): NodeJS.ProcessEnv {
|
|
103
|
+
return SidecarEnvironment.merge(process.env, extra);
|
|
104
|
+
}
|
|
105
|
+
|
|
86
106
|
/**
|
|
87
107
|
* Build the environment for a native plugin spawn. Injects `TTSC_TSGO_BINARY`
|
|
88
108
|
* and `TTSC_TTSX_BINARY` alongside the base env from `mergeEnv`, plus
|
|
@@ -123,6 +143,7 @@ export namespace BuildExecution {
|
|
|
123
143
|
path.join(__dirname, "..", "..", "..", "launcher", "ttsx.js"),
|
|
124
144
|
},
|
|
125
145
|
execution.projectRoot,
|
|
146
|
+
execution.identities,
|
|
126
147
|
extra,
|
|
127
148
|
// The invocation's resolved compiler owns the final environment layer.
|
|
128
149
|
{ TTSC_TSGO_BINARY: execution.tsgo.binary },
|
|
@@ -453,7 +474,7 @@ export namespace BuildExecution {
|
|
|
453
474
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The caught resolution failure is legitimate only for commands not requiring a project; ordinary compilation failures do not enter this bypass.
|
|
454
475
|
* @evidence contracts/common.md#meaningful-documentation Native paragraphs explain project-independent commands, existing-project behavior and null applicability; the catch comment states its deliberate broad premise.
|
|
455
476
|
* @evidence contracts/portability.md#os-neutral-implementation Invocation cwd is resolved natively and spawnNative receives executable/argv separately with platform-aware environment merging.
|
|
456
|
-
* @evidence contracts/performance.md#efficient-algorithms Flag selection scans forwarded argument/name text before config IO. An applicable lane includes native cwd/config resolution, binary
|
|
477
|
+
* @evidence contracts/performance.md#efficient-algorithms Flag selection scans forwarded argument/name text before config IO. An applicable lane includes native cwd/config resolution, binary lookup, argv/env composition without runtime capability work (#1726), complete captured output and diagnostic normalization; one requested command does not bound its native duration or output bytes.
|
|
457
478
|
*
|
|
458
479
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work A project probe and effectful terminal invocation establish no retained or shared cross-request result.
|
|
459
480
|
*
|
|
@@ -482,7 +503,7 @@ export namespace BuildExecution {
|
|
|
482
503
|
const tsgo = resolveTsgo({ ...options, cwd });
|
|
483
504
|
const res = spawnNative(tsgo.binary, [...(options.passthrough ?? [])], {
|
|
484
505
|
cwd,
|
|
485
|
-
env:
|
|
506
|
+
env: compilerEnv(options.env),
|
|
486
507
|
encoding: "utf8",
|
|
487
508
|
});
|
|
488
509
|
if (res.error) {
|
|
@@ -796,7 +817,7 @@ export namespace BuildExecution {
|
|
|
796
817
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Supported compiler options express the check contract without intercepting writes or replacing compiler APIs; spawn errors remain errors.
|
|
797
818
|
* @evidence contracts/common.md#meaningful-documentation Native prose explains the no-emit use and load-bearing argument precedence.
|
|
798
819
|
* @evidence contracts/portability.md#os-neutral-implementation spawnNative uses the selected executable, separate argv and project cwd; environment composition handles native variable aliases and output text decoding is explicit UTF-8.
|
|
799
|
-
* @evidence contracts/performance.md#efficient-algorithms One argv composition includes delegated option-presence classification, threading/isolation text and argument copies. Environment composition
|
|
820
|
+
* @evidence contracts/performance.md#efficient-algorithms One argv composition includes delegated option-presence classification, threading/isolation text and argument copies. Environment composition only layers variables; the compiler reads no Node selection, so no runtime capability probe precedes the launch (#1726). Complete capture/decoding and diagnostic normalization follow. Work/storage depend on argument/env/path/report bytes and native child work, without an asserted measured cost ranking.
|
|
800
821
|
*
|
|
801
822
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This executes the requested compiler pass; equivalence with other phases must be established by orchestration rather than caching a result here.
|
|
802
823
|
*
|
|
@@ -822,7 +843,7 @@ export namespace BuildExecution {
|
|
|
822
843
|
],
|
|
823
844
|
{
|
|
824
845
|
cwd: execution.compilerSelection.compilerArgsCwd,
|
|
825
|
-
env:
|
|
846
|
+
env: compilerEnv(options.env),
|
|
826
847
|
encoding: "utf8",
|
|
827
848
|
},
|
|
828
849
|
);
|
|
@@ -856,7 +877,7 @@ export namespace BuildExecution {
|
|
|
856
877
|
options: RunBuildOptions,
|
|
857
878
|
args: readonly string[],
|
|
858
879
|
): TtscBuildResult {
|
|
859
|
-
const env =
|
|
880
|
+
const env = compilerEnv(options.env);
|
|
860
881
|
const userOptions = readEffectiveCompilerOptions(
|
|
861
882
|
execution.project,
|
|
862
883
|
options.passthrough,
|
|
@@ -1170,7 +1191,7 @@ export namespace BuildExecution {
|
|
|
1170
1191
|
export function resolveExecutionContext(
|
|
1171
1192
|
options: TtscCommonOptions & {
|
|
1172
1193
|
emit?: boolean;
|
|
1173
|
-
onWatchInputs?:
|
|
1194
|
+
onWatchInputs?: TtscPluginSourceInputsHandler;
|
|
1174
1195
|
resolvedProject?: ITtscParsedProjectConfig;
|
|
1175
1196
|
tsconfig?: string;
|
|
1176
1197
|
},
|
|
@@ -1183,19 +1204,31 @@ export namespace BuildExecution {
|
|
|
1183
1204
|
const tsgo = resolveTsgo({ ...options, cwd: projectRoot });
|
|
1184
1205
|
let pluginSetupFailure: TtscBuildResult | undefined;
|
|
1185
1206
|
let nativePlugins: ITtscLoadedNativePlugin[] = [];
|
|
1207
|
+
// Opened only for an invocation that loads plugins, so a project without
|
|
1208
|
+
// any never gains a cache directory; the load and every later native spawn
|
|
1209
|
+
// of this invocation prove their unchanged inputs through it (#1722, #1723).
|
|
1210
|
+
let identities: PluginContentIdentities.Store | undefined;
|
|
1186
1211
|
try {
|
|
1187
1212
|
if (
|
|
1188
1213
|
compilerSelection.inspectionError === undefined &&
|
|
1189
1214
|
hasProjectPluginEntries(project, options.plugins)
|
|
1190
1215
|
) {
|
|
1216
|
+
const cacheDir =
|
|
1217
|
+
options.cacheDir ??
|
|
1218
|
+
SidecarEnvironment.read(options.env, "TTSC_CACHE_DIR");
|
|
1219
|
+
const env = inheritedSidecarEnv(options.env, options.binary);
|
|
1220
|
+
identities = PluginContentIdentities.open({
|
|
1221
|
+
projectRoot,
|
|
1222
|
+
cacheDir,
|
|
1223
|
+
env,
|
|
1224
|
+
});
|
|
1191
1225
|
nativePlugins = loadProjectPlugins({
|
|
1192
1226
|
binary: resolveBinary(options) ?? "",
|
|
1193
|
-
cacheDir
|
|
1194
|
-
options.cacheDir ??
|
|
1195
|
-
SidecarEnvironment.read(options.env, "TTSC_CACHE_DIR"),
|
|
1227
|
+
cacheDir,
|
|
1196
1228
|
cwd,
|
|
1197
1229
|
entries: options.plugins,
|
|
1198
|
-
env
|
|
1230
|
+
env,
|
|
1231
|
+
identities,
|
|
1199
1232
|
onWatchInputs: options.onWatchInputs,
|
|
1200
1233
|
pluginConfigDir: options.pluginConfigDir,
|
|
1201
1234
|
projectRoot,
|
|
@@ -1215,6 +1248,7 @@ export namespace BuildExecution {
|
|
|
1215
1248
|
return {
|
|
1216
1249
|
compilerSelection,
|
|
1217
1250
|
cwd,
|
|
1251
|
+
...(identities === undefined ? {} : { identities }),
|
|
1218
1252
|
nativePlugins,
|
|
1219
1253
|
pluginConfigDir: resolvePluginConfigDir({
|
|
1220
1254
|
cwd,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ITtscParsedProjectConfig } from "../../../structures/internal/ITtscParsedProjectConfig";
|
|
2
2
|
import type { ITtscProjectInputSnapshot } from "../../../structures/internal/ITtscProjectInputSnapshot";
|
|
3
3
|
import type { TtscBuildOptions } from "../../../structures/internal/TtscBuildOptions";
|
|
4
|
+
import type { TtscPluginSourceInputsHandler } from "../../../structures/internal/TtscSingleFileEmitOptions";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Options of one {@link runBuild} call: the public build options plus the knobs
|
|
@@ -120,7 +121,7 @@ export type RunBuildOptions = TtscBuildOptions & {
|
|
|
120
121
|
* The watch launcher uses these roots to invalidate a sidecar when its Go
|
|
121
122
|
* implementation changes between rebuilds.
|
|
122
123
|
*/
|
|
123
|
-
onWatchInputs?:
|
|
124
|
+
onWatchInputs?: TtscPluginSourceInputsHandler;
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* Receives the reconciled project-rule filesystem dependency snapshot. Called
|
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
|
|
3
3
|
import { resolveNodeBinary } from "../../internal/resolveNodeBinary";
|
|
4
4
|
import { loadProjectPlugins } from "../../plugin/internal/load/loadProjectPlugins";
|
|
5
|
+
import type { PluginContentIdentities } from "../../plugin/internal/source/PluginContentIdentities";
|
|
5
6
|
import type { ITtscCompilerContext } from "../../structures/ITtscCompilerContext";
|
|
6
7
|
import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin";
|
|
7
8
|
import { ResidentTransformProcess } from "./ResidentTransformProcess";
|
|
@@ -94,7 +95,13 @@ export function startResidentTransform(
|
|
|
94
95
|
],
|
|
95
96
|
binary: host.binary,
|
|
96
97
|
cwd: project.root,
|
|
97
|
-
env: residentEnv(
|
|
98
|
+
env: residentEnv(
|
|
99
|
+
context,
|
|
100
|
+
project.root,
|
|
101
|
+
tsgoBinary,
|
|
102
|
+
loaded.nativePlugins,
|
|
103
|
+
loaded.identities,
|
|
104
|
+
),
|
|
98
105
|
});
|
|
99
106
|
return { process: resident, projectRoot: project.root };
|
|
100
107
|
}
|
|
@@ -106,13 +113,15 @@ export function startResidentTransform(
|
|
|
106
113
|
* plugin config anchor (an embedder compiling through a generated wrapper
|
|
107
114
|
* tsconfig) so config-file discovery walks the real project instead of the
|
|
108
115
|
* wrapper's temp-dir ancestry, and forwards linked transform plugins via
|
|
109
|
-
* `TTSC_LINKED_PLUGINS_JSON`.
|
|
116
|
+
* `TTSC_LINKED_PLUGINS_JSON`. The load's record store proves the Node runtime
|
|
117
|
+
* from metadata instead of streaming it again (#1723).
|
|
110
118
|
*/
|
|
111
119
|
function residentEnv(
|
|
112
120
|
context: ITtscCompilerContext,
|
|
113
121
|
projectRoot: string,
|
|
114
122
|
tsgoBinary: string,
|
|
115
123
|
nativePlugins: readonly ITtscLoadedNativePlugin[],
|
|
124
|
+
identities: PluginContentIdentities.Store | undefined,
|
|
116
125
|
): NodeJS.ProcessEnv {
|
|
117
126
|
const pluginConfigDir = resolvePluginConfigDir(context);
|
|
118
127
|
const env = SidecarEnvironment.merge(
|
|
@@ -128,7 +137,7 @@ function residentEnv(
|
|
|
128
137
|
context.env,
|
|
129
138
|
{ TTSC_TSGO_BINARY: tsgoBinary },
|
|
130
139
|
);
|
|
131
|
-
const node = resolveNodeBinary(env, projectRoot);
|
|
140
|
+
const node = resolveNodeBinary(env, projectRoot, identities);
|
|
132
141
|
SidecarEnvironment.write(env, "TTSC_NODE_BINARY", node);
|
|
133
142
|
// The anchor is per-invocation state owned by this host: when this run
|
|
134
143
|
// declared none (and the caller's env does not name one), drop any value
|
|
@@ -5,6 +5,7 @@ import { collectProjectHostInputs } from "../../plugin/internal/load/collectProj
|
|
|
5
5
|
import { hashHostInputPaths } from "../../plugin/internal/load/hashHostInputPaths";
|
|
6
6
|
import { loadProjectPlugins } from "../../plugin/internal/load/loadProjectPlugins";
|
|
7
7
|
import { realpathHostInputPaths } from "../../plugin/internal/load/realpathHostInputPaths";
|
|
8
|
+
import type { PluginContentIdentities } from "../../plugin/internal/source/PluginContentIdentities";
|
|
8
9
|
import type { ITtscCompilerContext } from "../../structures/ITtscCompilerContext";
|
|
9
10
|
import type { ITtscCompilerTransformation } from "../../structures/ITtscCompilerTransformation";
|
|
10
11
|
import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin";
|
|
@@ -301,6 +302,7 @@ function transformProjectWithPlugins(
|
|
|
301
302
|
tsgoBinary,
|
|
302
303
|
loaded.nativePlugins,
|
|
303
304
|
checks,
|
|
305
|
+
loaded.identities,
|
|
304
306
|
);
|
|
305
307
|
const checkedHostInputs = mergeHostInputs(
|
|
306
308
|
loaded.hostInputs,
|
|
@@ -414,6 +416,7 @@ function transformProjectWithPlugins(
|
|
|
414
416
|
tsgoBinary,
|
|
415
417
|
loaded.nativePlugins,
|
|
416
418
|
plugin,
|
|
419
|
+
loaded.identities,
|
|
417
420
|
),
|
|
418
421
|
},
|
|
419
422
|
);
|
|
@@ -688,6 +691,7 @@ function runNativeChecks(
|
|
|
688
691
|
tsgoBinary: string,
|
|
689
692
|
nativePlugins: readonly ITtscLoadedNativePlugin[],
|
|
690
693
|
checks: readonly ITtscLoadedNativePlugin[],
|
|
694
|
+
identities: PluginContentIdentities.Store | undefined,
|
|
691
695
|
): TtscBuildResult {
|
|
692
696
|
let result: TtscBuildResult = {
|
|
693
697
|
diagnostics: [],
|
|
@@ -716,6 +720,7 @@ function runNativeChecks(
|
|
|
716
720
|
tsgoBinary,
|
|
717
721
|
nativePlugins,
|
|
718
722
|
plugin,
|
|
723
|
+
identities,
|
|
719
724
|
),
|
|
720
725
|
},
|
|
721
726
|
);
|
|
@@ -804,7 +809,9 @@ function serializeNativePlugins(
|
|
|
804
809
|
* the caller declared a plugin config anchor (an embedder compiling through a
|
|
805
810
|
* generated wrapper tsconfig) so config-file discovery walks the real project
|
|
806
811
|
* instead of the wrapper's temp-dir ancestry. For transform plugins, also
|
|
807
|
-
* passes `TTSC_LINKED_PLUGINS_JSON` when linked sources are present.
|
|
812
|
+
* passes `TTSC_LINKED_PLUGINS_JSON` when linked sources are present. The load's
|
|
813
|
+
* record store proves the Node runtime from metadata instead of streaming it
|
|
814
|
+
* before every spawn of every generation (#1723).
|
|
808
815
|
*/
|
|
809
816
|
function nativePluginEnv(
|
|
810
817
|
options: ITtscCompilerContext,
|
|
@@ -812,6 +819,7 @@ function nativePluginEnv(
|
|
|
812
819
|
tsgoBinary: string,
|
|
813
820
|
nativePlugins?: readonly ITtscLoadedNativePlugin[],
|
|
814
821
|
plugin?: ITtscLoadedNativePlugin,
|
|
822
|
+
identities?: PluginContentIdentities.Store,
|
|
815
823
|
): NodeJS.ProcessEnv {
|
|
816
824
|
const pluginConfigDir = resolvePluginConfigDir(options);
|
|
817
825
|
const env = SidecarEnvironment.merge(
|
|
@@ -827,7 +835,7 @@ function nativePluginEnv(
|
|
|
827
835
|
options.env,
|
|
828
836
|
{ TTSC_TSGO_BINARY: tsgoBinary },
|
|
829
837
|
);
|
|
830
|
-
const node = resolveNodeBinary(env, projectRoot);
|
|
838
|
+
const node = resolveNodeBinary(env, projectRoot, identities);
|
|
831
839
|
SidecarEnvironment.write(env, "TTSC_NODE_BINARY", node);
|
|
832
840
|
// The anchor is per-invocation state owned by this host: when this run
|
|
833
841
|
// declared none (and the caller's env does not name one), drop any value
|