ttsc 0.31.1 → 0.31.2
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 +4 -2
- package/lib/compiler/internal/build/BuildExecution.js +40 -12
- package/lib/compiler/internal/build/BuildExecution.js.map +1 -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/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/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 +12 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +80 -20
- 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 +5 -2
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +5 -3
- 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/package.json +8 -8
- package/src/compiler/internal/build/BuildExecution.ts +46 -13
- 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/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/plugin/internal/CapabilityResolutionFormat.ts +23 -107
- package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +14 -4
- package/src/plugin/internal/load/loadProjectPlugins.ts +212 -94
- 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 +6 -1
- 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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.provenPluginSourceDigest = provenPluginSourceDigest;
|
|
4
|
+
const PluginContentIdentities_1 = require("./PluginContentIdentities");
|
|
5
|
+
/**
|
|
6
|
+
* The `pluginSourceDigest` of a plugin source directory, proven from the
|
|
7
|
+
* records of `projectRoot`'s plugin cache when the caller names its project.
|
|
8
|
+
*
|
|
9
|
+
* WARNING (#1725): a consumer that proves a reported plugin-source state in a
|
|
10
|
+
* new process, such as a bundler worker, a capability host or the language
|
|
11
|
+
* server, read every source byte again because its own memo starts empty. The
|
|
12
|
+
* load that reported the state already recorded this digest
|
|
13
|
+
* (`PluginContentIdentities`), so a process that names the same project reuses
|
|
14
|
+
* it while the files' metadata still holds. Without a project, or when no store
|
|
15
|
+
* can be opened, the bytes are read as before.
|
|
16
|
+
*
|
|
17
|
+
* @param directory The source directory.
|
|
18
|
+
* @param projectRoot Project whose plugin cache root holds the records.
|
|
19
|
+
* @param env Environment selecting that cache root; this process's by default.
|
|
20
|
+
* @returns The digest, as lowercase hex.
|
|
21
|
+
* @throws When a listed source file cannot be read, as `pluginSourceDigest`
|
|
22
|
+
* does.
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation The record store applies its separable-signature rule to exactly the files the digest reads; every unproved premise falls back to the content reader.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design Store opening and the population proof stay with PluginContentIdentities; this entry only names the project for consumers outside the loader.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No path, timestamp or process memo stands for content; the store refuses a root inside the source.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The paragraphs state the regression, the reuse premise and the fallback.
|
|
27
|
+
* @evidence contracts/portability.md#os-neutral-implementation Cache-root selection and device-keyed references are delegated to the shared owners.
|
|
28
|
+
* @evidence contracts/performance.md#efficient-algorithms A proven digest stats the selected files; an unproven one also reads their bytes once. Opening the store writes two reference probes.
|
|
29
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The digest the load recorded is reused across processes under the same project's store.
|
|
30
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The store lives for this call; records belong to the cache root's single-file pruning.
|
|
31
|
+
*/
|
|
32
|
+
function provenPluginSourceDigest(directory, projectRoot, env = process.env) {
|
|
33
|
+
return PluginContentIdentities_1.PluginContentIdentities.sourceDirectory(projectRoot === undefined
|
|
34
|
+
? undefined
|
|
35
|
+
: PluginContentIdentities_1.PluginContentIdentities.open({
|
|
36
|
+
projectRoot,
|
|
37
|
+
env,
|
|
38
|
+
sources: [directory],
|
|
39
|
+
}), directory);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=provenPluginSourceDigest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenPluginSourceDigest.js","sourceRoot":"","sources":["../../../../src/plugin/internal/source/provenPluginSourceDigest.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,kCACE,SAAiB,EACjB,WAAoB,EACpB,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,OAAO,iDAAuB,CAAC,eAAe,CAC5C,WAAW,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,iDAAuB,CAAC,IAAI,CAAC;YAC3B,WAAW;YACX,GAAG;YACH,OAAO,EAAE,CAAC,SAAS,CAAC;SACrB,CAAC,EACN,SAAS,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -2,8 +2,9 @@ import type { IPluginCachePruneOptions } from "./IPluginCachePruneOptions";
|
|
|
2
2
|
/**
|
|
3
3
|
* Opportunistically bound a part of the cache root whose entries are single
|
|
4
4
|
* files: the descriptor evaluations under `descriptors/`, the capability
|
|
5
|
-
* answers under `capabilities/`,
|
|
6
|
-
* `
|
|
5
|
+
* answers under `capabilities/`, the plugin content identities under
|
|
6
|
+
* `identities/`, the plugin-load answers under `answers/`, and the lowered
|
|
7
|
+
* orphan sources under `ttsx-orphan/`.
|
|
7
8
|
*
|
|
8
9
|
* The policy is the plugin cache's (`CachePrunePolicy`). An entry's last use is
|
|
9
10
|
* its modification time: a write sets it, and every hit records a use by
|
|
@@ -11,8 +11,9 @@ const SourceBuildCacheLayout_1 = require("./SourceBuildCacheLayout");
|
|
|
11
11
|
/**
|
|
12
12
|
* Opportunistically bound a part of the cache root whose entries are single
|
|
13
13
|
* files: the descriptor evaluations under `descriptors/`, the capability
|
|
14
|
-
* answers under `capabilities/`,
|
|
15
|
-
* `
|
|
14
|
+
* answers under `capabilities/`, the plugin content identities under
|
|
15
|
+
* `identities/`, the plugin-load answers under `answers/`, and the lowered
|
|
16
|
+
* orphan sources under `ttsx-orphan/`.
|
|
16
17
|
*
|
|
17
18
|
* The policy is the plugin cache's (`CachePrunePolicy`). An entry's last use is
|
|
18
19
|
* its modification time: a write sets it, and every hit records a use by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pruneCacheFileRoot.js","sourceRoot":"","sources":["../../../../src/plugin/internal/source/pruneCacheFileRoot.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,yDAAsD;AAEtD,qEAAkE;AAElE
|
|
1
|
+
{"version":3,"file":"pruneCacheFileRoot.js","sourceRoot":"","sources":["../../../../src/plugin/internal/source/pruneCacheFileRoot.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,yDAAsD;AAEtD,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,4BACE,IAAY,EACZ,OAAO,GAAuD,EAAE;IAEhE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,cAAc,EAAE;YAAE,OAAO;QAC3D,IAAI,GAAG,+CAAsB,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,mCAAgB,CAAC,cAAc,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,+CAAsB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7D,IACE,OAAO,CAAC,KAAK,KAAK,IAAI;YACtB,OAAO,KAAK,IAAI;YAChB,OAAO,IAAI,GAAG;YACd,GAAG,GAAG,OAAO,GAAG,mCAAgB,CAAC,cAAc;YAE/C,OAAO;QACT,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,mCAAgB,CAAC,SAAS,CAAC;QAChE,MAAM,cAAc,GAClB,OAAO,CAAC,cAAc,IAAI,mCAAgB,CAAC,gBAAgB,C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B,IAAI,CAAC;QACH,OAAO,GAAG,iBAAE,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,KAAK,mCAAgB,CAAC,cAAc;YACrE,SAAS;QACX,MAAM,IAAI,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAAE,SAAS;YAC9B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,sEAAsE;QACxE,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,+EAA+E;AAC/E,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,iBAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,OAAO,CAAC,iBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,gEAAgE;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version of this ttsc package, read from its own manifest once per
|
|
3
|
+
* process, or `"0.0.0"` when the manifest cannot be read or names none.
|
|
4
|
+
*
|
|
5
|
+
* WARNING (#1726): a reader that only needs ttsc's own version must take it
|
|
6
|
+
* here, never from `pluginBuildVersions`, which also resolves the project's
|
|
7
|
+
* `typescript` package. A plugin descriptor evaluator opens a record store
|
|
8
|
+
* while its module resolution recorder runs, and on a runtime whose
|
|
9
|
+
* `require.resolve` consults resolve hooks every such lookup became an input of
|
|
10
|
+
* the descriptor: absent `typescript` candidates below the cache root's
|
|
11
|
+
* ancestors, whose proofs the system temporary directory's metadata then
|
|
12
|
+
* withdrew. Reading a file here resolves no module.
|
|
13
|
+
*
|
|
14
|
+
* The host installation is assumed stable for the process lifetime; changing
|
|
15
|
+
* its manifest does not refresh the label.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/common.md#principled-implementation The label is this package's manifest version, the same value plugin keys and record identities have always named; an unreadable manifest yields the documented default instead of a guess.
|
|
18
|
+
* @evidence contracts/common.md#clear-and-simple-design One reader owns the host label; `pluginBuildVersions` composes it with the project's compiler version.
|
|
19
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The manifest beside the compiled module is read directly; no module resolution or fixture version stands in for it.
|
|
20
|
+
* @evidence contracts/common.md#meaningful-documentation The paragraphs state the value, the regression that motivates a resolution-free reader and the process-stable premise.
|
|
21
|
+
* @evidence contracts/portability.md#os-neutral-implementation The manifest path is joined with Node path APIs relative to this module, without separator or case assumptions.
|
|
22
|
+
* @evidence contracts/performance.md#efficient-algorithms The first call reads and parses one small manifest; later calls return the retained label.
|
|
23
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Every caller in the process shares one reading of an installation assumed stable for that process.
|
|
24
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources One label string is retained for the process lifetime; the synchronous read leaves no descriptor open.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ttscPackageVersion(): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ttscPackageVersion = ttscPackageVersion;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
/**
|
|
10
|
+
* The version of this ttsc package, read from its own manifest once per
|
|
11
|
+
* process, or `"0.0.0"` when the manifest cannot be read or names none.
|
|
12
|
+
*
|
|
13
|
+
* WARNING (#1726): a reader that only needs ttsc's own version must take it
|
|
14
|
+
* here, never from `pluginBuildVersions`, which also resolves the project's
|
|
15
|
+
* `typescript` package. A plugin descriptor evaluator opens a record store
|
|
16
|
+
* while its module resolution recorder runs, and on a runtime whose
|
|
17
|
+
* `require.resolve` consults resolve hooks every such lookup became an input of
|
|
18
|
+
* the descriptor: absent `typescript` candidates below the cache root's
|
|
19
|
+
* ancestors, whose proofs the system temporary directory's metadata then
|
|
20
|
+
* withdrew. Reading a file here resolves no module.
|
|
21
|
+
*
|
|
22
|
+
* The host installation is assumed stable for the process lifetime; changing
|
|
23
|
+
* its manifest does not refresh the label.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation The label is this package's manifest version, the same value plugin keys and record identities have always named; an unreadable manifest yields the documented default instead of a guess.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design One reader owns the host label; `pluginBuildVersions` composes it with the project's compiler version.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The manifest beside the compiled module is read directly; no module resolution or fixture version stands in for it.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation The paragraphs state the value, the regression that motivates a resolution-free reader and the process-stable premise.
|
|
29
|
+
* @evidence contracts/portability.md#os-neutral-implementation The manifest path is joined with Node path APIs relative to this module, without separator or case assumptions.
|
|
30
|
+
* @evidence contracts/performance.md#efficient-algorithms The first call reads and parses one small manifest; later calls return the retained label.
|
|
31
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Every caller in the process shares one reading of an installation assumed stable for that process.
|
|
32
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources One label string is retained for the process lifetime; the synchronous read leaves no descriptor open.
|
|
33
|
+
*/
|
|
34
|
+
function ttscPackageVersion() {
|
|
35
|
+
if (version !== undefined)
|
|
36
|
+
return version;
|
|
37
|
+
try {
|
|
38
|
+
const manifest = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.resolve(__dirname, "..", "..", "..", "..", "package.json"), "utf8"));
|
|
39
|
+
version = manifest.version ?? "0.0.0";
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
version = "0.0.0";
|
|
43
|
+
}
|
|
44
|
+
return version;
|
|
45
|
+
}
|
|
46
|
+
let version;
|
|
47
|
+
//# sourceMappingURL=ttscPackageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ttscPackageVersion.js","sourceRoot":"","sources":["../../../../src/plugin/internal/source/ttscPackageVersion.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,iBAAE,CAAC,YAAY,CACb,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAC/D,MAAM,CACP,CACsB,CAAC;QAC1B,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,OAAO,CAAC;IACpB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,IAAI,OAA2B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ITtscCapabilityResolutionEntry } from "./ITtscCapabilityResolutionEntry";
|
|
2
2
|
import type { ITtscCapabilityResolutionPlugin } from "./ITtscCapabilityResolutionPlugin";
|
|
3
|
+
import { PluginContentIdentities } from "./source/PluginContentIdentities";
|
|
3
4
|
/**
|
|
4
5
|
* Record the answer and the state it was true for.
|
|
5
6
|
*
|
|
@@ -53,6 +54,11 @@ export declare function writeCapabilityResolution(options: {
|
|
|
53
54
|
env?: NodeJS.ProcessEnv;
|
|
54
55
|
/** Pre-load authority key; a moved evaluation authority refuses the write. */
|
|
55
56
|
expectedAuthority?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Record store of the project's plugin cache, which proves the runtime and
|
|
59
|
+
* the plugin sources and SDK from metadata instead of their bytes (#1725).
|
|
60
|
+
*/
|
|
61
|
+
identities?: PluginContentIdentities.Store;
|
|
56
62
|
}, answer: {
|
|
57
63
|
/**
|
|
58
64
|
* The evaluation-time content hash or unavailable null state reported by
|
|
@@ -10,8 +10,8 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
10
10
|
const SidecarEnvironment_1 = require("../../compiler/internal/sharedHost/SidecarEnvironment");
|
|
11
11
|
const E2ETrace_1 = require("../../internal/E2ETrace");
|
|
12
12
|
const CapabilityResolutionFormat_1 = require("./CapabilityResolutionFormat");
|
|
13
|
+
const PluginContentIdentities_1 = require("./source/PluginContentIdentities");
|
|
13
14
|
const SourceBuildCacheLayout_1 = require("./source/SourceBuildCacheLayout");
|
|
14
|
-
const pluginSourceDigest_1 = require("./source/pluginSourceDigest");
|
|
15
15
|
const pluginSourceFilesSignature_1 = require("./source/pluginSourceFilesSignature");
|
|
16
16
|
const pluginSourceState_1 = require("./source/pluginSourceState");
|
|
17
17
|
/**
|
|
@@ -116,7 +116,7 @@ function writeCapabilityResolution(options, answer) {
|
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
const evidence =
|
|
119
|
+
const evidence = PluginContentIdentities_1.PluginContentIdentities.sourceEvidence(PluginContentIdentities_1.PluginContentIdentities.mintReference(node_path_1.default.dirname(file)));
|
|
120
120
|
const entry = {
|
|
121
121
|
hostInputHashes,
|
|
122
122
|
hostInputRealpaths,
|
|
@@ -124,7 +124,7 @@ function writeCapabilityResolution(options, answer) {
|
|
|
124
124
|
manifest: answer.manifest,
|
|
125
125
|
pluginSources: Object.fromEntries(Object.entries(answer.pluginSources).map(([directory, state]) => [
|
|
126
126
|
directory,
|
|
127
|
-
recordPluginSource(directory, state, evidence),
|
|
127
|
+
recordPluginSource(directory, state, evidence, node_path_1.default.resolve(options.cwd), options.identities),
|
|
128
128
|
])),
|
|
129
129
|
plugins: answer.plugins.map((plugin) => ({
|
|
130
130
|
binary: plugin.binary,
|
|
@@ -173,18 +173,22 @@ function writeCapabilityResolution(options, answer) {
|
|
|
173
173
|
* when both signatures agree, every stamp was separable from a reference minted
|
|
174
174
|
* before the read, and the digest gives the very state the load reported, so
|
|
175
175
|
* the entry never vouches for sources the binary was not built from. Anything
|
|
176
|
-
* else records the state alone, which a read proves in full.
|
|
176
|
+
* else records the state alone, which a read proves in full. The digest comes
|
|
177
|
+
* from the project's record store when its metadata still holds there, which
|
|
178
|
+
* places it inside the same two signatures, so a new process does not read
|
|
179
|
+
* every source byte again (#1725).
|
|
177
180
|
*/
|
|
178
|
-
function recordPluginSource(directory, state, evidence) {
|
|
181
|
+
function recordPluginSource(directory, state, evidence, projectRoot, identities) {
|
|
179
182
|
try {
|
|
180
183
|
const before = (0, pluginSourceFilesSignature_1.pluginSourceFilesSignature)(directory, evidence);
|
|
181
|
-
const digest = (
|
|
184
|
+
const digest = PluginContentIdentities_1.PluginContentIdentities.sourceDirectory(identities, directory);
|
|
182
185
|
const after = (0, pluginSourceFilesSignature_1.pluginSourceFilesSignature)(directory, evidence);
|
|
183
186
|
if (before !== undefined &&
|
|
184
187
|
after !== undefined &&
|
|
185
188
|
before.signature === after.signature &&
|
|
186
189
|
after.separable &&
|
|
187
|
-
(0, pluginSourceState_1.pluginSourceState)(directory, { sourceDigest: digest }) ===
|
|
190
|
+
(0, pluginSourceState_1.pluginSourceState)(directory, { projectRoot, sourceDigest: digest }) ===
|
|
191
|
+
state) {
|
|
188
192
|
return { digest, signature: after.signature, state };
|
|
189
193
|
}
|
|
190
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeCapabilityResolution.js","sourceRoot":"","sources":["../../../src/plugin/internal/writeCapabilityResolution.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAE7B,8FAA2F;AAC3F,sDAAmD;AACnD,6EAA0E;AAI1E,4EAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"writeCapabilityResolution.js","sourceRoot":"","sources":["../../../src/plugin/internal/writeCapabilityResolution.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAE7B,8FAA2F;AAC3F,sDAAmD;AACnD,6EAA0E;AAI1E,8EAA2E;AAC3E,4EAAyE;AACzE,oFAAiF;AACjF,kEAA+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,mCACE,OAqBC,EACD,MA8BC;IAED,IAAI,IAAI,GAAG,uDAA0B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,mBAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE;YAC7C,MAAM,EAAE,+BAA+B;SACxC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,OAAO,CAAC,iBAAiB,KAAK,SAAS;QACvC,OAAO,CAAC,iBAAiB,KAAK,IAAI,EAClC,CAAC;QACD,mBAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE;YAC7C,IAAI;YACJ,MAAM,EAAE,mBAAmB;SAC5B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IAC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AAkB,CACzB,SAAiB,EACjB,KAAa,EACb,QAAmE,EACnE,WAAmB,EACnB,UAAqD;IAErD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,uDAA0B,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,iDAAuB,CAAC,eAAe,CACpD,UAAU,EACV,SAAS,CACV,CAAC;QACF,MAAM,KAAK,GAAG,IAAA,uDAA0B,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9D,IACE,MAAM,KAAK,SAAS;YACpB,KAAK,KAAK,SAAS;YACnB,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;YACpC,KAAK,CAAC,SAAS;YACf,IAAA,qCAAiB,EAAC,SAAS,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;gBACjE,KAAK,EACP,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;QACvD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,wEAAwE;IAC1E,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,kCAAyC,OAIxC;IACC,OAAO,CAAC,GAAG,iCAAiC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,2CAAkD,OASjD;IACC,MAAM,GAAG,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,C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,GAAG;wBACH,QAAQ;wBACR,UAAU,EAAE,UAAU,EAAE;qBACzB,CAAC,KAAK,SAAS;oBAEhB,OAAO,KAAK,CAAC;gBACf,MAAM,OAAO,GAAG,IAAA,mDAAwB,EAAC;oBACvC,GAAG;oBACH,QAAQ;oBACR,OAAO;oBACP,UAAU,EAAE,UAAU,EAAE;iBACzB,CAAC,CAAC;gBACH,OAAO,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC;YAC/D,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,EAAE,+CAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC;QACzD,MAAM,EAAE,UAAU;KACnB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE;IAC5B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,iBAAE,CAAC,YAAY,CACb,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EACnD,MAAM,CACP,CACuB,CAAC;QAC3B,OAAO,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ttsc",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.2",
|
|
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-x64": "0.31.
|
|
65
|
-
"@ttsc/
|
|
66
|
-
"@ttsc/linux-arm64": "0.31.
|
|
67
|
-
"@ttsc/
|
|
68
|
-
"@ttsc/
|
|
69
|
-
"@ttsc/
|
|
70
|
-
"@ttsc/
|
|
64
|
+
"@ttsc/linux-x64": "0.31.2",
|
|
65
|
+
"@ttsc/darwin-x64": "0.31.2",
|
|
66
|
+
"@ttsc/linux-arm64": "0.31.2",
|
|
67
|
+
"@ttsc/win32-x64": "0.31.2",
|
|
68
|
+
"@ttsc/win32-arm64": "0.31.2",
|
|
69
|
+
"@ttsc/darwin-arm64": "0.31.2",
|
|
70
|
+
"@ttsc/linux-arm": "0.31.2"
|
|
71
71
|
},
|
|
72
72
|
"sideEffects": [
|
|
73
73
|
"./lib/register.js",
|
|
@@ -5,6 +5,7 @@ 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";
|
|
@@ -70,19 +71,37 @@ export namespace BuildExecution {
|
|
|
70
71
|
* Merge extra environment variables over `process.env`, always injecting
|
|
71
72
|
* `TTSC_NODE_BINARY` selected by the runtime capability owner. Explicit
|
|
72
73
|
* compatible overrides can select a different Node executable; this is not
|
|
73
|
-
* necessarily the current process binary.
|
|
74
|
+
* necessarily the current process binary. An invocation that loaded plugins
|
|
75
|
+
* passes its record store, so the runtime is proven from metadata instead of
|
|
76
|
+
* streamed again before every native spawn (#1723).
|
|
74
77
|
*/
|
|
75
78
|
function mergeEnv(
|
|
76
|
-
extra
|
|
77
|
-
cwd: string
|
|
79
|
+
extra: NodeJS.ProcessEnv | undefined,
|
|
80
|
+
cwd: string,
|
|
81
|
+
identities: PluginContentIdentities.Store | undefined,
|
|
78
82
|
...later: readonly (NodeJS.ProcessEnv | undefined)[]
|
|
79
83
|
): NodeJS.ProcessEnv {
|
|
80
84
|
const env = SidecarEnvironment.merge(process.env, extra, ...later);
|
|
81
|
-
const node = resolveNodeBinary(env, cwd);
|
|
85
|
+
const node = resolveNodeBinary(env, cwd, identities);
|
|
82
86
|
SidecarEnvironment.write(env, "TTSC_NODE_BINARY", node);
|
|
83
87
|
return env;
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Merge extra environment variables over `process.env` for a spawn of the
|
|
92
|
+
* selected TypeScript-Go compiler itself.
|
|
93
|
+
*
|
|
94
|
+
* WARNING (#1726): the compiler never reads `TTSC_NODE_BINARY`, which only
|
|
95
|
+
* plugin sidecars consume (`mergeEnv`). Selecting it streamed the 85 MB Node
|
|
96
|
+
* executable twice and probed it on every launch, plugins or not, about 0.2 s
|
|
97
|
+
* of a 0.5 s build without plugins.
|
|
98
|
+
*/
|
|
99
|
+
function compilerEnv(
|
|
100
|
+
extra: NodeJS.ProcessEnv | undefined,
|
|
101
|
+
): NodeJS.ProcessEnv {
|
|
102
|
+
return SidecarEnvironment.merge(process.env, extra);
|
|
103
|
+
}
|
|
104
|
+
|
|
86
105
|
/**
|
|
87
106
|
* Build the environment for a native plugin spawn. Injects `TTSC_TSGO_BINARY`
|
|
88
107
|
* and `TTSC_TTSX_BINARY` alongside the base env from `mergeEnv`, plus
|
|
@@ -123,6 +142,7 @@ export namespace BuildExecution {
|
|
|
123
142
|
path.join(__dirname, "..", "..", "..", "launcher", "ttsx.js"),
|
|
124
143
|
},
|
|
125
144
|
execution.projectRoot,
|
|
145
|
+
execution.identities,
|
|
126
146
|
extra,
|
|
127
147
|
// The invocation's resolved compiler owns the final environment layer.
|
|
128
148
|
{ TTSC_TSGO_BINARY: execution.tsgo.binary },
|
|
@@ -453,7 +473,7 @@ export namespace BuildExecution {
|
|
|
453
473
|
* @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
474
|
* @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
475
|
* @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
|
|
476
|
+
* @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
477
|
*
|
|
458
478
|
* @evidenceExclude contracts/performance.md#reuse-equivalent-work A project probe and effectful terminal invocation establish no retained or shared cross-request result.
|
|
459
479
|
*
|
|
@@ -482,7 +502,7 @@ export namespace BuildExecution {
|
|
|
482
502
|
const tsgo = resolveTsgo({ ...options, cwd });
|
|
483
503
|
const res = spawnNative(tsgo.binary, [...(options.passthrough ?? [])], {
|
|
484
504
|
cwd,
|
|
485
|
-
env:
|
|
505
|
+
env: compilerEnv(options.env),
|
|
486
506
|
encoding: "utf8",
|
|
487
507
|
});
|
|
488
508
|
if (res.error) {
|
|
@@ -796,7 +816,7 @@ export namespace BuildExecution {
|
|
|
796
816
|
* @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
817
|
* @evidence contracts/common.md#meaningful-documentation Native prose explains the no-emit use and load-bearing argument precedence.
|
|
798
818
|
* @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
|
|
819
|
+
* @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
820
|
*
|
|
801
821
|
* @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
822
|
*
|
|
@@ -822,7 +842,7 @@ export namespace BuildExecution {
|
|
|
822
842
|
],
|
|
823
843
|
{
|
|
824
844
|
cwd: execution.compilerSelection.compilerArgsCwd,
|
|
825
|
-
env:
|
|
845
|
+
env: compilerEnv(options.env),
|
|
826
846
|
encoding: "utf8",
|
|
827
847
|
},
|
|
828
848
|
);
|
|
@@ -856,7 +876,7 @@ export namespace BuildExecution {
|
|
|
856
876
|
options: RunBuildOptions,
|
|
857
877
|
args: readonly string[],
|
|
858
878
|
): TtscBuildResult {
|
|
859
|
-
const env =
|
|
879
|
+
const env = compilerEnv(options.env);
|
|
860
880
|
const userOptions = readEffectiveCompilerOptions(
|
|
861
881
|
execution.project,
|
|
862
882
|
options.passthrough,
|
|
@@ -1183,19 +1203,31 @@ export namespace BuildExecution {
|
|
|
1183
1203
|
const tsgo = resolveTsgo({ ...options, cwd: projectRoot });
|
|
1184
1204
|
let pluginSetupFailure: TtscBuildResult | undefined;
|
|
1185
1205
|
let nativePlugins: ITtscLoadedNativePlugin[] = [];
|
|
1206
|
+
// Opened only for an invocation that loads plugins, so a project without
|
|
1207
|
+
// any never gains a cache directory; the load and every later native spawn
|
|
1208
|
+
// of this invocation prove their unchanged inputs through it (#1722, #1723).
|
|
1209
|
+
let identities: PluginContentIdentities.Store | undefined;
|
|
1186
1210
|
try {
|
|
1187
1211
|
if (
|
|
1188
1212
|
compilerSelection.inspectionError === undefined &&
|
|
1189
1213
|
hasProjectPluginEntries(project, options.plugins)
|
|
1190
1214
|
) {
|
|
1215
|
+
const cacheDir =
|
|
1216
|
+
options.cacheDir ??
|
|
1217
|
+
SidecarEnvironment.read(options.env, "TTSC_CACHE_DIR");
|
|
1218
|
+
const env = inheritedSidecarEnv(options.env, options.binary);
|
|
1219
|
+
identities = PluginContentIdentities.open({
|
|
1220
|
+
projectRoot,
|
|
1221
|
+
cacheDir,
|
|
1222
|
+
env,
|
|
1223
|
+
});
|
|
1191
1224
|
nativePlugins = loadProjectPlugins({
|
|
1192
1225
|
binary: resolveBinary(options) ?? "",
|
|
1193
|
-
cacheDir
|
|
1194
|
-
options.cacheDir ??
|
|
1195
|
-
SidecarEnvironment.read(options.env, "TTSC_CACHE_DIR"),
|
|
1226
|
+
cacheDir,
|
|
1196
1227
|
cwd,
|
|
1197
1228
|
entries: options.plugins,
|
|
1198
|
-
env
|
|
1229
|
+
env,
|
|
1230
|
+
identities,
|
|
1199
1231
|
onWatchInputs: options.onWatchInputs,
|
|
1200
1232
|
pluginConfigDir: options.pluginConfigDir,
|
|
1201
1233
|
projectRoot,
|
|
@@ -1215,6 +1247,7 @@ export namespace BuildExecution {
|
|
|
1215
1247
|
return {
|
|
1216
1248
|
compilerSelection,
|
|
1217
1249
|
cwd,
|
|
1250
|
+
...(identities === undefined ? {} : { identities }),
|
|
1218
1251
|
nativePlugins,
|
|
1219
1252
|
pluginConfigDir: resolvePluginConfigDir({
|
|
1220
1253
|
cwd,
|