ttsc 0.34.2 → 0.35.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/driver/compileraliases/names.go +69 -0
- package/driver/compileraliases/names_test.go +57 -0
- package/lib/compiler/internal/build/BuildExecution.d.ts +26 -0
- package/lib/compiler/internal/build/BuildExecution.js +13 -3
- package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
- package/lib/compiler/internal/build/RunBuildOptions.d.ts +2 -0
- package/lib/compiler/internal/build/RuntimeBuildCache.d.ts +47 -0
- package/lib/compiler/internal/build/RuntimeBuildCache.js +235 -0
- package/lib/compiler/internal/build/RuntimeBuildCache.js.map +1 -0
- package/lib/compiler/internal/build/RuntimeBuildInputs.d.ts +44 -0
- package/lib/compiler/internal/build/RuntimeBuildInputs.js +282 -0
- package/lib/compiler/internal/build/RuntimeBuildInputs.js.map +1 -0
- package/lib/compiler/internal/build/RuntimeInputProof.d.ts +50 -0
- package/lib/compiler/internal/build/RuntimeInputProof.js +315 -0
- package/lib/compiler/internal/build/RuntimeInputProof.js.map +1 -0
- package/lib/compiler/internal/build/TsgoArguments.d.ts +5 -4
- package/lib/compiler/internal/build/TsgoArguments.js +11 -5
- package/lib/compiler/internal/build/TsgoArguments.js.map +1 -1
- package/lib/compiler/internal/build/runBuild.d.ts +3 -3
- package/lib/compiler/internal/build/runBuild.js +17 -4
- package/lib/compiler/internal/build/runBuild.js.map +1 -1
- package/lib/compiler/internal/resolveNativeTypeScriptPackage.d.ts +27 -0
- package/lib/compiler/internal/resolveNativeTypeScriptPackage.js +103 -0
- package/lib/compiler/internal/resolveNativeTypeScriptPackage.js.map +1 -0
- package/lib/compiler/internal/resolveTsgo.d.ts +7 -6
- package/lib/compiler/internal/resolveTsgo.js +16 -35
- package/lib/compiler/internal/resolveTsgo.js.map +1 -1
- package/lib/compiler/internal/runNativeCheckWithObservations.d.ts +18 -14
- package/lib/compiler/internal/runNativeCheckWithObservations.js +42 -18
- package/lib/compiler/internal/runNativeCheckWithObservations.js.map +1 -1
- package/lib/flags/FLAG_SCHEMA.js +7 -0
- package/lib/flags/FLAG_SCHEMA.js.map +1 -1
- package/lib/internal/nativeBinary.d.ts +4 -0
- package/lib/internal/nativeBinary.js +6 -1
- package/lib/internal/nativeBinary.js.map +1 -1
- package/lib/launcher/internal/parseTtsxCLI.d.ts +1 -0
- package/lib/launcher/internal/parseTtsxCLI.js +1 -0
- package/lib/launcher/internal/parseTtsxCLI.js.map +1 -1
- package/lib/launcher/internal/prepareExecution.d.ts +2 -0
- package/lib/launcher/internal/prepareExecution.js +11 -2
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +5 -0
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtime/installRuntimeHooks.js +7 -0
- package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +1 -0
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/source/SourceBuildCacheLayout.d.ts +2 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js +3 -0
- package/lib/plugin/internal/source/SourceBuildCacheLayout.js.map +1 -1
- package/lib/plugin/internal/source/pluginBuildVersions.d.ts +8 -7
- package/lib/plugin/internal/source/pluginBuildVersions.js +13 -13
- package/lib/plugin/internal/source/pluginBuildVersions.js.map +1 -1
- package/lib/structures/ITtscPluginCapabilities.d.ts +13 -2
- package/package.json +9 -9
- package/src/compiler/internal/build/BuildExecution.ts +32 -16
- package/src/compiler/internal/build/RunBuildOptions.ts +3 -0
- package/src/compiler/internal/build/RuntimeBuildCache.ts +252 -0
- package/src/compiler/internal/build/RuntimeBuildInputs.ts +349 -0
- package/src/compiler/internal/build/RuntimeInputProof.ts +346 -0
- package/src/compiler/internal/build/TsgoArguments.ts +11 -5
- package/src/compiler/internal/build/runBuild.ts +20 -5
- package/src/compiler/internal/resolveNativeTypeScriptPackage.ts +110 -0
- package/src/compiler/internal/resolveTsgo.ts +17 -36
- package/src/compiler/internal/runNativeCheckWithObservations.ts +41 -18
- package/src/flags/FLAG_SCHEMA.ts +7 -0
- package/src/internal/nativeBinary.ts +4 -0
- package/src/launcher/internal/parseTtsxCLI.ts +1 -0
- package/src/launcher/internal/prepareExecution.ts +20 -2
- package/src/launcher/internal/runTtsx.ts +5 -0
- package/src/launcher/internal/runtime/installRuntimeHooks.ts +11 -0
- package/src/plugin/internal/load/loadProjectPlugins.ts +1 -0
- package/src/plugin/internal/source/SourceBuildCacheLayout.ts +4 -0
- package/src/plugin/internal/source/pluginBuildVersions.ts +13 -15
- package/src/structures/ITtscPluginCapabilities.ts +14 -2
- package/utility/host.go +22 -1
|
@@ -0,0 +1,315 @@
|
|
|
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.RuntimeInputProof = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
/**
|
|
11
|
+
* Replay the compiler and native input witnesses of a completed runtime build.
|
|
12
|
+
* Read predicates keep their original text or raw-byte codec; absence, entry
|
|
13
|
+
* kind, physical target and directory membership remain independent predicates.
|
|
14
|
+
* Failed or unsupported observations withhold reuse.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Replay compares generation witnesses with current existence, stat, decoded text, physical identity and directory membership. Native version-one file, optional-file, entry and directory codecs use explicit tags, raw file/link bytes and sorted nul-delimited records. Compiler text strips UTF-8 BOM or decodes even UTF-16LE/BE bytes before SHA-256; host directory presence uses its separate domain marker.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One namespace separates result admission, declared host inputs, compiler predicates and the native version-one codec. Private physical/absence and SHA-256 helpers serve the codecs without merging their meanings.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Unknown codecs, failed reads and producer proof failures decline admission. Only ENOENT/ENOTDIR prove absence; other physical-resolution errors remain unavailable. Following stat classifies compiler views while lstat retains native link kinds; only the producer private output subtree is excluded.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies generation proof, codec ownership and refusal semantics; private helper comments identify query, byte, decoded-text and null/error boundaries.
|
|
20
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native stat, lstat and realpath retain actual kinds, targets and spellings without case assumptions. POSIX directory names/link targets stay raw bytes, Windows names follow the producer UTF-8 codec, and compiler directory entries sort by UTF-8 bytes.
|
|
21
|
+
* @evidence contracts/performance.md#efficient-algorithms Replay visits recorded predicates and their bytes or immediate directory entries rather than unrelated trees. Hashing and BOM decoding cost O(bytes), including a big-endian copy; directory codecs cost O(N log N) sorting plus encoded bytes and link queries. Physical resolution follows native path/link traversal.
|
|
22
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Every retained predicate is observed anew to authorize completed-result reuse. Host capture and admission share the producer codec; no path memo, watcher silence or historical hash independently grants authority.
|
|
23
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Read buffers, decoded text, paths and sorted directory members are call-local and have no proof-reader byte or entry cap. Synchronous calls retain no handle, watcher, process or historical population; only returned proof values escape.
|
|
24
|
+
*/
|
|
25
|
+
var RuntimeInputProof;
|
|
26
|
+
(function (RuntimeInputProof) {
|
|
27
|
+
/**
|
|
28
|
+
* Validate result-level host witnesses and every reported compiler predicate.
|
|
29
|
+
* The caller independently proves the selected compiler, project membership
|
|
30
|
+
* and plugin selection; an absent graph alone grants no completeness.
|
|
31
|
+
*
|
|
32
|
+
* @evidence contracts/common.md#principled-implementation Explicit incomplete observations and any graph failure reject reuse; host paths require both content and physical witnesses, and rich compiler predicates are replayed under their own codec.
|
|
33
|
+
* @evidence contracts/common.md#clear-and-simple-design One admission pass delegates individual compiler observations and native codecs.
|
|
34
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing witness fields never become an empty successful observation, and only the caller-owned private output subtree is excluded.
|
|
35
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies result admission and the caller's separate completeness obligations.
|
|
36
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native path resolution anchors producer-relative graph keys, and current physical paths come from native realpath.
|
|
37
|
+
* @evidence contracts/performance.md#efficient-algorithms Input and predicate populations drive replay; each read hashes its actual bytes and directories sort immediate entry records.
|
|
38
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Generation witnesses, rather than an identity-key match, decide whether a completed build remains reusable.
|
|
39
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Temporary path and predicate records are invocation-owned without retained handles or history.
|
|
40
|
+
*/
|
|
41
|
+
function holds(result, projectRoot, emitDir) {
|
|
42
|
+
if (result.observationsComplete === false ||
|
|
43
|
+
Object.keys(result.graph?.inputProofFailures ?? {}).length !== 0)
|
|
44
|
+
return false;
|
|
45
|
+
try {
|
|
46
|
+
for (const file of result.hostInputs ?? []) {
|
|
47
|
+
const [currentPhysical, hash] = observeHostInput(file);
|
|
48
|
+
if (!Object.hasOwn(result.hostInputHashes ?? {}, file) ||
|
|
49
|
+
!Object.hasOwn(result.hostInputRealpaths ?? {}, file) ||
|
|
50
|
+
currentPhysical !== result.hostInputRealpaths[file] ||
|
|
51
|
+
hash !== result.hostInputHashes[file])
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const graph = result.graph;
|
|
55
|
+
for (const [name, observed] of Object.entries(graph?.inputObservations ?? {})) {
|
|
56
|
+
const file = node_path_1.default.resolve(projectRoot, name);
|
|
57
|
+
const relative = node_path_1.default.relative(emitDir, file);
|
|
58
|
+
if (relative === "" ||
|
|
59
|
+
(!node_path_1.default.isAbsolute(relative) &&
|
|
60
|
+
relative !== ".." &&
|
|
61
|
+
!relative.startsWith(".." + node_path_1.default.sep)))
|
|
62
|
+
continue;
|
|
63
|
+
if (!observationHolds(file, observed))
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
for (const [name, expected] of Object.entries(graph?.inputHashes ?? {})) {
|
|
67
|
+
if (Object.hasOwn(graph?.inputObservations ?? {}, name))
|
|
68
|
+
continue;
|
|
69
|
+
const file = node_path_1.default.resolve(projectRoot, name);
|
|
70
|
+
if (physical(file) !== graph?.inputRealpaths?.[name])
|
|
71
|
+
return false;
|
|
72
|
+
let current = null;
|
|
73
|
+
try {
|
|
74
|
+
if (node_fs_1.default.statSync(file).isFile())
|
|
75
|
+
current = textHash(node_fs_1.default.readFileSync(file));
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (!missing(error))
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (current !== expected)
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
RuntimeInputProof.holds = holds;
|
|
91
|
+
/**
|
|
92
|
+
* Observe a declared host input under its existing raw-file or directory-kind
|
|
93
|
+
* codec. Descriptor resolution can declare directories as presence inputs;
|
|
94
|
+
* those are distinct from compiler source reads and directory enumeration.
|
|
95
|
+
* Native identity and metadata bracket the observation. Missing paths carry
|
|
96
|
+
* null witnesses, while unavailable or changing observations throw.
|
|
97
|
+
*
|
|
98
|
+
* @evidence contracts/common.md#principled-implementation Raw file bytes and the existing ttsc:host-input:directory domain marker reproduce the descriptor/native host-input contract, with physical identity and full native metadata checked before and after.
|
|
99
|
+
* @evidence contracts/common.md#clear-and-simple-design One observer supplies the same declared-host codec to input capture and retained-result admission, independently of compiler text and enumeration predicates.
|
|
100
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only ENOENT/ENOTDIR establish absence; unsupported entry kinds, read failures and changing witnesses refuse reuse instead of becoming empty content.
|
|
101
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes directory presence from directory membership, states the producer codec and explains failure semantics.
|
|
102
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native following stat, realpath and byte reads retain actual host links and physical spellings without OS-name or separator guesses.
|
|
103
|
+
* @evidence contracts/performance.md#efficient-algorithms File observations hash their complete byte buffer and bracket native metadata; directory presence hashes a fixed marker without scanning members.
|
|
104
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Capture and admission share the producer's codec, but every invocation observes current witnesses and retains no path-only truth.
|
|
105
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Read buffers and stat records are call-local; synchronous filesystem calls leave no retained handle or watcher.
|
|
106
|
+
*/
|
|
107
|
+
function observeHostInput(file) {
|
|
108
|
+
const beforePhysical = physical(file);
|
|
109
|
+
let before;
|
|
110
|
+
try {
|
|
111
|
+
before = node_fs_1.default.statSync(file, { bigint: true });
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (!missing(error))
|
|
115
|
+
throw error;
|
|
116
|
+
if (beforePhysical !== null || physical(file) !== null)
|
|
117
|
+
throw new Error("Host input changed during absence observation.");
|
|
118
|
+
return [null, null];
|
|
119
|
+
}
|
|
120
|
+
if (!before.isFile() && !before.isDirectory())
|
|
121
|
+
throw new Error("Unsupported runtime host input kind.");
|
|
122
|
+
const hash = before.isDirectory()
|
|
123
|
+
? digest("ttsc:host-input:directory\0")
|
|
124
|
+
: digest(node_fs_1.default.readFileSync(file));
|
|
125
|
+
const after = node_fs_1.default.statSync(file, { bigint: true });
|
|
126
|
+
const signature = (stat) => [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
|
|
127
|
+
if (signature(before) !== signature(after) ||
|
|
128
|
+
beforePhysical !== physical(file))
|
|
129
|
+
throw new Error("Host input changed during observation.");
|
|
130
|
+
return [beforePhysical, hash];
|
|
131
|
+
}
|
|
132
|
+
RuntimeInputProof.observeHostInput = observeHostInput;
|
|
133
|
+
/** Compare one compiler query record with the corresponding current queries. */
|
|
134
|
+
function observationHolds(file, observed) {
|
|
135
|
+
for (const predicate of observed.nativePredicates ?? [])
|
|
136
|
+
if (predicate.version !== 1 ||
|
|
137
|
+
!predicate.identityStable ||
|
|
138
|
+
physical(file) !== predicate.realpath ||
|
|
139
|
+
nativeDigest(file, predicate.kind) !== predicate.digest)
|
|
140
|
+
return false;
|
|
141
|
+
let kind = "missing";
|
|
142
|
+
try {
|
|
143
|
+
const stat = node_fs_1.default.statSync(file);
|
|
144
|
+
kind = stat.isDirectory() ? "directory" : "file";
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (!missing(error))
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (observed.fileExists !== undefined &&
|
|
151
|
+
observed.fileExists !== (kind === "file"))
|
|
152
|
+
return false;
|
|
153
|
+
if (observed.directoryExists !== undefined &&
|
|
154
|
+
observed.directoryExists !== (kind === "directory"))
|
|
155
|
+
return false;
|
|
156
|
+
if (observed.stat !== undefined && observed.stat !== kind)
|
|
157
|
+
return false;
|
|
158
|
+
if (observed.readFile !== undefined) {
|
|
159
|
+
let hash = null;
|
|
160
|
+
try {
|
|
161
|
+
if (kind !== "directory")
|
|
162
|
+
hash = textHash(node_fs_1.default.readFileSync(file));
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
/* Compiler read failed. */
|
|
166
|
+
}
|
|
167
|
+
if (observed.readFile.ok ? hash !== observed.readFile.hash : hash !== null)
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (observed.realpath !== undefined) {
|
|
171
|
+
const current = physical(file);
|
|
172
|
+
if (observed.realpath.ok
|
|
173
|
+
? current !== observed.realpath.path
|
|
174
|
+
: current !== null)
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (observed.accessibleEntries !== undefined) {
|
|
178
|
+
const directories = [];
|
|
179
|
+
const files = [];
|
|
180
|
+
let entries = [];
|
|
181
|
+
try {
|
|
182
|
+
entries = node_fs_1.default.readdirSync(file, { withFileTypes: true });
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
/* Compiler enumeration returns an empty view. */
|
|
186
|
+
}
|
|
187
|
+
for (const entry of entries) {
|
|
188
|
+
try {
|
|
189
|
+
const stat = entry.isSymbolicLink()
|
|
190
|
+
? node_fs_1.default.statSync(node_path_1.default.join(file, entry.name))
|
|
191
|
+
: entry;
|
|
192
|
+
if (stat.isDirectory())
|
|
193
|
+
directories.push(entry.name);
|
|
194
|
+
else if (stat.isFile())
|
|
195
|
+
files.push(entry.name);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
/* Compiler enumeration omits inaccessible link targets. */
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const compare = (a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b));
|
|
202
|
+
if (JSON.stringify({
|
|
203
|
+
directories: directories.sort(compare),
|
|
204
|
+
files: files.sort(compare),
|
|
205
|
+
}) !== JSON.stringify(observed.accessibleEntries))
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Reproduce native version-one file, optional-file, entry and directory
|
|
212
|
+
* bytes.
|
|
213
|
+
*/
|
|
214
|
+
function nativeDigest(file, kind) {
|
|
215
|
+
if (kind === "file")
|
|
216
|
+
return digest(node_fs_1.default.readFileSync(file));
|
|
217
|
+
if (kind === "optional-file") {
|
|
218
|
+
try {
|
|
219
|
+
return node_fs_1.default.statSync(file).isFile()
|
|
220
|
+
? digest(Buffer.concat([Buffer.from("file\0"), node_fs_1.default.readFileSync(file)]))
|
|
221
|
+
: digest("missing\0");
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
if (missing(error))
|
|
225
|
+
return digest("missing\0");
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (kind === "entry") {
|
|
230
|
+
try {
|
|
231
|
+
const entry = node_fs_1.default.lstatSync(file);
|
|
232
|
+
return entry.isSymbolicLink()
|
|
233
|
+
? digest(Buffer.concat([
|
|
234
|
+
Buffer.from("symlink\0"),
|
|
235
|
+
node_fs_1.default.readlinkSync(file, { encoding: "buffer" }),
|
|
236
|
+
]))
|
|
237
|
+
: digest((entry.isDirectory()
|
|
238
|
+
? "directory"
|
|
239
|
+
: entry.isFile()
|
|
240
|
+
? "file"
|
|
241
|
+
: "other") + "\0");
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
if (missing(error))
|
|
245
|
+
return digest("missing\0");
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (kind !== "directory")
|
|
250
|
+
throw new Error("unsupported native input codec");
|
|
251
|
+
const records = [];
|
|
252
|
+
const names = process.platform === "win32"
|
|
253
|
+
? node_fs_1.default.readdirSync(file).map((name) => Buffer.from(name))
|
|
254
|
+
: node_fs_1.default.readdirSync(file, { encoding: "buffer" });
|
|
255
|
+
for (const name of names) {
|
|
256
|
+
const target = process.platform === "win32"
|
|
257
|
+
? node_path_1.default.join(file, name.toString())
|
|
258
|
+
: Buffer.concat([Buffer.from(file + node_path_1.default.sep), name]);
|
|
259
|
+
const entry = node_fs_1.default.lstatSync(target);
|
|
260
|
+
const entryKind = entry.isDirectory()
|
|
261
|
+
? "directory"
|
|
262
|
+
: entry.isFile()
|
|
263
|
+
? "file"
|
|
264
|
+
: entry.isSymbolicLink()
|
|
265
|
+
? "symlink"
|
|
266
|
+
: "other";
|
|
267
|
+
const link = entry.isSymbolicLink()
|
|
268
|
+
? node_fs_1.default.readlinkSync(target, { encoding: "buffer" })
|
|
269
|
+
: Buffer.alloc(0);
|
|
270
|
+
records.push(Buffer.concat([name, Buffer.from("\0" + entryKind + "\0"), link]));
|
|
271
|
+
}
|
|
272
|
+
records.sort(Buffer.compare);
|
|
273
|
+
return digest(Buffer.concat(records.flatMap((record, index) => index === 0 ? [record] : [Buffer.from([0]), record])));
|
|
274
|
+
}
|
|
275
|
+
/** Hash compiler-decoded text, retaining the BOM and UTF-16 producer policy. */
|
|
276
|
+
function textHash(bytes) {
|
|
277
|
+
if (bytes.length >= 2 &&
|
|
278
|
+
((bytes[0] === 0xff && bytes[1] === 0xfe) ||
|
|
279
|
+
(bytes[0] === 0xfe && bytes[1] === 0xff))) {
|
|
280
|
+
const text = Buffer.from(bytes.subarray(2, 2 + Math.floor((bytes.length - 2) / 2) * 2));
|
|
281
|
+
if (bytes[0] === 0xfe)
|
|
282
|
+
text.swap16();
|
|
283
|
+
return digest(Buffer.from(text.toString("utf16le"), "utf8"));
|
|
284
|
+
}
|
|
285
|
+
return digest(bytes.length >= 3 &&
|
|
286
|
+
bytes[0] === 0xef &&
|
|
287
|
+
bytes[1] === 0xbb &&
|
|
288
|
+
bytes[2] === 0xbf
|
|
289
|
+
? bytes.subarray(3)
|
|
290
|
+
: bytes);
|
|
291
|
+
}
|
|
292
|
+
/** Obtain a current physical coordinate, with null only for native absence. */
|
|
293
|
+
function physical(file) {
|
|
294
|
+
try {
|
|
295
|
+
return node_fs_1.default.realpathSync.native(file);
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
if (missing(error))
|
|
299
|
+
return null;
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/** Classify only native absent-path errors. */
|
|
304
|
+
function missing(error) {
|
|
305
|
+
return (typeof error === "object" &&
|
|
306
|
+
error !== null &&
|
|
307
|
+
"code" in error &&
|
|
308
|
+
(error.code === "ENOENT" || error.code === "ENOTDIR"));
|
|
309
|
+
}
|
|
310
|
+
/** SHA-256 of supplied text or raw bytes. */
|
|
311
|
+
function digest(bytes) {
|
|
312
|
+
return node_crypto_1.default.createHash("sha256").update(bytes).digest("hex");
|
|
313
|
+
}
|
|
314
|
+
})(RuntimeInputProof || (exports.RuntimeInputProof = RuntimeInputProof = {}));
|
|
315
|
+
//# sourceMappingURL=RuntimeInputProof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeInputProof.js","sourceRoot":"","sources":["../../../../src/compiler/internal/build/RuntimeInputProof.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAK7B;;;;;;;;;;;;;;GAcG;AACH,IAAiB,iBAAiB,CAmUjC;AAnUD,WAAiB,iBAAiB;IAChC;;;;;;;;;;;;;OAaG;IACH,SAAgB,KAAK,CACnB,MAAuB,EACvB,WAAmB,EACnB,OAAe;QAEf,IACE,MAAM,CAAC,oBAAoB,KAAK,KAAK;YACrC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;YAEhE,OAAO,KAAK,CAAC;QACf,IAAI,CAAC;YACH,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;gBAC3C,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACvD,IACE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC;oBAClD,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,EAAE,IAAI,CAAC;oBACrD,eAAe,KAAK,MAAM,CAAC,kBAAmB,CAAC,IAAI,CAAC;oBACpD,IAAI,KAAK,MAAM,CAAC,eAAgB,CAAC,IAAI,CAAC;oBAEtC,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAC3B,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAC3C,KAAK,EAAE,iBAAiB,IAAI,EAAE,CA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The forwarded-tsgo payload for a native `build`/`check` emit invocation.
|
|
90
90
|
*
|
|
91
|
-
* The sidecar builds its Program in-process, so
|
|
92
|
-
* travel the same channel
|
|
93
|
-
* set does not declare `--rootDir`, and `filterHostArgs` would
|
|
91
|
+
* The sidecar builds its Program in-process, so runtime source-map defaults
|
|
92
|
+
* and the pinned `rootDir` travel the same channel as other tsgo options —
|
|
93
|
+
* the host flag set does not declare `--rootDir`, and `filterHostArgs` would
|
|
94
|
+
* strip it.
|
|
94
95
|
*
|
|
95
|
-
* @evidence contracts/common.md#principled-implementation The same private layout root used by direct builds
|
|
96
|
+
* @evidence contracts/common.md#principled-implementation The same private layout root and forced runtime source-map default used by direct builds precede user arguments in the sidecar compiler-option channel, preserving explicit overrides and declared/composite containment without a new host flag.
|
|
96
97
|
* @evidence contracts/common.md#clear-and-simple-design Root pinning stays in one helper and general payload ordering/serialization stays in createNativeTsgoArgs.
|
|
97
98
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The supported environment payload carries compiler options instead of injecting unknown flags into strict foreign host parsers.
|
|
98
99
|
* @evidence contracts/common.md#meaningful-documentation Native prose explains why rootDir travels with compiler options rather than through the host flag set.
|
|
@@ -180,11 +180,12 @@ var TsgoArguments;
|
|
|
180
180
|
/**
|
|
181
181
|
* The forwarded-tsgo payload for a native `build`/`check` emit invocation.
|
|
182
182
|
*
|
|
183
|
-
* The sidecar builds its Program in-process, so
|
|
184
|
-
* travel the same channel
|
|
185
|
-
* set does not declare `--rootDir`, and `filterHostArgs` would
|
|
183
|
+
* The sidecar builds its Program in-process, so runtime source-map defaults
|
|
184
|
+
* and the pinned `rootDir` travel the same channel as other tsgo options —
|
|
185
|
+
* the host flag set does not declare `--rootDir`, and `filterHostArgs` would
|
|
186
|
+
* strip it.
|
|
186
187
|
*
|
|
187
|
-
* @evidence contracts/common.md#principled-implementation The same private layout root used by direct builds
|
|
188
|
+
* @evidence contracts/common.md#principled-implementation The same private layout root and forced runtime source-map default used by direct builds precede user arguments in the sidecar compiler-option channel, preserving explicit overrides and declared/composite containment without a new host flag.
|
|
188
189
|
* @evidence contracts/common.md#clear-and-simple-design Root pinning stays in one helper and general payload ordering/serialization stays in createNativeTsgoArgs.
|
|
189
190
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The supported environment payload carries compiler options instead of injecting unknown flags into strict foreign host parsers.
|
|
190
191
|
* @evidence contracts/common.md#meaningful-documentation Native prose explains why rootDir travels with compiler options rather than through the host flag set.
|
|
@@ -195,7 +196,12 @@ var TsgoArguments;
|
|
|
195
196
|
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Returned JSON is transferred to the process boundary; no retained process or cache is owned.
|
|
196
197
|
*/
|
|
197
198
|
function createNativeBuildTsgoArgs(execution, options) {
|
|
198
|
-
return createNativeTsgoArgs(options,
|
|
199
|
+
return createNativeTsgoArgs(options, [
|
|
200
|
+
...(options.forceRuntimeSourceMap === true
|
|
201
|
+
? ["--sourceMap", "true"]
|
|
202
|
+
: []),
|
|
203
|
+
...pinnedRootDirArgs(execution, options),
|
|
204
|
+
], false);
|
|
199
205
|
}
|
|
200
206
|
TsgoArguments.createNativeBuildTsgoArgs = createNativeBuildTsgoArgs;
|
|
201
207
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsgoArguments.js","sourceRoot":"","sources":["../../../../src/compiler/internal/build/TsgoArguments.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAG7B,kFAA+E;AAE/E,yDAAsD;AAEtD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"TsgoArguments.js","sourceRoot":"","sources":["../../../../src/compiler/internal/build/TsgoArguments.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAG7B,kFAA+E;AAE/E,yDAAsD;AAEtD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAiB,aAAa,CA6V7B;AA7VD,W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AO,OAAO,CAAC,gBAAgB,KAAK,QAAQ;YAC1C,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACxC,CAAC,CAAC,SAAS,CAAC;QAChB,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACpC,OAAO;YACL,WAAW;YACX,MAAM;YACN,kBAAkB;YAClB,MAAM;YACN,mBAAmB;YACnB,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC;YACtC,UAAU;YACV,MAAM;SACP,CAAC;IACJ,CAAC;IArCe,cAAA,sBAAsB,yBAqCrC,CAAA;IAED,SAAS,yBAAyB,CAChC,OAA0B;QAE1B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACxC,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAChD,sEAAsE;QACtE,6EAA6E;QAC7E,OAAO,mCAAgB,CAAC,mBAAmB,CAAC,WAAW,EAAE;YACvD,eAAe;YACf,uBAAuB;SACxB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,EA7VgB,aAAa,aAAb,aAAa,GAAb,aAAa,QA6V7B"}
|
|
@@ -18,7 +18,7 @@ import { WatchInputPublication } from "./WatchInputPublication";
|
|
|
18
18
|
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes returned exit failures from thrown setup/launch errors and explains the project-free branch.
|
|
19
19
|
* @evidence contracts/portability.md#os-neutral-implementation Execution selection and spawning use the shared native path/process boundaries with cwd and separate argv, rather than constructing a shell command here.
|
|
20
20
|
* @evidence contracts/performance.md#efficient-algorithms Timing creation and terminal selection make their own flag projections before the selected preparation/execution path. Delegated configuration, plugin, native/provenance and diagnostic work follows its actual input/report sizes; timing formatting scans ledger labels and output. No measured dominance or duration/output ceiling is established by this wrapper.
|
|
21
|
-
* @evidence contracts/performance.md#reuse-equivalent-work A resolved execution context is carried through preparation and execution
|
|
21
|
+
* @evidence contracts/performance.md#reuse-equivalent-work A resolved execution context is carried through preparation and execution without another plugin load; private runtime requests delegate verified completed-emission reuse to RuntimeBuildCache with current input and producer proofs.
|
|
22
22
|
* @evidence contracts/performance.md#bound-retention-and-release-resources The ledger and execution state are build-owned, while returned output/proof/diagnostic records transfer to the caller; no resident handle or historical build is stored here. Delegated native/probe/artifact acquisition and cleanup may be best effort, and thrown setup can precede some cleanup boundaries. This wrapper supplies no duration/output bound or descendant-release certification.
|
|
23
23
|
*/
|
|
24
24
|
export declare function runBuild(options?: RunBuildOptions): TtscBuildResult;
|
|
@@ -30,8 +30,8 @@ export declare function runBuild(options?: RunBuildOptions): TtscBuildResult;
|
|
|
30
30
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Awaiting changes only publication completion, preserves compiler/plugin selection and project-free terminal behavior, and sends publication failure through existing setup and cleanup rather than bypassing a pending baseline.
|
|
31
31
|
* @evidence contracts/common.md#meaningful-documentation Entry prose states the publication barrier, order before compilation and internal callers' obligation to complete the sequence and deliver rejection.
|
|
32
32
|
* @evidence contracts/portability.md#os-neutral-implementation BuildExecution retains native cwd, path identity and argument-array ownership across suspension; the namespace adds no independent native boundary.
|
|
33
|
-
* @evidence contracts/performance.md#efficient-algorithms Each selected terminal, context, discovery
|
|
34
|
-
* @evidence contracts/performance.md#reuse-equivalent-work One resolved execution context serves preparation and compilation without reloading plugins; the
|
|
33
|
+
* @evidence contracts/performance.md#efficient-algorithms Each selected terminal, context, discovery and preparation phase runs once; eligible runtime requests add native source/configuration queries and content proofs before restoring or compiling. Each publication adds one await and constant sequence state.
|
|
34
|
+
* @evidence contracts/performance.md#reuse-equivalent-work One resolved execution context serves preparation and compilation without reloading plugins; the delegated runtime store reuses completed bytes only under current equal input snapshots and valid producer witnesses, with ordinary compilation on any miss.
|
|
35
35
|
* @evidence contracts/performance.md#bound-retention-and-release-resources The invocation owns its sequence, ledger, context and current handoff while callbacks settle. Selected results transfer to the caller, delegated resource ownership and cleanup stay unchanged, and no resident history is retained.
|
|
36
36
|
*/
|
|
37
37
|
export declare namespace runBuild {
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runBuild = runBuild;
|
|
4
4
|
const BuildExecution_1 = require("./BuildExecution");
|
|
5
5
|
const BuildTiming_1 = require("./BuildTiming");
|
|
6
|
+
const RuntimeBuildCache_1 = require("./RuntimeBuildCache");
|
|
7
|
+
const RuntimeBuildInputs_1 = require("./RuntimeBuildInputs");
|
|
6
8
|
const WatchInputPublication_1 = require("./WatchInputPublication");
|
|
7
9
|
/**
|
|
8
10
|
* Run `ttsc` against a tsconfig. Returns once the binary exits so the CLI can
|
|
@@ -21,7 +23,7 @@ const WatchInputPublication_1 = require("./WatchInputPublication");
|
|
|
21
23
|
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes returned exit failures from thrown setup/launch errors and explains the project-free branch.
|
|
22
24
|
* @evidence contracts/portability.md#os-neutral-implementation Execution selection and spawning use the shared native path/process boundaries with cwd and separate argv, rather than constructing a shell command here.
|
|
23
25
|
* @evidence contracts/performance.md#efficient-algorithms Timing creation and terminal selection make their own flag projections before the selected preparation/execution path. Delegated configuration, plugin, native/provenance and diagnostic work follows its actual input/report sizes; timing formatting scans ledger labels and output. No measured dominance or duration/output ceiling is established by this wrapper.
|
|
24
|
-
* @evidence contracts/performance.md#reuse-equivalent-work A resolved execution context is carried through preparation and execution
|
|
26
|
+
* @evidence contracts/performance.md#reuse-equivalent-work A resolved execution context is carried through preparation and execution without another plugin load; private runtime requests delegate verified completed-emission reuse to RuntimeBuildCache with current input and producer proofs.
|
|
25
27
|
* @evidence contracts/performance.md#bound-retention-and-release-resources The ledger and execution state are build-owned, while returned output/proof/diagnostic records transfer to the caller; no resident handle or historical build is stored here. Delegated native/probe/artifact acquisition and cleanup may be best effort, and thrown setup can precede some cleanup boundaries. This wrapper supplies no duration/output bound or descendant-release certification.
|
|
26
28
|
*/
|
|
27
29
|
function runBuild(options = {}) {
|
|
@@ -35,8 +37,8 @@ function runBuild(options = {}) {
|
|
|
35
37
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Awaiting changes only publication completion, preserves compiler/plugin selection and project-free terminal behavior, and sends publication failure through existing setup and cleanup rather than bypassing a pending baseline.
|
|
36
38
|
* @evidence contracts/common.md#meaningful-documentation Entry prose states the publication barrier, order before compilation and internal callers' obligation to complete the sequence and deliver rejection.
|
|
37
39
|
* @evidence contracts/portability.md#os-neutral-implementation BuildExecution retains native cwd, path identity and argument-array ownership across suspension; the namespace adds no independent native boundary.
|
|
38
|
-
* @evidence contracts/performance.md#efficient-algorithms Each selected terminal, context, discovery
|
|
39
|
-
* @evidence contracts/performance.md#reuse-equivalent-work One resolved execution context serves preparation and compilation without reloading plugins; the
|
|
40
|
+
* @evidence contracts/performance.md#efficient-algorithms Each selected terminal, context, discovery and preparation phase runs once; eligible runtime requests add native source/configuration queries and content proofs before restoring or compiling. Each publication adds one await and constant sequence state.
|
|
41
|
+
* @evidence contracts/performance.md#reuse-equivalent-work One resolved execution context serves preparation and compilation without reloading plugins; the delegated runtime store reuses completed bytes only under current equal input snapshots and valid producer witnesses, with ordinary compilation on any miss.
|
|
40
42
|
* @evidence contracts/performance.md#bound-retention-and-release-resources The invocation owns its sequence, ledger, context and current handoff while callbacks settle. Selected results transfer to the caller, delegated resource ownership and cleanup stay unchanged, and no resident history is retained.
|
|
41
43
|
*/
|
|
42
44
|
(function (runBuild) {
|
|
@@ -61,8 +63,19 @@ function runBuild(options = {}) {
|
|
|
61
63
|
const setupStartedAt = process.hrtime.bigint();
|
|
62
64
|
const execution = yield* BuildExecution_1.BuildExecution.resolveExecutionContextSteps(options);
|
|
63
65
|
const prepared = yield* BuildExecution_1.BuildExecution.prepareBuildExecutionSteps(options, timing, execution, setupStartedAt);
|
|
66
|
+
const build = () => BuildExecution_1.BuildExecution.runPreparedBuild(options, timing, execution, prepared.buildOptions);
|
|
67
|
+
const proof = prepared.result === undefined
|
|
68
|
+
? RuntimeBuildInputs_1.RuntimeBuildInputs.create(prepared.buildOptions, execution)
|
|
69
|
+
: undefined;
|
|
64
70
|
const result = prepared.result ??
|
|
65
|
-
|
|
71
|
+
(proof === undefined
|
|
72
|
+
? build()
|
|
73
|
+
: RuntimeBuildCache_1.RuntimeBuildCache.run({
|
|
74
|
+
directory: options.runtimeCacheDir,
|
|
75
|
+
emitDir: options.isolateOutputsTo,
|
|
76
|
+
...proof,
|
|
77
|
+
build,
|
|
78
|
+
}));
|
|
66
79
|
return BuildTiming_1.BuildTiming.appendTimingOutput(result, timing);
|
|
67
80
|
}
|
|
68
81
|
runBuild.steps = steps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runBuild.js","sourceRoot":"","sources":["../../../../src/compiler/internal/build/runBuild.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAClD,+CAA4C;AAE5C,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kBAAyB,OAAO,GAAoB,EAAE;IACpD,OAAO,6CAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,WAAiB,QAAQ;IACvB;;;OAGG;IACH,SAAgB,KAAK,CACnB,OAAO,GAAoB,EAAE;QAE7B,OAAO,6CAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;IAJe,SAAA,KAAK,QAIpB,CAAA;IAED;;;;OAIG;IACH,QAAe,CAAC,CAAC,KAAK,CACpB,OAAwB;QAExB,MAAM,MAAM,GAAG,yBAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,+BAAc,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACvE,IAAI,WAAW,KAAK,IAAI;YACtB,OAAO,yBAAW,CAAC,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC7D,MAAM,c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AAC,+BAAc,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,+BAAc,CAAC,0BAA0B,CAC/D,OAAO,EACP,MAAM,EACN,SAAS,EACT,cAAc,CACf,CAAC;QACF,MAAM,KAAK,GAAG,GAAG,EAAE,CACjB,+BAAc,CAAC,gBAAgB,CAC7B,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,CAAC,YAAY,CACtB,CAAC;QACJ,MAAM,KAAK,GACT,QAAQ,CAAC,MAAM,KAAK,SAAS;YAC3B,CAAC,CAAC,uCAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;YAC7D,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,MAAM,GACV,QAAQ,CAAC,MAAM;YACf,CAAC,KAAK,KAAK,SAAS;gBAClB,CAAC,CAAC,KAAK,EAAE;gBACT,CAAC,CAAC,qCAAiB,CAAC,GAAG,CAAC;oBACpB,SAAS,EAAE,OAAO,CAAC,eAAe;oBAClC,OAAO,EAAE,OAAO,CAAC,gBAAiB;oBAClC,GAAG,KAAK;oBACR,KAAK;iBACN,CAAC,CAAC,CAAC;QACV,OAAO,yBAAW,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAtCgB,SAAA,KAAK,QAsCrB,CAAA;AACH,CAAC,EAvDgB,QAAQ,aAhBT,QAAQ,GAgBP,QAAQ,QAuDxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find native TypeScript from a filename used as a Node resolution anchor.
|
|
3
|
+
*
|
|
4
|
+
* The nearest ancestor manifest declaring TypeScript or its npm aliases owns
|
|
5
|
+
* discovery. Its aliases targeting `typescript` precede the ordinary name. A
|
|
6
|
+
* manifest reporting a compiler major below 7 belongs to the JavaScript
|
|
7
|
+
* compiler and is skipped. Missing or nonnumeric version metadata retains the
|
|
8
|
+
* existing path-discovery behavior; executable availability is the caller's
|
|
9
|
+
* responsibility. Alias candidates must report the actual package name
|
|
10
|
+
* `typescript` and a native major. Multiple distinct native alias installs are
|
|
11
|
+
* ambiguous and require an explicit binary. Read and parse errors propagate,
|
|
12
|
+
* except a disappeared manifest is treated as an absent candidate.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/common.md#principled-implementation Project and ancestor dependency maps supply npm aliases by their declared target; Node resolves those arbitrary names from the caller's filename, and installed name/version metadata verifies native identity. Distinct native alias installs are rejected as ambiguous rather than selected by spelling or declaration order.
|
|
15
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner selects manifest metadata for executable resolution and plugin version keys so they cannot choose different package names.
|
|
16
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The real package identity and npm alias syntax define discovery; no particular alias, consumer identity or guessed executable is embedded.
|
|
17
|
+
* @evidence contracts/common.md#meaningful-documentation The comment defines anchor semantics, alias precedence, legacy rejection, incomplete metadata behavior and propagated read failures.
|
|
18
|
+
* @evidence contracts/portability.md#os-neutral-implementation createRequire follows native Node package resolution and synchronous filesystem reads without shell commands or path case assumptions.
|
|
19
|
+
* @evidence contracts/performance.md#efficient-algorithms The ancestor walk parses its manifests and visits their declared dependency entries once, then resolves and reads only A distinct aliases plus the ordinary name. Sorting alias names costs O(A log A); Node lookup, realpath and manifest bytes contribute delegated costs. Installed dependency trees are never scanned.
|
|
20
|
+
*
|
|
21
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Project installations can change between calls, and this operation owns no invalidation source that would justify a retained result.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous reads retain no open handles and the caller owns the returned metadata.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveNativeTypeScriptPackage(from: string): {
|
|
25
|
+
packageJson: string;
|
|
26
|
+
manifest: Record<string, unknown>;
|
|
27
|
+
} | undefined;
|