ttsc 0.32.0 → 0.32.1

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 (164) hide show
  1. package/lib/TtscCompiler.js +1 -1
  2. package/lib/TtscCompiler.js.map +1 -1
  3. package/lib/compiler/internal/ResidentCheckProcess.d.ts +74 -96
  4. package/lib/compiler/internal/ResidentCheckProcess.js +150 -335
  5. package/lib/compiler/internal/ResidentCheckProcess.js.map +1 -1
  6. package/lib/compiler/internal/ResidentCheckProcessHost.d.ts +127 -0
  7. package/lib/compiler/internal/ResidentCheckProcessHost.js +447 -0
  8. package/lib/compiler/internal/ResidentCheckProcessHost.js.map +1 -0
  9. package/lib/compiler/internal/ResidentCheckProcessProtocol.d.ts +64 -0
  10. package/lib/compiler/internal/ResidentCheckProcessProtocol.js +3 -0
  11. package/lib/compiler/internal/ResidentCheckProcessProtocol.js.map +1 -0
  12. package/lib/compiler/internal/build/BuildExecution.d.ts +103 -1
  13. package/lib/compiler/internal/build/BuildExecution.js +91 -11
  14. package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
  15. package/lib/compiler/internal/build/ResidentCheckWatchSession.d.ts +16 -11
  16. package/lib/compiler/internal/build/ResidentCheckWatchSession.js +37 -21
  17. package/lib/compiler/internal/build/ResidentCheckWatchSession.js.map +1 -1
  18. package/lib/compiler/internal/build/RunBuildOptions.d.ts +6 -5
  19. package/lib/compiler/internal/build/WatchInputPublication.d.ts +59 -0
  20. package/lib/compiler/internal/build/WatchInputPublication.js +93 -0
  21. package/lib/compiler/internal/build/WatchInputPublication.js.map +1 -0
  22. package/lib/compiler/internal/build/runBuild.d.ts +29 -2
  23. package/lib/compiler/internal/build/runBuild.js +45 -19
  24. package/lib/compiler/internal/build/runBuild.js.map +1 -1
  25. package/lib/compiler/internal/buildNativeCompiler.d.ts +2 -0
  26. package/lib/compiler/internal/buildNativeCompiler.js +1 -0
  27. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  28. package/lib/compiler/internal/compileProjectInMemory.js +4 -2
  29. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  30. package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +7 -2
  31. package/lib/compiler/internal/project/resolveOwningProjectConfig.js +6 -3
  32. package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -1
  33. package/lib/compiler/internal/readEffectiveCompilerOptions.js +1 -1
  34. package/lib/compiler/internal/readEffectiveCompilerOptions.js.map +1 -1
  35. package/lib/compiler/internal/resolveBinary.d.ts +1 -0
  36. package/lib/compiler/internal/resolveBinary.js.map +1 -1
  37. package/lib/compiler/internal/resolveTsgo.d.ts +6 -0
  38. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  39. package/lib/compiler/internal/runSingleFileEmit.d.ts +28 -1
  40. package/lib/compiler/internal/runSingleFileEmit.js +120 -86
  41. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  42. package/lib/compiler/internal/startResidentTransform.js +8 -2
  43. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  44. package/lib/compiler/internal/transformProjectInMemory.js +11 -3
  45. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  46. package/lib/compiler/internal/transformProjectInWorker.d.ts +1 -1
  47. package/lib/compiler/internal/transformProjectInWorker.js +3 -2
  48. package/lib/compiler/internal/transformProjectInWorker.js.map +1 -1
  49. package/lib/internal/workerModuleUrl.d.ts +28 -0
  50. package/lib/internal/workerModuleUrl.js +40 -0
  51. package/lib/internal/workerModuleUrl.js.map +1 -0
  52. package/lib/launcher/internal/buildSingleRootProject.js +2 -1
  53. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
  54. package/lib/launcher/internal/getCompilerVersionText.js +3 -2
  55. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  56. package/lib/launcher/internal/prepareExecution.js +2 -1
  57. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  58. package/lib/launcher/internal/runTtsc.js +91 -41
  59. package/lib/launcher/internal/runTtsc.js.map +1 -1
  60. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.d.ts +10 -6
  61. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js +11 -9
  62. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js.map +1 -1
  63. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.d.ts +20 -0
  64. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js +27 -0
  65. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js.map +1 -0
  66. package/lib/launcher/internal/runtime/installRuntimeHooks.d.ts +5 -3
  67. package/lib/launcher/internal/runtime/installRuntimeHooks.js +7 -3
  68. package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
  69. package/lib/launcher/internal/watch/AsyncWatchTopology.d.ts +113 -0
  70. package/lib/launcher/internal/watch/AsyncWatchTopology.js +232 -0
  71. package/lib/launcher/internal/watch/AsyncWatchTopology.js.map +1 -0
  72. package/lib/launcher/internal/watch/WatchSettlement.d.ts +49 -0
  73. package/lib/launcher/internal/watch/WatchSettlement.js +70 -0
  74. package/lib/launcher/internal/watch/WatchSettlement.js.map +1 -0
  75. package/lib/launcher/internal/watch/WatchTopology.d.ts +29 -1
  76. package/lib/launcher/internal/watch/WatchTopology.js +86 -10
  77. package/lib/launcher/internal/watch/WatchTopology.js.map +1 -1
  78. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.d.ts +121 -0
  79. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js +3 -0
  80. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js.map +1 -0
  81. package/lib/launcher/internal/watch/serveWatchTopologyWorker.d.ts +19 -0
  82. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js +62 -0
  83. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js.map +1 -0
  84. package/lib/launcher/internal/watch/watchTopologyWorker.d.ts +1 -0
  85. package/lib/launcher/internal/watch/watchTopologyWorker.js +22 -0
  86. package/lib/launcher/internal/watch/watchTopologyWorker.js.map +1 -0
  87. package/lib/plugin/CapabilityPluginResolver.d.ts +1 -1
  88. package/lib/plugin/CapabilityPluginResolver.js +3 -2
  89. package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
  90. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +15 -12
  91. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +13 -11
  92. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -1
  93. package/lib/plugin/internal/load/PluginPackageResolution.d.ts +2 -2
  94. package/lib/plugin/internal/load/PluginPackageResolution.js +13 -7
  95. package/lib/plugin/internal/load/PluginPackageResolution.js.map +1 -1
  96. package/lib/plugin/internal/load/ProjectPluginEntries.d.ts +23 -7
  97. package/lib/plugin/internal/load/ProjectPluginEntries.js +36 -14
  98. package/lib/plugin/internal/load/ProjectPluginEntries.js.map +1 -1
  99. package/lib/plugin/internal/load/collectProjectHostInputs.d.ts +3 -1
  100. package/lib/plugin/internal/load/collectProjectHostInputs.js +5 -2
  101. package/lib/plugin/internal/load/collectProjectHostInputs.js.map +1 -1
  102. package/lib/plugin/internal/load/hasProjectPluginEntries.d.ts +3 -1
  103. package/lib/plugin/internal/load/hasProjectPluginEntries.js +4 -2
  104. package/lib/plugin/internal/load/hasProjectPluginEntries.js.map +1 -1
  105. package/lib/plugin/internal/load/loadProjectPlugins.d.ts +36 -5
  106. package/lib/plugin/internal/load/loadProjectPlugins.js +466 -416
  107. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
  108. package/lib/plugin/internal/load/pluginResolutionFailure.d.ts +18 -0
  109. package/lib/plugin/internal/load/pluginResolutionFailure.js +32 -0
  110. package/lib/plugin/internal/load/pluginResolutionFailure.js.map +1 -0
  111. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +1 -1
  112. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +3 -2
  113. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -1
  114. package/lib/structures/ITtscCompilerContext.d.ts +12 -12
  115. package/lib/structures/ITtscPlugin.d.ts +7 -5
  116. package/lib/structures/ITtscPluginFactoryContext.d.ts +9 -8
  117. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +12 -6
  118. package/package.json +9 -9
  119. package/src/TtscCompiler.ts +1 -1
  120. package/src/compiler/internal/ResidentCheckProcess.ts +159 -374
  121. package/src/compiler/internal/ResidentCheckProcessHost.ts +502 -0
  122. package/src/compiler/internal/ResidentCheckProcessProtocol.ts +53 -0
  123. package/src/compiler/internal/build/BuildExecution.ts +118 -9
  124. package/src/compiler/internal/build/ResidentCheckWatchSession.ts +41 -24
  125. package/src/compiler/internal/build/RunBuildOptions.ts +9 -5
  126. package/src/compiler/internal/build/WatchInputPublication.ts +106 -0
  127. package/src/compiler/internal/build/runBuild.ts +58 -34
  128. package/src/compiler/internal/buildNativeCompiler.ts +4 -0
  129. package/src/compiler/internal/compileProjectInMemory.ts +8 -2
  130. package/src/compiler/internal/project/resolveOwningProjectConfig.ts +16 -5
  131. package/src/compiler/internal/readEffectiveCompilerOptions.ts +1 -1
  132. package/src/compiler/internal/resolveBinary.ts +4 -1
  133. package/src/compiler/internal/resolveTsgo.ts +7 -0
  134. package/src/compiler/internal/runSingleFileEmit.ts +139 -99
  135. package/src/compiler/internal/startResidentTransform.ts +9 -2
  136. package/src/compiler/internal/transformProjectInMemory.ts +12 -3
  137. package/src/compiler/internal/transformProjectInWorker.ts +10 -2
  138. package/src/internal/workerModuleUrl.ts +34 -0
  139. package/src/launcher/internal/buildSingleRootProject.ts +2 -0
  140. package/src/launcher/internal/getCompilerVersionText.ts +3 -2
  141. package/src/launcher/internal/prepareExecution.ts +2 -0
  142. package/src/launcher/internal/runTtsc.ts +123 -45
  143. package/src/launcher/internal/runtime/CommonJsRuntimeSource.ts +11 -9
  144. package/src/launcher/internal/runtime/advertiseTypeScriptExtensions.ts +25 -0
  145. package/src/launcher/internal/runtime/installRuntimeHooks.ts +7 -3
  146. package/src/launcher/internal/watch/AsyncWatchTopology.ts +267 -0
  147. package/src/launcher/internal/watch/WatchSettlement.ts +67 -0
  148. package/src/launcher/internal/watch/WatchTopology.ts +84 -13
  149. package/src/launcher/internal/watch/WatchTopologyWorkerProtocol.ts +106 -0
  150. package/src/launcher/internal/watch/serveWatchTopologyWorker.ts +75 -0
  151. package/src/launcher/internal/watch/watchTopologyWorker.ts +29 -0
  152. package/src/plugin/CapabilityPluginResolver.ts +9 -2
  153. package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +17 -12
  154. package/src/plugin/internal/load/PluginPackageResolution.ts +14 -9
  155. package/src/plugin/internal/load/ProjectPluginEntries.ts +40 -15
  156. package/src/plugin/internal/load/collectProjectHostInputs.ts +7 -1
  157. package/src/plugin/internal/load/hasProjectPluginEntries.ts +8 -3
  158. package/src/plugin/internal/load/loadProjectPlugins.ts +672 -594
  159. package/src/plugin/internal/load/pluginResolutionFailure.ts +37 -0
  160. package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +8 -2
  161. package/src/structures/ITtscCompilerContext.ts +12 -12
  162. package/src/structures/ITtscPlugin.ts +7 -5
  163. package/src/structures/ITtscPluginFactoryContext.ts +9 -8
  164. package/src/structures/internal/TtscSingleFileEmitOptions.ts +22 -11
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Attribute a package-resolution failure to its plugin and consumer directory.
3
+ *
4
+ * Runtime resolvers can throw objects with an empty message. The request and
5
+ * directory remain actionable independently of that message; the original cause
6
+ * and any string error code remain available to callers.
7
+ *
8
+ * @evidence contracts/common.md#principled-implementation Resolution supplies the actual specifier and consumer directory, so diagnostic context survives an empty runtime message without inferring a cause or changing resolver policy.
9
+ * @evidence contracts/common.md#clear-and-simple-design One error boundary enriches diagnostics while preserving the original cause and a string code.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Error attribution uses every failed request without package-name, runtime-name or message-pattern exceptions.
11
+ * @evidence contracts/common.md#meaningful-documentation The comment states why independent resolution context is necessary and which original failure fields survive.
12
+ *
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The function displays caller-supplied strings and performs no filesystem, path-identity or process operation.
14
+ * @evidence contracts/performance.md#efficient-algorithms One diagnostic allocation copies specifier, directory and optional message text; work and storage scale with those strings.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Errors describe the current failed request and own no reusable observation.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned error transfers its cause to the caller and owns no native resource or cross-call population.
17
+ */
18
+ export function pluginResolutionFailure(
19
+ specifier: string,
20
+ consumerDir: string,
21
+ cause: unknown,
22
+ ): Error {
23
+ const record =
24
+ typeof cause === "object" && cause !== null
25
+ ? (cause as { code?: unknown; message?: unknown })
26
+ : undefined;
27
+ const message = typeof cause === "string" ? cause : record?.message;
28
+ const detail =
29
+ typeof message === "string" && message.trim() !== "" ? `: ${message}` : "";
30
+ const error = new Error(
31
+ `ttsc: could not resolve plugin ${JSON.stringify(specifier)} from ${JSON.stringify(consumerDir)}${detail}`,
32
+ { cause },
33
+ );
34
+ return typeof record?.code === "string"
35
+ ? Object.assign(error, { code: record.code })
36
+ : error;
37
+ }
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { SHARE_ENV, Worker } from "node:worker_threads";
4
4
 
5
5
  import { SidecarEnvironment } from "../../../compiler/internal/sharedHost/SidecarEnvironment";
6
+ import { workerModuleUrl } from "../../../internal/workerModuleUrl";
6
7
  import { PluginBuildEnvironmentWitness } from "./PluginBuildEnvironmentWitness";
7
8
  import { PluginContentIdentities } from "./PluginContentIdentities";
8
9
  import { pluginBuildEnvironment } from "./pluginBuildEnvironment";
@@ -24,7 +25,7 @@ import { pluginBuildEnvironment } from "./pluginBuildEnvironment";
24
25
  * @evidence contracts/common.md#clear-and-simple-design One owner shares observation records across synchronous reads, cache-only proof and asynchronous preparation.
25
26
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Cold preparation performs the same actual native Go/toolchain reading off-thread; failed or stale observations are never replaced by producer-expected state.
26
27
  * @evidence contracts/common.md#meaningful-documentation Native prose distinguishes preparation, publication and cache-only authority; members document their separate execution responsibilities.
27
- * @evidence contracts/portability.md#os-neutral-implementation Complete environment snapshots use the shared native-name merger; metadata witnesses preserve actual native filesystem and link identity.
28
+ * @evidence contracts/portability.md#os-neutral-implementation Complete environment snapshots use the shared native-name merger; metadata witnesses preserve actual native filesystem and link identity. A supported module URL requires the CommonJS source or emitted worker entry while Node retains inherited execution options and preload hooks.
28
29
  * @evidenceExclude contracts/performance.md#efficient-algorithms Individual members own variable indexing, witness validation and native preparation.
29
30
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work The members specify the invalidation and sharing boundaries.
30
31
  * @evidence contracts/performance.md#bound-retention-and-release-resources Readings replace existing keys but retain historical directory/environment keys without eviction. One idle worker and its retirement listeners remain process-owned/unreferenced; active work is ref'ed and per-request listeners are removed at settlement. Distinct requests can queue without a population bound/timeout; a stalled request can delay successors. Failed-worker termination is initiated without joining its promise, and this owner does not mutate the shared environment.
@@ -293,7 +294,12 @@ export namespace PluginBuildEnvironmentReadings {
293
294
  function acquireWorker(): Worker {
294
295
  if (worker !== undefined) return worker;
295
296
  const created = new Worker(
296
- path.join(__dirname, "pluginBuildEnvironmentWorker.js"),
297
+ workerModuleUrl(
298
+ path.join(
299
+ __dirname,
300
+ `pluginBuildEnvironmentWorker${path.extname(__filename)}`,
301
+ ),
302
+ ),
297
303
  { env: SHARE_ENV },
298
304
  );
299
305
  worker = created;
@@ -29,8 +29,7 @@ export interface ITtscCompilerContext {
29
29
  * The working directory for this compiler instance.
30
30
  *
31
31
  * Used to discover `tsconfig.json`, resolve relative `tsconfig` paths,
32
- * resolve project source files, resolve plugin packages, and resolve relative
33
- * cache paths.
32
+ * resolve project source files, and resolve relative cache paths.
34
33
  *
35
34
  * An omitted value uses `process.cwd()` when the operation resolves its
36
35
  * context; construction does not capture that default.
@@ -49,19 +48,20 @@ export interface ITtscCompilerContext {
49
48
  tsconfig?: string;
50
49
 
51
50
  /**
52
- * Project root override for generated config wrappers.
51
+ * Source root used for source membership, native plugin cwd and cache paths.
53
52
  *
54
- * Most callers should leave this unset so the project root is the directory
55
- * containing {@link ITtscCompilerContext.tsconfig}. Embedders that synthesize
56
- * a temporary config extending a real project config can set this to keep
57
- * plugin resolution, cache paths, and native plugin `--cwd` anchored to the
58
- * real project.
53
+ * Omission uses the resolved config directory. Set a common ancestor when the
54
+ * config includes sibling packages; relative paths resolve from cwd. Returned
55
+ * relative Go-source paths and descriptor process cwd also use this root.
56
+ * Plugin package resolution and factory contexts keep the selected config
57
+ * directory independently. Generated config wrappers supply the real consumer
58
+ * directory through pluginConfigDir and may retain a wider source root here.
59
59
  */
60
60
  projectRoot?: string;
61
61
 
62
62
  /**
63
- * Directory that anchors plugin config-file discovery and relative
64
- * `configFile` resolution.
63
+ * Consumer directory for plugin packages, factory contexts, plugin
64
+ * config-file discovery and relative `configFile` resolution.
65
65
  *
66
66
  * Leave this unset so plugins anchor at the directory of the resolved
67
67
  * {@link ITtscCompilerContext.tsconfig} as usual. Embedders that compile
@@ -89,8 +89,8 @@ export interface ITtscCompilerContext {
89
89
  binary?: string;
90
90
 
91
91
  /**
92
- * Additional environment variables for child compiler and plugin-descriptor
93
- * processes, and for the worker thread of
92
+ * Additional environment variables for executable selection, compiler and
93
+ * plugin-descriptor child processes, and for the worker thread of
94
94
  * {@link TtscCompiler.transformAsync}.
95
95
  *
96
96
  * The supplied overrides are copied at construction. Values are merged over
@@ -87,11 +87,13 @@ export interface ITtscPlugin {
87
87
  * linked into the selected native host and must register through
88
88
  * `driver.RegisterPlugin`.
89
89
  *
90
- * Relative paths are resolved from the consumer project root. Package
91
- * descriptors published in npm packages should normally return absolute paths
92
- * based on their own descriptor directory. Derive them from a factory's
93
- * `context.dirname` (the load-mode-independent replacement for `__dirname`,
94
- * which is undefined when ttsc loads the descriptor through ttsx or as ESM).
90
+ * Relative paths are resolved from the compiler's source root, including an
91
+ * explicit projectRoot override. This can differ from the factory's consumer
92
+ * directory for plugin package resolution. Package descriptors published in
93
+ * npm packages should normally return absolute paths based on their own
94
+ * descriptor directory. Derive them from a factory's `context.dirname` (the
95
+ * load-mode-independent replacement for `__dirname`, which is undefined when
96
+ * ttsc loads the descriptor through ttsx or as ESM).
95
97
  *
96
98
  * Common layouts:
97
99
  *
@@ -76,8 +76,8 @@ export interface ITtscPluginFactoryContext<T = ITtscProjectPluginConfig> {
76
76
  plugin: T;
77
77
 
78
78
  /**
79
- * Caller-declared anchor for plugin config-file discovery and relative
80
- * `configFile` resolution.
79
+ * Caller-declared consumer directory for plugin package discovery, factory
80
+ * contexts and relative `configFile` resolution.
81
81
  *
82
82
  * Absent for ordinary invocations, where a factory anchors config discovery
83
83
  * at the {@link ITtscPluginFactoryContext.tsconfig} directory. Present when
@@ -91,13 +91,14 @@ export interface ITtscPluginFactoryContext<T = ITtscProjectPluginConfig> {
91
91
  pluginConfigDir?: string;
92
92
 
93
93
  /**
94
- * Project root used as the native plugin working directory and package
95
- * discovery base.
94
+ * Consumer directory used for plugin package discovery.
96
95
  *
97
- * By default this is the directory containing the resolved tsconfig/jsconfig.
98
- * Callers may override it when a wrapper config lives outside the project.
99
- * Relative `source` paths returned by a plugin descriptor resolve from this
100
- * directory.
96
+ * This is pluginConfigDir when supplied, otherwise the directory containing
97
+ * the resolved tsconfig/jsconfig. A compiler projectRoot override can widen
98
+ * source membership without changing this package-resolution anchor.
99
+ * Descriptor process cwd, native plugin cwd and returned relative source
100
+ * paths retain the compiler's source root; return absolute source paths when
101
+ * those directories differ.
101
102
  */
102
103
  projectRoot: string;
103
104
 
@@ -42,10 +42,14 @@ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
42
42
  * this notification is not the complete compiler or project-rule input graph.
43
43
  * The reporting load also hands over its record store, if it opened one, so the
44
44
  * owner proves each root's state from the plugin cache's records instead of
45
- * reading the sources the load is about to prove (#1728).
45
+ * reading the sources the load is about to prove (#1728). Asynchronous build
46
+ * entries await a returned promise before reading or building those sources;
47
+ * synchronous entries require a synchronous handler. Separate function
48
+ * alternatives preserve TypeScript's void-handler assignability, including
49
+ * ignored non-promise return values.
46
50
  *
47
- * @evidence contracts/common.md#principled-implementation Readonly roots describe the actual native-plugin sources whose later edits need observation.
48
- * @evidence contracts/common.md#clear-and-simple-design A void notification leaves watcher construction and lifetime with the invocation owner.
51
+ * @evidence contracts/common.md#principled-implementation Readonly roots describe the actual native-plugin sources whose later edits need observation; separate void and Promise function alternatives preserve existing ignored-return callback assignability while exposing asynchronous completion.
52
+ * @evidence contracts/common.md#clear-and-simple-design The handoff leaves watcher construction and lifetime with the invocation owner, while its completion determines when the producer may continue.
49
53
  * @evidence contracts/common.md#prohibited-implementation-shortcuts The supported callback neither replaces foreign watchers nor fabricates fixture-specific roots.
50
54
  * @evidence contracts/common.md#meaningful-documentation Native prose states the source population and owner before acknowledgment tags.
51
55
  * @evidence contracts/portability.md#os-neutral-implementation Native source paths pass through without separator rewriting, alias collapse or an encoded OS-specific watcher.
@@ -53,16 +57,23 @@ export interface TtscSingleFileEmitOptions extends TtscCommonOptions {
53
57
  * @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
54
58
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
55
59
  */
56
- export type TtscPluginSourceInputsHandler = (
57
- inputs: readonly string[],
58
- identities?: PluginContentIdentities.Store,
59
- ) => void;
60
+ export type TtscPluginSourceInputsHandler =
61
+ | ((
62
+ inputs: readonly string[],
63
+ identities?: PluginContentIdentities.Store,
64
+ ) => void)
65
+ | ((
66
+ inputs: readonly string[],
67
+ identities?: PluginContentIdentities.Store,
68
+ ) => Promise<void>);
60
69
 
61
70
  /**
62
71
  * Receive the discovered project-rule filesystem topology for the watch owner.
72
+ * Asynchronous build entries await a returned promise before compilation;
73
+ * synchronous entries require a synchronous handler.
63
74
  *
64
75
  * @evidence contracts/common.md#principled-implementation The snapshot retains exact, glob and reload dependencies rather than reducing them to plugin-source roots.
65
- * @evidence contracts/common.md#clear-and-simple-design A separate void notification transfers topology without assigning watcher lifetime to the emit options.
76
+ * @evidence contracts/common.md#clear-and-simple-design A separate completion-bearing notification transfers topology without assigning watcher lifetime to the emit options.
66
77
  * @evidence contracts/common.md#prohibited-implementation-shortcuts A discovered rule snapshot crosses a supported boundary without replacing watcher internals or inventing passing inputs.
67
78
  * @evidence contracts/common.md#meaningful-documentation Native prose identifies the project-rule payload and watch owner before the separated tags.
68
79
  * @evidence contracts/portability.md#os-neutral-implementation The snapshot retains native paths, explicit glob grammar and declared versus physical identities without blanket case folding.
@@ -70,6 +81,6 @@ export type TtscPluginSourceInputsHandler = (
70
81
  * @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
71
82
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
72
83
  */
73
- export type TtscProjectInputsHandler = (
74
- inputs: ITtscProjectInputSnapshot,
75
- ) => void;
84
+ export type TtscProjectInputsHandler =
85
+ | ((inputs: ITtscProjectInputSnapshot) => void)
86
+ | ((inputs: ITtscProjectInputSnapshot) => Promise<void>);