ttsc 0.26.2 → 0.28.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.
Files changed (170) hide show
  1. package/README.md +9 -0
  2. package/cmd/graphbench/main.go +26 -16
  3. package/cmd/graphdump/main.go +37 -12
  4. package/cmd/graphdump/run_declares_the_capability_its_output_carries_test.go +137 -0
  5. package/cmd/graphdump/run_reports_an_unknown_flag_without_exiting_the_process_test.go +56 -0
  6. package/cmd/graphdump/run_reports_an_unloadable_project_without_printing_a_dump_test.go +46 -0
  7. package/cmd/ttsc/api_transform.go +28 -3
  8. package/cmd/ttscgraph/auxiliary_identity_state_tracks_retargets_not_source_contents_test.go +85 -0
  9. package/cmd/ttscgraph/disk_realpath_other.go +16 -0
  10. package/cmd/ttscgraph/disk_realpath_windows.go +56 -0
  11. package/cmd/ttscgraph/dump.go +43 -11
  12. package/cmd/ttscgraph/run_dump_claims_artifacts_only_when_it_asked_test.go +135 -0
  13. package/cmd/ttscgraph/run_dump_declares_the_capability_its_output_carries_test.go +96 -0
  14. package/cmd/ttscgraph/serve.go +357 -60
  15. package/cmd/ttscgraph/serve_adopts_a_republished_artifact_set_test.go +348 -0
  16. package/cmd/ttscgraph/serve_projects_an_artifact_no_source_owns_test.go +90 -0
  17. package/cmd/ttscgraph/serve_shards.go +31 -9
  18. package/driver/config_discovery.go +121 -0
  19. package/driver/emit_plugin.go +77 -11
  20. package/driver/graph.go +64 -11
  21. package/driver/input_observation.go +273 -0
  22. package/driver/input_observation_test.go +149 -0
  23. package/driver/plugins.go +506 -15
  24. package/driver/program.go +54 -1
  25. package/driver/resolution_candidates.go +13 -5
  26. package/driver/rewrite.go +45 -2
  27. package/driver/transform_dependencies.go +283 -0
  28. package/driver/transform_dependencies_declares_every_file_without_a_contributor_test.go +28 -0
  29. package/driver/transform_dependencies_drops_a_self_reported_dependency_test.go +21 -0
  30. package/driver/transform_dependencies_keys_a_reported_path_like_the_envelope_test.go +46 -0
  31. package/driver/transform_dependencies_requires_every_contributor_to_declare_test.go +38 -0
  32. package/driver/transform_dependencies_stays_silent_for_an_undeclared_contributor_test.go +23 -0
  33. package/driver/transform_dependencies_withdraws_completeness_after_an_unusable_dependency_test.go +37 -0
  34. package/internal/graph/artifacts.go +230 -0
  35. package/internal/graph/artifacts_index_what_a_plugin_published_test.go +154 -0
  36. package/internal/graph/artifacts_survive_a_partial_rebuild_test.go +89 -0
  37. package/internal/graph/build.go +35 -0
  38. package/internal/graph/build_releases_the_scratch_it_no_longer_reads_test.go +118 -0
  39. package/internal/graph/doc_refs_are_the_use_the_checker_already_counts_test.go +93 -0
  40. package/internal/graph/doc_refs_resolve_documentation_links_test.go +335 -0
  41. package/internal/graph/doc_tags.go +416 -0
  42. package/internal/graph/doc_tags_are_claimed_before_they_are_read_test.go +131 -0
  43. package/internal/graph/doc_tags_capture_every_unrecognized_tag_test.go +165 -0
  44. package/internal/graph/doc_tags_read_only_what_the_parser_attached_test.go +97 -0
  45. package/internal/graph/doc_tags_stop_at_the_external_boundary_test.go +59 -0
  46. package/internal/graph/doc_tags_survive_line_endings_and_repeated_blocks_test.go +146 -0
  47. package/internal/graph/dump.go +60 -13
  48. package/internal/graph/dump_checkout_paths_are_stable_test.go +2 -2
  49. package/internal/graph/dump_paths.go +2 -2
  50. package/internal/graph/dump_paths_are_portable_and_injective_test.go +1 -1
  51. package/internal/graph/edge_kinds_names_every_declared_kind_test.go +49 -0
  52. package/internal/graph/edges.go +1 -0
  53. package/internal/graph/graph.go +79 -4
  54. package/internal/graph/provenance.go +29 -2
  55. package/lib/TtscCompiler.d.ts +12 -11
  56. package/lib/TtscCompiler.js +44 -29
  57. package/lib/TtscCompiler.js.map +1 -1
  58. package/lib/compiler/internal/captureProcessOutput.js +2 -2
  59. package/lib/compiler/internal/captureProcessOutput.js.map +1 -1
  60. package/lib/compiler/internal/compileProjectInMemory.js +4 -3
  61. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  62. package/lib/compiler/internal/project/createNativeProjectContextArgs.d.ts +9 -0
  63. package/lib/compiler/internal/project/createNativeProjectContextArgs.js +16 -4
  64. package/lib/compiler/internal/project/createNativeProjectContextArgs.js.map +1 -1
  65. package/lib/compiler/internal/resolveEmittedJavaScript.d.ts +2 -0
  66. package/lib/compiler/internal/resolveEmittedJavaScript.js +3 -0
  67. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
  68. package/lib/compiler/internal/runBuild.d.ts +1 -1
  69. package/lib/compiler/internal/runBuild.js +80 -34
  70. package/lib/compiler/internal/runBuild.js.map +1 -1
  71. package/lib/compiler/internal/runSingleFileEmit.js +2 -2
  72. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  73. package/lib/compiler/internal/sharedHostHelpers.d.ts +28 -0
  74. package/lib/compiler/internal/sharedHostHelpers.js +39 -0
  75. package/lib/compiler/internal/sharedHostHelpers.js.map +1 -1
  76. package/lib/compiler/internal/startResidentTransform.js +12 -4
  77. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  78. package/lib/compiler/internal/transformProjectInMemory.d.ts +3 -0
  79. package/lib/compiler/internal/transformProjectInMemory.js +239 -35
  80. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  81. package/lib/flags/schema.js +12 -5
  82. package/lib/flags/schema.js.map +1 -1
  83. package/lib/index.d.ts +1 -0
  84. package/lib/index.js +1 -0
  85. package/lib/index.js.map +1 -1
  86. package/lib/internal/createCanonicalTempDirectory.d.ts +17 -0
  87. package/lib/internal/createCanonicalTempDirectory.js +42 -0
  88. package/lib/internal/createCanonicalTempDirectory.js.map +1 -0
  89. package/lib/internal/projectInputPathIdentity.d.ts +3 -0
  90. package/lib/internal/projectInputPathIdentity.js +11 -5
  91. package/lib/internal/projectInputPathIdentity.js.map +1 -1
  92. package/lib/internal/resolveNodeBinary.d.ts +14 -0
  93. package/lib/internal/resolveNodeBinary.js +150 -0
  94. package/lib/internal/resolveNodeBinary.js.map +1 -0
  95. package/lib/internal/resolveSafeCacheCleanupTargets.d.ts +15 -0
  96. package/lib/internal/resolveSafeCacheCleanupTargets.js +61 -0
  97. package/lib/internal/resolveSafeCacheCleanupTargets.js.map +1 -0
  98. package/lib/launcher/internal/prepareExecution.d.ts +3 -0
  99. package/lib/launcher/internal/prepareExecution.js +42 -14
  100. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  101. package/lib/launcher/internal/runTtsc.js +25 -13
  102. package/lib/launcher/internal/runTtsc.js.map +1 -1
  103. package/lib/launcher/internal/runTtscserver.js +18 -3
  104. package/lib/launcher/internal/runTtscserver.js.map +1 -1
  105. package/lib/launcher/internal/runTtsx.js +2 -0
  106. package/lib/launcher/internal/runTtsx.js.map +1 -1
  107. package/lib/launcher/internal/runtimeHooks.d.ts +47 -3
  108. package/lib/launcher/internal/runtimeHooks.js +746 -64
  109. package/lib/launcher/internal/runtimeHooks.js.map +1 -1
  110. package/lib/plugin/internal/buildSourcePlugin.d.ts +62 -8
  111. package/lib/plugin/internal/buildSourcePlugin.js +754 -72
  112. package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
  113. package/lib/plugin/internal/capabilityResolutionCache.d.ts +76 -0
  114. package/lib/plugin/internal/capabilityResolutionCache.js +224 -0
  115. package/lib/plugin/internal/capabilityResolutionCache.js.map +1 -0
  116. package/lib/plugin/internal/loadProjectPlugins.d.ts +17 -5
  117. package/lib/plugin/internal/loadProjectPlugins.js +1339 -77
  118. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
  119. package/lib/plugin/resolveCapabilityPlugins.d.ts +55 -0
  120. package/lib/plugin/resolveCapabilityPlugins.js +118 -0
  121. package/lib/plugin/resolveCapabilityPlugins.js.map +1 -0
  122. package/lib/register.d.ts +1 -0
  123. package/lib/register.js +46 -0
  124. package/lib/register.js.map +1 -0
  125. package/lib/structures/ITtscCompilerContext.d.ts +6 -3
  126. package/lib/structures/ITtscCompilerTransformation.d.ts +38 -0
  127. package/lib/structures/ITtscPlugin.d.ts +33 -0
  128. package/package.json +16 -9
  129. package/shim/ast/parent.go +16 -3
  130. package/shim/checker/enums_gen.go +11 -0
  131. package/shim/checker/go.mod +9 -0
  132. package/shim/checker/go.sum +22 -0
  133. package/shim/checker/shim.go +78 -0
  134. package/shim/compiler/emithook.go +10 -0
  135. package/shim/compiler/incremental.go +45 -8
  136. package/src/TtscCompiler.ts +55 -33
  137. package/src/compiler/internal/captureProcessOutput.ts +3 -2
  138. package/src/compiler/internal/compileProjectInMemory.ts +4 -3
  139. package/src/compiler/internal/project/createNativeProjectContextArgs.ts +19 -4
  140. package/src/compiler/internal/resolveEmittedJavaScript.ts +6 -0
  141. package/src/compiler/internal/runBuild.ts +102 -39
  142. package/src/compiler/internal/runSingleFileEmit.ts +2 -2
  143. package/src/compiler/internal/sharedHostHelpers.ts +44 -0
  144. package/src/compiler/internal/startResidentTransform.ts +12 -3
  145. package/src/compiler/internal/transformProjectInMemory.ts +410 -39
  146. package/src/flags/schema.ts +12 -5
  147. package/src/index.ts +1 -0
  148. package/src/internal/createCanonicalTempDirectory.ts +53 -0
  149. package/src/internal/projectInputPathIdentity.ts +17 -4
  150. package/src/internal/resolveNodeBinary.ts +173 -0
  151. package/src/internal/resolveSafeCacheCleanupTargets.ts +85 -0
  152. package/src/launcher/internal/prepareExecution.ts +50 -14
  153. package/src/launcher/internal/runTtsc.ts +24 -13
  154. package/src/launcher/internal/runTtscserver.ts +18 -3
  155. package/src/launcher/internal/runTtsx.ts +2 -0
  156. package/src/launcher/internal/runtimeHooks.ts +934 -68
  157. package/src/plugin/internal/buildSourcePlugin.ts +984 -79
  158. package/src/plugin/internal/capabilityResolutionCache.ts +305 -0
  159. package/src/plugin/internal/loadProjectPlugins.ts +1718 -104
  160. package/src/plugin/resolveCapabilityPlugins.ts +171 -0
  161. package/src/register.ts +47 -0
  162. package/src/structures/ITtscCompilerContext.ts +6 -3
  163. package/src/structures/ITtscCompilerTransformation.ts +46 -0
  164. package/src/structures/ITtscPlugin.ts +36 -0
  165. package/tools/shim_audit/baseline.json +0 -2
  166. package/utility/host.go +18 -3
  167. package/lib/internal/assertSafeExplicitCacheDirectory.d.ts +0 -5
  168. package/lib/internal/assertSafeExplicitCacheDirectory.js +0 -26
  169. package/lib/internal/assertSafeExplicitCacheDirectory.js.map +0 -1
  170. package/src/internal/assertSafeExplicitCacheDirectory.ts +0 -29
@@ -0,0 +1,224 @@
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.readCapabilityResolution = readCapabilityResolution;
7
+ exports.writeCapabilityResolution = writeCapabilityResolution;
8
+ const node_crypto_1 = __importDefault(require("node:crypto"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const buildSourcePlugin_1 = require("./buildSourcePlugin");
12
+ const loadProjectPlugins_1 = require("./loadProjectPlugins");
13
+ /**
14
+ * Cache format tag.
15
+ *
16
+ * Moves when the entry shape or the validation rule changes, so an older entry
17
+ * is discarded rather than read under new rules.
18
+ */
19
+ const FORMAT = "ttsc-capability-resolution-v1";
20
+ /**
21
+ * The character that joins fields a path could otherwise forge.
22
+ *
23
+ * A path cannot contain it, which is the whole reason it is the separator: with
24
+ * a space, a file named `a 1 2` states the same string as a one-byte file named
25
+ * `a`, and an edit to either would read as no edit at all. Built rather than
26
+ * written literally, because a source file carrying a raw NUL is one Git
27
+ * classifies as binary — which silently exempts it from this repository's
28
+ * end-of-line contract and leaves it with no textual diff for a reviewer.
29
+ */
30
+ const SEPARATOR = String.fromCharCode(0);
31
+ /**
32
+ * Read the recorded answer for a project, or `null` when there is none that is
33
+ * still true.
34
+ *
35
+ * Fail-closed by construction: every path that cannot prove the entry — a
36
+ * missing file, a parse failure, a format bump, a moved input, a rebuilt plugin
37
+ * source, a binary that is gone — returns `null`, and `null` means "walk the
38
+ * project properly". A cache that guessed here would answer "no plugin declares
39
+ * this capability" for a project that had just configured one, which is a wrong
40
+ * answer indistinguishable from the correct answer for the common case.
41
+ */
42
+ function readCapabilityResolution(options) {
43
+ const file = resolutionFile(options);
44
+ if (file === null)
45
+ return null;
46
+ let entry;
47
+ try {
48
+ entry = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ if (!isEntry(entry) || entry.version !== formatVersion(options.version))
54
+ return null;
55
+ // An entry recording nothing proves nothing. Discovery always reads at least
56
+ // the project's own manifest, so an empty input set is a malformed entry
57
+ // rather than a project with no inputs.
58
+ if (entry.hostInputs.length === 0)
59
+ return null;
60
+ if (!sameMap(entry.hostInputHashes, (0, loadProjectPlugins_1.hashHostInputPaths)(entry.hostInputs)) ||
61
+ !sameMap(entry.hostInputRealpaths, (0, loadProjectPlugins_1.realpathHostInputPaths)(entry.hostInputs)))
62
+ return null;
63
+ for (const [source, fingerprint] of Object.entries(entry.sources))
64
+ if (fingerprintDirectory(source) !== fingerprint)
65
+ return null;
66
+ for (const plugin of entry.plugins)
67
+ if (!node_fs_1.default.existsSync(plugin.binary))
68
+ return null;
69
+ return entry;
70
+ }
71
+ /**
72
+ * Record the answer and the state it was true for.
73
+ *
74
+ * A write failure is not reported. The cache is an optimization over a walk
75
+ * that still works, and a read-only or full disk is a reason to be slower, not
76
+ * a reason for `resolveCapabilityPlugins` to start throwing at a caller whose
77
+ * contract is that it never does.
78
+ */
79
+ function writeCapabilityResolution(options, answer) {
80
+ const file = resolutionFile(options);
81
+ if (file === null)
82
+ return;
83
+ const hostInputs = [
84
+ ...new Set(answer.hostInputs
85
+ .filter((input) => input !== "")
86
+ .map((input) => node_path_1.default.resolve(input))),
87
+ ].sort();
88
+ if (hostInputs.length === 0)
89
+ return;
90
+ const entry = {
91
+ hostInputHashes: (0, loadProjectPlugins_1.hashHostInputPaths)(hostInputs),
92
+ hostInputRealpaths: (0, loadProjectPlugins_1.realpathHostInputPaths)(hostInputs),
93
+ hostInputs,
94
+ manifest: answer.manifest,
95
+ plugins: [...answer.plugins],
96
+ projectContext: answer.projectContext,
97
+ sources: Object.fromEntries([...new Set(answer.plugins.map((plugin) => plugin.source))]
98
+ .filter((source) => source !== "")
99
+ .map((source) => [source, fingerprintDirectory(source)])),
100
+ version: formatVersion(options.version),
101
+ };
102
+ try {
103
+ node_fs_1.default.mkdirSync(node_path_1.default.dirname(file), { recursive: true });
104
+ // Written beside the target and renamed, so a reader never sees half an
105
+ // entry: a truncated JSON parses as a failure and falls back, but a
106
+ // partially written one could parse and be believed.
107
+ const staging = `${file}.${String(process.pid)}.tmp`;
108
+ node_fs_1.default.writeFileSync(staging, JSON.stringify(entry), "utf8");
109
+ node_fs_1.default.renameSync(staging, file);
110
+ }
111
+ catch {
112
+ return;
113
+ }
114
+ }
115
+ function formatVersion(version) {
116
+ return `${FORMAT}:${version}`;
117
+ }
118
+ /**
119
+ * Where the entry for this project lives, or `null` when no cache root can be
120
+ * resolved.
121
+ *
122
+ * Keyed on the project rather than on the capability: the walk it replaces
123
+ * discovers every configured plugin, so one entry answers for all of them and a
124
+ * second consumer asking about a different capability costs nothing.
125
+ */
126
+ function resolutionFile(options) {
127
+ let root;
128
+ try {
129
+ root = (0, buildSourcePlugin_1.resolveSourceBuildCachePaths)(node_path_1.default.resolve(options.cwd), undefined, options.env ?? process.env).root;
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ const key = node_crypto_1.default
135
+ .createHash("sha256")
136
+ .update(node_path_1.default.resolve(options.cwd))
137
+ .update(SEPARATOR)
138
+ .update(options.tsconfig)
139
+ .digest("hex");
140
+ return node_path_1.default.join(root, "capabilities", `${key}.json`);
141
+ }
142
+ /** Whether the parsed value has every field the validation reads. */
143
+ function isEntry(value) {
144
+ if (typeof value !== "object" || value === null)
145
+ return false;
146
+ const entry = value;
147
+ return (typeof entry.version === "string" &&
148
+ Array.isArray(entry.hostInputs) &&
149
+ entry.hostInputs.every((input) => typeof input === "string") &&
150
+ isRecord(entry.hostInputHashes) &&
151
+ isRecord(entry.hostInputRealpaths) &&
152
+ isRecord(entry.sources) &&
153
+ typeof entry.manifest === "string" &&
154
+ (entry.projectContext === null ||
155
+ typeof entry.projectContext === "string") &&
156
+ Array.isArray(entry.plugins) &&
157
+ entry.plugins.every((plugin) => typeof plugin === "object" &&
158
+ plugin !== null &&
159
+ typeof plugin.binary === "string" &&
160
+ typeof plugin.source === "string" &&
161
+ isRecord(plugin.capabilities)));
162
+ }
163
+ function isRecord(value) {
164
+ return typeof value === "object" && value !== null && !Array.isArray(value);
165
+ }
166
+ /**
167
+ * Whether two snapshots describe the same state.
168
+ *
169
+ * Compared both ways: an input that has appeared is as much a change as one
170
+ * that has moved, and a recorded key the fresh snapshot lacks means the two
171
+ * were taken over different input sets.
172
+ */
173
+ function sameMap(recorded, current) {
174
+ const keys = Object.keys(recorded);
175
+ if (keys.length !== Object.keys(current).length)
176
+ return false;
177
+ return keys.every((key) => Object.prototype.hasOwnProperty.call(current, key) &&
178
+ recorded[key] === current[key]);
179
+ }
180
+ /**
181
+ * A directory's shape and the state of every file in it.
182
+ *
183
+ * Size and modification time rather than content: a plugin's Go source is
184
+ * hundreds of files, this runs on the fast path, and the question it answers is
185
+ * only whether the build cache would now key on something else. Bounded in
186
+ * depth, and blind to `node_modules` and dot directories, for the same reason
187
+ * the build that reads this source is.
188
+ */
189
+ function fingerprintDirectory(directory, depth = 0) {
190
+ const hash = node_crypto_1.default.createHash("sha256");
191
+ for (const line of directoryState(directory, depth).sort())
192
+ hash.update(line).update("\n");
193
+ return hash.digest("hex");
194
+ }
195
+ function directoryState(directory, depth) {
196
+ if (depth > 16)
197
+ return [];
198
+ let entries;
199
+ try {
200
+ entries = node_fs_1.default.readdirSync(directory, { withFileTypes: true });
201
+ }
202
+ catch {
203
+ return [`${directory}${SEPARATOR}absent`];
204
+ }
205
+ const states = [];
206
+ for (const entry of entries) {
207
+ const child = node_path_1.default.join(directory, entry.name);
208
+ if (entry.isDirectory()) {
209
+ if (entry.name === "node_modules" || entry.name.startsWith("."))
210
+ continue;
211
+ states.push(...directoryState(child, depth + 1));
212
+ continue;
213
+ }
214
+ try {
215
+ const stat = node_fs_1.default.statSync(child);
216
+ states.push([child, String(stat.size), String(stat.mtimeMs)].join(SEPARATOR));
217
+ }
218
+ catch {
219
+ states.push(`${child}${SEPARATOR}absent`);
220
+ }
221
+ }
222
+ return states;
223
+ }
224
+ //# sourceMappingURL=capabilityResolutionCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilityResolutionCache.js","sourceRoot":"","sources":["../../../src/plugin/internal/capabilityResolutionCache.ts"],"names":[],"mappings":";;;;;;;AAAA,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAE7B,2DAAmE;AACnE,6DAG8B;AA4C9B;;;;;GAKG;AACH,MAAM,MAAM,GAAG,+BAA+B,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,kCAAyC,OAKxC;IACC,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,IAAI,KAAqC,CAAC;IAC1C,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAChB,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CACI,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,KAAK,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,6EAA6E;IAC7E,yEAAyE;IACzE,wCAAwC;IACxC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CA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;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -7,17 +7,18 @@ import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscPa
7
7
  * Reads the project config, discovers plugin entries (from tsconfig and package
8
8
  * auto-discovery), validates and composes their descriptors, then invokes
9
9
  * `buildSourcePlugin` to compile each Go source package into a cached binary.
10
- * Returns the ordered set of loaded native plugins alongside the parsed project
11
- * config.
10
+ * Returns the ordered native plugins, parsed project config, and exact
11
+ * JavaScript-host files that universally influence the loaded selection.
12
12
  *
13
13
  * @param options.binary - Absolute path to the ttsc native helper binary.
14
14
  * @param options.cacheDir - Override the plugin binary cache directory.
15
15
  * @param options.cwd - Working directory for resolving relative paths.
16
16
  * @param options.entries - Explicit plugin entries; `false` disables all
17
17
  * plugins (skips both tsconfig entries and package auto-discovery).
18
- * @param options.env - Effective environment for source-plugin builds and the
19
- * `ttsx` descriptor child (`{ ...process.env, ...context.env }`). Defaults to
20
- * `process.env` for CLI callers, so ambient behavior is unchanged.
18
+ * @param options.env - Effective environment for source-plugin builds and
19
+ * isolated descriptor evaluators, including the `ttsx` fallback (`{
20
+ * ...process.env, ...context.env }`). Defaults to `process.env` for CLI
21
+ * callers, so ambient behavior is unchanged.
21
22
  * @param options.file - Path to the tsconfig/jsconfig file.
22
23
  * @param options.pluginConfigDir - Caller-declared anchor for plugin
23
24
  * config-file discovery (see `ITtscPluginFactoryContext.pluginConfigDir`).
@@ -36,9 +37,18 @@ export declare function loadProjectPlugins(options: {
36
37
  projectRoot?: string;
37
38
  tsconfig?: string;
38
39
  }): {
40
+ hostInputHashes: Record<string, string | null>;
41
+ hostInputRealpaths: Record<string, string | null>;
42
+ hostInputs: string[];
39
43
  nativePlugins: ITtscLoadedNativePlugin[];
40
44
  project: ITtscParsedProjectConfig;
41
45
  };
46
+ export declare function hashHostInputPaths(files: readonly string[]): Record<string, string | null>;
47
+ /** Physical path selected by a host input, or null while it is unresolved. */
48
+ export declare function realpathHostInput(file: string): string | null;
49
+ export declare function realpathHostInputPaths(files: readonly string[]): Record<string, string | null>;
50
+ /** Return config ancestry and the manifest controlling package discovery. */
51
+ export declare function collectProjectHostInputs(project: ITtscParsedProjectConfig, includePluginDiscovery?: boolean): string[];
42
52
  /**
43
53
  * Return `true` when the project has at least one enabled plugin entry.
44
54
  *
@@ -48,6 +58,8 @@ export declare function loadProjectPlugins(options: {
48
58
  * @param entries - Explicit entries; `false` always returns `false`.
49
59
  */
50
60
  export declare function hasProjectPluginEntries(project: ITtscParsedProjectConfig, entries?: readonly ITtscProjectPluginConfig[] | false): boolean;
61
+ /** CommonJS evaluator emitted into a clean Node process for every load. */
62
+ export declare const COMMONJS_PLUGIN_DESCRIPTOR_SHIM_SOURCE: string;
51
63
  /**
52
64
  * The descriptor shim's emitted source.
53
65
  *