@ttsc/unplugin 0.31.0 → 0.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/lib/core/bridge/projectRecordMoved.js +1 -1
  2. package/lib/core/bridge/projectRecordMoved.js.map +1 -1
  3. package/lib/core/bridge/projectRecordMoved.mjs +1 -1
  4. package/lib/core/bridge/projectRecordMoved.mjs.map +1 -1
  5. package/lib/core/bun/bun.d.cts +3 -2
  6. package/lib/core/bun/bun.d.mts +3 -2
  7. package/lib/core/bun/bun.d.ts +3 -2
  8. package/lib/core/bun/bun.js +8 -4
  9. package/lib/core/bun/bun.js.map +1 -1
  10. package/lib/core/bun/bun.mjs +8 -4
  11. package/lib/core/bun/bun.mjs.map +1 -1
  12. package/lib/core/observer/createInputObserver.js +7 -6
  13. package/lib/core/observer/createInputObserver.js.map +1 -1
  14. package/lib/core/observer/createInputObserver.mjs +7 -6
  15. package/lib/core/observer/createInputObserver.mjs.map +1 -1
  16. package/lib/core/observer/openIsolatedRecursiveWatch.d.cts +11 -12
  17. package/lib/core/observer/openIsolatedRecursiveWatch.d.mts +11 -12
  18. package/lib/core/observer/openIsolatedRecursiveWatch.d.ts +11 -12
  19. package/lib/core/observer/openIsolatedRecursiveWatch.js +11 -12
  20. package/lib/core/observer/openIsolatedRecursiveWatch.js.map +1 -1
  21. package/lib/core/observer/openIsolatedRecursiveWatch.mjs +11 -12
  22. package/lib/core/observer/openIsolatedRecursiveWatch.mjs.map +1 -1
  23. package/lib/core/transform/cache/TtscCachedProjectTransform.d.cts +12 -3
  24. package/lib/core/transform/cache/TtscCachedProjectTransform.d.mts +12 -3
  25. package/lib/core/transform/cache/TtscCachedProjectTransform.d.ts +12 -3
  26. package/lib/core/transform/cache/selectCachedGenerationAction.d.cts +2 -0
  27. package/lib/core/transform/cache/selectCachedGenerationAction.d.mts +2 -0
  28. package/lib/core/transform/cache/selectCachedGenerationAction.d.ts +2 -0
  29. package/lib/core/transform/cache/selectCachedGenerationAction.js +1 -1
  30. package/lib/core/transform/cache/selectCachedGenerationAction.js.map +1 -1
  31. package/lib/core/transform/cache/selectCachedGenerationAction.mjs +1 -1
  32. package/lib/core/transform/cache/selectCachedGenerationAction.mjs.map +1 -1
  33. package/lib/core/transform/deliverCachedTransform.d.cts +36 -0
  34. package/lib/core/transform/deliverCachedTransform.d.mts +36 -0
  35. package/lib/core/transform/deliverCachedTransform.d.ts +36 -0
  36. package/lib/core/transform/deliverCachedTransform.js +73 -0
  37. package/lib/core/transform/deliverCachedTransform.js.map +1 -0
  38. package/lib/core/transform/deliverCachedTransform.mjs +71 -0
  39. package/lib/core/transform/deliverCachedTransform.mjs.map +1 -0
  40. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.cts +2 -2
  41. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.mts +2 -2
  42. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.ts +2 -2
  43. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js +6 -2
  44. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js.map +1 -1
  45. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs +6 -2
  46. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs.map +1 -1
  47. package/lib/core/transform/envelope/selectExternalInputPaths.d.cts +3 -5
  48. package/lib/core/transform/envelope/selectExternalInputPaths.d.mts +3 -5
  49. package/lib/core/transform/envelope/selectExternalInputPaths.d.ts +3 -5
  50. package/lib/core/transform/envelope/selectExternalInputPaths.js +8 -7
  51. package/lib/core/transform/envelope/selectExternalInputPaths.js.map +1 -1
  52. package/lib/core/transform/envelope/selectExternalInputPaths.mjs +8 -7
  53. package/lib/core/transform/envelope/selectExternalInputPaths.mjs.map +1 -1
  54. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.cts +15 -12
  55. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.mts +15 -12
  56. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.ts +15 -12
  57. package/lib/core/transform/generation/captureFailedGenerationInputStates.js +1 -1
  58. package/lib/core/transform/generation/captureFailedGenerationInputStates.js.map +1 -1
  59. package/lib/core/transform/generation/captureFailedGenerationInputStates.mjs +1 -1
  60. package/lib/core/transform/generation/captureFailedGenerationInputStates.mjs.map +1 -1
  61. package/lib/core/transform/generation/captureTransformGeneration.js +1 -1
  62. package/lib/core/transform/generation/captureTransformGeneration.js.map +1 -1
  63. package/lib/core/transform/generation/captureTransformGeneration.mjs +1 -1
  64. package/lib/core/transform/generation/captureTransformGeneration.mjs.map +1 -1
  65. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.js +2 -2
  66. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.js.map +1 -1
  67. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.mjs +2 -2
  68. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.mjs.map +1 -1
  69. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.cts +3 -1
  70. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.mts +3 -1
  71. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.ts +3 -1
  72. package/lib/core/transform/generation/selectTransformAttemptDisposition.js +3 -1
  73. package/lib/core/transform/generation/selectTransformAttemptDisposition.js.map +1 -1
  74. package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs +3 -1
  75. package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs.map +1 -1
  76. package/lib/core/transform/generation/transformProject.d.cts +9 -7
  77. package/lib/core/transform/generation/transformProject.d.mts +9 -7
  78. package/lib/core/transform/generation/transformProject.d.ts +9 -7
  79. package/lib/core/transform/generation/transformProject.js +14 -9
  80. package/lib/core/transform/generation/transformProject.js.map +1 -1
  81. package/lib/core/transform/generation/transformProject.mjs +14 -9
  82. package/lib/core/transform/generation/transformProject.mjs.map +1 -1
  83. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.cts +9 -3
  84. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.mts +9 -3
  85. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.ts +9 -3
  86. package/lib/core/transform/inputs/pluginSourceFilesDigest.js +10 -4
  87. package/lib/core/transform/inputs/pluginSourceFilesDigest.js.map +1 -1
  88. package/lib/core/transform/inputs/pluginSourceFilesDigest.mjs +11 -5
  89. package/lib/core/transform/inputs/pluginSourceFilesDigest.mjs.map +1 -1
  90. package/lib/core/transform/inputs/pluginSourceHolds.d.cts +4 -2
  91. package/lib/core/transform/inputs/pluginSourceHolds.d.mts +4 -2
  92. package/lib/core/transform/inputs/pluginSourceHolds.d.ts +4 -2
  93. package/lib/core/transform/inputs/pluginSourceHolds.js +9 -4
  94. package/lib/core/transform/inputs/pluginSourceHolds.js.map +1 -1
  95. package/lib/core/transform/inputs/pluginSourceHolds.mjs +9 -4
  96. package/lib/core/transform/inputs/pluginSourceHolds.mjs.map +1 -1
  97. package/lib/core/transform/inputs/pluginSourceState.d.cts +3 -1
  98. package/lib/core/transform/inputs/pluginSourceState.d.mts +3 -1
  99. package/lib/core/transform/inputs/pluginSourceState.d.ts +3 -1
  100. package/lib/core/transform/inputs/pluginSourceState.js +8 -3
  101. package/lib/core/transform/inputs/pluginSourceState.js.map +1 -1
  102. package/lib/core/transform/inputs/pluginSourceState.mjs +8 -3
  103. package/lib/core/transform/inputs/pluginSourceState.mjs.map +1 -1
  104. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.cts +18 -5
  105. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.mts +18 -5
  106. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.ts +18 -5
  107. package/lib/core/transform/inputs/preparePluginBuildEnvironments.js +53 -12
  108. package/lib/core/transform/inputs/preparePluginBuildEnvironments.js.map +1 -1
  109. package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs +53 -12
  110. package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs.map +1 -1
  111. package/lib/core/transform/tracker/broker/WatchBroker.d.cts +14 -4
  112. package/lib/core/transform/tracker/broker/WatchBroker.d.mts +14 -4
  113. package/lib/core/transform/tracker/broker/WatchBroker.d.ts +14 -4
  114. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.cts +63 -0
  115. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.mts +63 -0
  116. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.ts +63 -0
  117. package/lib/core/transform/tracker/broker/WatchBrokerTransport.js +89 -0
  118. package/lib/core/transform/tracker/broker/WatchBrokerTransport.js.map +1 -0
  119. package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs +89 -0
  120. package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs.map +1 -0
  121. package/lib/core/transform/tracker/broker/drainWatchBroker.d.cts +8 -8
  122. package/lib/core/transform/tracker/broker/drainWatchBroker.d.mts +8 -8
  123. package/lib/core/transform/tracker/broker/drainWatchBroker.d.ts +8 -8
  124. package/lib/core/transform/tracker/broker/drainWatchBroker.js +12 -13
  125. package/lib/core/transform/tracker/broker/drainWatchBroker.js.map +1 -1
  126. package/lib/core/transform/tracker/broker/drainWatchBroker.mjs +12 -13
  127. package/lib/core/transform/tracker/broker/drainWatchBroker.mjs.map +1 -1
  128. package/lib/core/transform/tracker/broker/getWatchBroker.d.cts +18 -15
  129. package/lib/core/transform/tracker/broker/getWatchBroker.d.mts +18 -15
  130. package/lib/core/transform/tracker/broker/getWatchBroker.d.ts +18 -15
  131. package/lib/core/transform/tracker/broker/getWatchBroker.js +87 -17
  132. package/lib/core/transform/tracker/broker/getWatchBroker.js.map +1 -1
  133. package/lib/core/transform/tracker/broker/getWatchBroker.mjs +87 -17
  134. package/lib/core/transform/tracker/broker/getWatchBroker.mjs.map +1 -1
  135. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.cts +5 -5
  136. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.mts +5 -5
  137. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.ts +5 -5
  138. package/lib/core/transform/tracker/broker/openBrokeredWatch.js +11 -14
  139. package/lib/core/transform/tracker/broker/openBrokeredWatch.js.map +1 -1
  140. package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs +11 -14
  141. package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs.map +1 -1
  142. package/lib/core/transform/tracker/broker/usesWatchBroker.d.cts +7 -7
  143. package/lib/core/transform/tracker/broker/usesWatchBroker.d.mts +7 -7
  144. package/lib/core/transform/tracker/broker/usesWatchBroker.d.ts +7 -7
  145. package/lib/core/transform/tracker/broker/usesWatchBroker.js +7 -7
  146. package/lib/core/transform/tracker/broker/usesWatchBroker.mjs +7 -7
  147. package/lib/core/transform/tracker/broker/watchBrokerSource.d.cts +9 -10
  148. package/lib/core/transform/tracker/broker/watchBrokerSource.d.mts +9 -10
  149. package/lib/core/transform/tracker/broker/watchBrokerSource.d.ts +9 -10
  150. package/lib/core/transform/tracker/broker/watchBrokerSource.js +10 -11
  151. package/lib/core/transform/tracker/broker/watchBrokerSource.js.map +1 -1
  152. package/lib/core/transform/tracker/broker/watchBrokerSource.mjs +10 -11
  153. package/lib/core/transform/tracker/broker/watchBrokerSource.mjs.map +1 -1
  154. package/lib/core/transform/transformTtsc.d.cts +7 -4
  155. package/lib/core/transform/transformTtsc.d.mts +7 -4
  156. package/lib/core/transform/transformTtsc.d.ts +7 -4
  157. package/lib/core/transform/transformTtsc.js +38 -93
  158. package/lib/core/transform/transformTtsc.js.map +1 -1
  159. package/lib/core/transform/transformTtsc.mjs +38 -93
  160. package/lib/core/transform/transformTtsc.mjs.map +1 -1
  161. package/lib/core/transform/validation/TtscGenerationProof.d.cts +105 -0
  162. package/lib/core/transform/validation/TtscGenerationProof.d.mts +105 -0
  163. package/lib/core/transform/validation/TtscGenerationProof.d.ts +105 -0
  164. package/lib/core/transform/validation/TtscGenerationProof.js +149 -0
  165. package/lib/core/transform/validation/TtscGenerationProof.js.map +1 -0
  166. package/lib/core/transform/validation/TtscGenerationProof.mjs +149 -0
  167. package/lib/core/transform/validation/TtscGenerationProof.mjs.map +1 -0
  168. package/lib/core/transform/validation/captureUniversalHostInputValidation.js +2 -2
  169. package/lib/core/transform/validation/captureUniversalHostInputValidation.js.map +1 -1
  170. package/lib/core/transform/validation/captureUniversalHostInputValidation.mjs +2 -2
  171. package/lib/core/transform/validation/captureUniversalHostInputValidation.mjs.map +1 -1
  172. package/lib/core/transform/validation/matchesCachedSource.d.cts +18 -15
  173. package/lib/core/transform/validation/matchesCachedSource.d.mts +18 -15
  174. package/lib/core/transform/validation/matchesCachedSource.d.ts +18 -15
  175. package/lib/core/transform/validation/matchesCachedSource.js +28 -22
  176. package/lib/core/transform/validation/matchesCachedSource.js.map +1 -1
  177. package/lib/core/transform/validation/matchesCachedSource.mjs +28 -22
  178. package/lib/core/transform/validation/matchesCachedSource.mjs.map +1 -1
  179. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.cts +3 -2
  180. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.mts +3 -2
  181. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.ts +3 -2
  182. package/lib/core/transform/validation/matchesCompleteInputSnapshot.js +4 -4
  183. package/lib/core/transform/validation/matchesCompleteInputSnapshot.js.map +1 -1
  184. package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs +4 -4
  185. package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs.map +1 -1
  186. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.cts +2 -1
  187. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.mts +2 -1
  188. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.ts +2 -1
  189. package/lib/core/transform/validation/matchesNarrowPersistentInputs.js +2 -2
  190. package/lib/core/transform/validation/matchesNarrowPersistentInputs.js.map +1 -1
  191. package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs +2 -2
  192. package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs.map +1 -1
  193. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.cts +3 -2
  194. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.mts +3 -2
  195. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.ts +3 -2
  196. package/lib/core/transform/validation/matchesUniversalHostInputTrees.js +7 -5
  197. package/lib/core/transform/validation/matchesUniversalHostInputTrees.js.map +1 -1
  198. package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs +7 -5
  199. package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs.map +1 -1
  200. package/lib/core/transform/validation/matchesUniversalHostInputs.d.cts +3 -2
  201. package/lib/core/transform/validation/matchesUniversalHostInputs.d.mts +3 -2
  202. package/lib/core/transform/validation/matchesUniversalHostInputs.d.ts +3 -2
  203. package/lib/core/transform/validation/matchesUniversalHostInputs.js +5 -5
  204. package/lib/core/transform/validation/matchesUniversalHostInputs.js.map +1 -1
  205. package/lib/core/transform/validation/matchesUniversalHostInputs.mjs +5 -5
  206. package/lib/core/transform/validation/matchesUniversalHostInputs.mjs.map +1 -1
  207. package/lib/core/transform/validation/nativeInputPredicatesHold.d.cts +5 -4
  208. package/lib/core/transform/validation/nativeInputPredicatesHold.d.mts +5 -4
  209. package/lib/core/transform/validation/nativeInputPredicatesHold.d.ts +5 -4
  210. package/lib/core/transform/validation/nativeInputPredicatesHold.js +31 -12
  211. package/lib/core/transform/validation/nativeInputPredicatesHold.js.map +1 -1
  212. package/lib/core/transform/validation/nativeInputPredicatesHold.mjs +31 -12
  213. package/lib/core/transform/validation/nativeInputPredicatesHold.mjs.map +1 -1
  214. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.cts +2 -1
  215. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.mts +2 -1
  216. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.ts +2 -1
  217. package/lib/core/transform/validation/notificationsProveProgramUnchanged.js +2 -2
  218. package/lib/core/transform/validation/notificationsProveProgramUnchanged.js.map +1 -1
  219. package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs +2 -2
  220. package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs.map +1 -1
  221. package/lib/core/transform/watch/captureWatchInputBaseline.d.cts +4 -0
  222. package/lib/core/transform/watch/captureWatchInputBaseline.d.mts +4 -0
  223. package/lib/core/transform/watch/captureWatchInputBaseline.d.ts +4 -0
  224. package/lib/core/transform/watch/captureWatchInputBaseline.js +3 -0
  225. package/lib/core/transform/watch/captureWatchInputBaseline.js.map +1 -1
  226. package/lib/core/transform/watch/captureWatchInputBaseline.mjs +3 -0
  227. package/lib/core/transform/watch/captureWatchInputBaseline.mjs.map +1 -1
  228. package/lib/core/transform/watch/captureWatchInputBaselines.d.cts +2 -0
  229. package/lib/core/transform/watch/captureWatchInputBaselines.d.mts +2 -0
  230. package/lib/core/transform/watch/captureWatchInputBaselines.d.ts +2 -0
  231. package/lib/core/transform/watch/captureWatchInputBaselines.js +3 -1
  232. package/lib/core/transform/watch/captureWatchInputBaselines.js.map +1 -1
  233. package/lib/core/transform/watch/captureWatchInputBaselines.mjs +3 -1
  234. package/lib/core/transform/watch/captureWatchInputBaselines.mjs.map +1 -1
  235. package/lib/core/transform/watch/notifyWatchInputs.js +3 -0
  236. package/lib/core/transform/watch/notifyWatchInputs.js.map +1 -1
  237. package/lib/core/transform/watch/notifyWatchInputs.mjs +3 -0
  238. package/lib/core/transform/watch/notifyWatchInputs.mjs.map +1 -1
  239. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.cts +5 -2
  240. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.mts +5 -2
  241. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.ts +5 -2
  242. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.js +6 -3
  243. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.js.map +1 -1
  244. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.mjs +6 -3
  245. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.mjs.map +1 -1
  246. package/lib/core/turbopack/turbopack.js +2 -1
  247. package/lib/core/turbopack/turbopack.js.map +1 -1
  248. package/lib/core/turbopack/turbopack.mjs +2 -1
  249. package/lib/core/turbopack/turbopack.mjs.map +1 -1
  250. package/package.json +3 -3
  251. package/src/core/bridge/projectRecordMoved.ts +3 -1
  252. package/src/core/bun/bun.ts +8 -4
  253. package/src/core/observer/createInputObserver.ts +8 -5
  254. package/src/core/observer/openIsolatedRecursiveWatch.ts +11 -12
  255. package/src/core/transform/cache/TtscCachedProjectTransform.ts +13 -3
  256. package/src/core/transform/cache/selectCachedGenerationAction.ts +9 -1
  257. package/src/core/transform/deliverCachedTransform.ts +97 -0
  258. package/src/core/transform/envelope/selectDeclaredProjectInputKeys.ts +5 -2
  259. package/src/core/transform/envelope/selectExternalInputPaths.ts +7 -7
  260. package/src/core/transform/filesystem/TtscTransformFilesystemOperations.ts +15 -12
  261. package/src/core/transform/generation/captureFailedGenerationInputStates.ts +1 -0
  262. package/src/core/transform/generation/captureTransformGeneration.ts +6 -1
  263. package/src/core/transform/generation/failedGenerationEnvironmentChanged.ts +12 -2
  264. package/src/core/transform/generation/selectTransformAttemptDisposition.ts +3 -1
  265. package/src/core/transform/generation/transformProject.ts +13 -9
  266. package/src/core/transform/inputs/pluginSourceFilesDigest.ts +11 -4
  267. package/src/core/transform/inputs/pluginSourceHolds.ts +13 -3
  268. package/src/core/transform/inputs/pluginSourceState.ts +8 -2
  269. package/src/core/transform/inputs/preparePluginBuildEnvironments.ts +64 -11
  270. package/src/core/transform/tracker/broker/WatchBroker.ts +15 -4
  271. package/src/core/transform/tracker/broker/WatchBrokerTransport.ts +82 -0
  272. package/src/core/transform/tracker/broker/drainWatchBroker.ts +12 -13
  273. package/src/core/transform/tracker/broker/getWatchBroker.ts +89 -18
  274. package/src/core/transform/tracker/broker/openBrokeredWatch.ts +11 -14
  275. package/src/core/transform/tracker/broker/usesWatchBroker.ts +7 -7
  276. package/src/core/transform/tracker/broker/watchBrokerSource.ts +10 -11
  277. package/src/core/transform/transformTtsc.ts +38 -92
  278. package/src/core/transform/validation/TtscGenerationProof.ts +201 -0
  279. package/src/core/transform/validation/captureUniversalHostInputValidation.ts +2 -1
  280. package/src/core/transform/validation/matchesCachedSource.ts +27 -21
  281. package/src/core/transform/validation/matchesCompleteInputSnapshot.ts +5 -3
  282. package/src/core/transform/validation/matchesNarrowPersistentInputs.ts +3 -1
  283. package/src/core/transform/validation/matchesUniversalHostInputTrees.ts +8 -3
  284. package/src/core/transform/validation/matchesUniversalHostInputs.ts +6 -4
  285. package/src/core/transform/validation/nativeInputPredicatesHold.ts +36 -14
  286. package/src/core/transform/validation/notificationsProveProgramUnchanged.ts +3 -1
  287. package/src/core/transform/watch/captureWatchInputBaseline.ts +4 -0
  288. package/src/core/transform/watch/captureWatchInputBaselines.ts +7 -1
  289. package/src/core/transform/watch/notifyWatchInputs.ts +3 -0
  290. package/src/core/transform/watch/watchInputEvidenceMatchesDisk.ts +12 -2
  291. package/src/core/turbopack/turbopack.ts +2 -1
@@ -6,11 +6,11 @@ import type { WatchBroker } from "./WatchBroker";
6
6
  * caller-supplied watch capabilities can bypass it. Isolation has a reason on
7
7
  * each native backend:
8
8
  *
9
- * - Node's Windows fs-event backend can hit a native assertion that aborts the
10
- * whole process when a watched temporary tree is deleted. In the child that
11
- * crash becomes an ordinary exit that fails the affected trackers, and those
12
- * generations fall back to proving themselves from recorded state instead of
13
- * taking the host down.
9
+ * - Windows runs ttsc's native completion-port helper directly. Its directory
10
+ * filter excludes access-time notifications: reads must not masquerade as
11
+ * writes (#1719). Actual writes, metadata changes, native loss and failed
12
+ * coverage remain observable; equal bytes cannot erase an A-B-A event. No
13
+ * Node fs-event handle is opened in the host or an intermediate process.
14
14
  * - On macOS, libuv serves every directory watch of one event loop through a
15
15
  * single FSEventStream and re-creates it whenever any watch in that loop
16
16
  * opens or closes, losing the events in between (samchon/ttsc#1418), and it
@@ -19,10 +19,11 @@ import type { WatchBroker } from "./WatchBroker";
19
19
  * passes each drop on as a gap (samchon/ttsc#1425); see
20
20
  * {@link watchBrokerSource}.
21
21
  *
22
- * Registration/drain owners unreference the child and IPC channel after their
22
+ * Registration/drain owners unreference the child and its transport after their
23
23
  * outstanding acknowledgments finish; startup itself returns a referenced
24
- * child. Last-registration closure attempts disconnection and termination. This
25
- * accessor has no independent shutdown deadline or exit wait.
24
+ * child. Last-registration closure ends the request stream and attempts
25
+ * termination. This accessor has no independent shutdown deadline or exit
26
+ * wait.
26
27
  *
27
28
  * @evidence contracts/common.md#principled-implementation
28
29
  * Native watches run in a protocol child. Error/exit dispatch reports failure
@@ -38,13 +39,15 @@ import type { WatchBroker } from "./WatchBroker";
38
39
  * Native platform-reason list and lifecycle paragraph explain isolation and
39
40
  * process ownership under the documentation skill.
40
41
  * @evidence contracts/portability.md#os-neutral-implementation
41
- * OS-neutral startup uses this process's executable and argument-array spawn;
42
- * native FSEvents loading and platform differences remain in this boundary.
42
+ * Windows resolves the same ttsc binary as its compiler owner and uses the
43
+ * native __watch command; macOS uses this runtime and supported FSEvents.
44
+ * Argument-array spawn, hidden Windows processes and ordered transport stay
45
+ * inside this boundary.
43
46
  * @evidence contracts/performance.md#efficient-algorithms
44
- * A current-holder read is fixed work. Cold startup includes optional native
45
- * module resolution/warning, child source construction and native process/IPC
46
- * creation; resolution/path/source bytes and process startup cost do not
47
- * vanish into one spawn call. Failure visits R registrations and D drain
47
+ * A current-holder read is fixed work. Windows cold startup resolves the ttsc
48
+ * binary and opens native protocol pipes; macOS resolves the optional binding,
49
+ * reports missing capability and constructs its child program and IPC channel.
50
+ * Resolution/path/source bytes and native process startup cost remain real. Failure visits R registrations and D drain
48
51
  * callbacks, whose native/reference/sink work remains delegated; it does not
49
52
  * enumerate watched source trees.
50
53
  * Enabled private tracing serializes the actual executable/source argv and
@@ -56,7 +59,7 @@ import type { WatchBroker } from "./WatchBroker";
56
59
  * a health certificate; binding installation changes are not re-resolved
57
60
  * while it remains current, and sink exceptions can interrupt failure handling.
58
61
  * @evidence contracts/performance.md#bound-retention-and-release-resources
59
- * One current module holder retains a child and registration/drain maps;
62
+ * One current module holder retains a direct child and registration/drain maps;
60
63
  * those populations and caller-retained retired brokers have no cap here.
61
64
  * Request owners manage references/timers, and last closure attempts native
62
65
  * disconnection/kill rather than proving exit. Completed failure routing
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var readline = require('node:readline');
4
+ var binary = require('ttsc/binary');
3
5
  var traceProcessSpawn = require('../../../tracing/traceProcessSpawn.js');
4
6
  var WATCH_BROKER = require('./WATCH_BROKER.js');
5
7
  var fseventsBindingPath = require('./fseventsBindingPath.js');
@@ -14,11 +16,11 @@ var watchBrokerSource = require('./watchBrokerSource.js');
14
16
  * caller-supplied watch capabilities can bypass it. Isolation has a reason on
15
17
  * each native backend:
16
18
  *
17
- * - Node's Windows fs-event backend can hit a native assertion that aborts the
18
- * whole process when a watched temporary tree is deleted. In the child that
19
- * crash becomes an ordinary exit that fails the affected trackers, and those
20
- * generations fall back to proving themselves from recorded state instead of
21
- * taking the host down.
19
+ * - Windows runs ttsc's native completion-port helper directly. Its directory
20
+ * filter excludes access-time notifications: reads must not masquerade as
21
+ * writes (#1719). Actual writes, metadata changes, native loss and failed
22
+ * coverage remain observable; equal bytes cannot erase an A-B-A event. No
23
+ * Node fs-event handle is opened in the host or an intermediate process.
22
24
  * - On macOS, libuv serves every directory watch of one event loop through a
23
25
  * single FSEventStream and re-creates it whenever any watch in that loop
24
26
  * opens or closes, losing the events in between (samchon/ttsc#1418), and it
@@ -27,10 +29,11 @@ var watchBrokerSource = require('./watchBrokerSource.js');
27
29
  * passes each drop on as a gap (samchon/ttsc#1425); see
28
30
  * {@link watchBrokerSource}.
29
31
  *
30
- * Registration/drain owners unreference the child and IPC channel after their
32
+ * Registration/drain owners unreference the child and its transport after their
31
33
  * outstanding acknowledgments finish; startup itself returns a referenced
32
- * child. Last-registration closure attempts disconnection and termination. This
33
- * accessor has no independent shutdown deadline or exit wait.
34
+ * child. Last-registration closure ends the request stream and attempts
35
+ * termination. This accessor has no independent shutdown deadline or exit
36
+ * wait.
34
37
  *
35
38
  * @evidence contracts/common.md#principled-implementation
36
39
  * Native watches run in a protocol child. Error/exit dispatch reports failure
@@ -46,13 +49,15 @@ var watchBrokerSource = require('./watchBrokerSource.js');
46
49
  * Native platform-reason list and lifecycle paragraph explain isolation and
47
50
  * process ownership under the documentation skill.
48
51
  * @evidence contracts/portability.md#os-neutral-implementation
49
- * OS-neutral startup uses this process's executable and argument-array spawn;
50
- * native FSEvents loading and platform differences remain in this boundary.
52
+ * Windows resolves the same ttsc binary as its compiler owner and uses the
53
+ * native __watch command; macOS uses this runtime and supported FSEvents.
54
+ * Argument-array spawn, hidden Windows processes and ordered transport stay
55
+ * inside this boundary.
51
56
  * @evidence contracts/performance.md#efficient-algorithms
52
- * A current-holder read is fixed work. Cold startup includes optional native
53
- * module resolution/warning, child source construction and native process/IPC
54
- * creation; resolution/path/source bytes and process startup cost do not
55
- * vanish into one spawn call. Failure visits R registrations and D drain
57
+ * A current-holder read is fixed work. Windows cold startup resolves the ttsc
58
+ * binary and opens native protocol pipes; macOS resolves the optional binding,
59
+ * reports missing capability and constructs its child program and IPC channel.
60
+ * Resolution/path/source bytes and native process startup cost remain real. Failure visits R registrations and D drain
56
61
  * callbacks, whose native/reference/sink work remains delegated; it does not
57
62
  * enumerate watched source trees.
58
63
  * Enabled private tracing serializes the actual executable/source argv and
@@ -64,7 +69,7 @@ var watchBrokerSource = require('./watchBrokerSource.js');
64
69
  * a health certificate; binding installation changes are not re-resolved
65
70
  * while it remains current, and sink exceptions can interrupt failure handling.
66
71
  * @evidence contracts/performance.md#bound-retention-and-release-resources
67
- * One current module holder retains a child and registration/drain maps;
72
+ * One current module holder retains a direct child and registration/drain maps;
68
73
  * those populations and caller-retained retired brokers have no cap here.
69
74
  * Request owners manage references/timers, and last closure attempts native
70
75
  * disconnection/kill rather than proving exit. Completed failure routing
@@ -78,8 +83,14 @@ function getWatchBroker() {
78
83
  const fsevents = process.platform === "darwin" ? fseventsBindingPath.fseventsBindingPath() : undefined;
79
84
  if (fsevents === null)
80
85
  warnMissingFseventsBinding.warnMissingFseventsBinding();
81
- const child = traceProcessSpawn.traceProcessSpawn(process.execPath, ["-e", watchBrokerSource.watchBrokerSource(fsevents)], {
82
- stdio: ["ignore", "ignore", "ignore", "ipc"],
86
+ const native = process.platform === "win32";
87
+ const binary$1 = native ? binary.resolveBinary() : process.execPath;
88
+ if (binary$1 === null)
89
+ throw new Error("No ttsc native watch helper is available");
90
+ const child = traceProcessSpawn.traceProcessSpawn(binary$1, native ? ["__watch"] : ["-e", watchBrokerSource.watchBrokerSource(fsevents)], {
91
+ stdio: native
92
+ ? ["pipe", "pipe", "ignore"]
93
+ : ["ignore", "ignore", "ignore", "ipc"],
83
94
  windowsHide: true,
84
95
  });
85
96
  const broker = {
@@ -108,6 +119,65 @@ function getWatchBroker() {
108
119
  WATCH_BROKER.WATCH_BROKER.current = undefined;
109
120
  }
110
121
  };
122
+ if (native) {
123
+ // All Windows registrations share one direct native child. No Node watcher,
124
+ // nested child, global runtime patch, or access-time system change is needed.
125
+ const input = child.stdin;
126
+ const output = child.stdout;
127
+ if (input === null || output === null) {
128
+ child.kill();
129
+ throw new Error("The native watch helper has no protocol pipes");
130
+ }
131
+ broker.transport = {
132
+ send(message) {
133
+ if (input.destroyed || input.writableEnded)
134
+ return false;
135
+ // write(false) means buffered backpressure, not refusal. The callback
136
+ // reports a real transport failure to every still-live registration.
137
+ input.write(JSON.stringify(message) + "\n", (error) => {
138
+ if (error !== null && error !== undefined) {
139
+ fail();
140
+ child.kill();
141
+ }
142
+ });
143
+ return true;
144
+ },
145
+ reference(active) {
146
+ const pipe = output;
147
+ if (active) {
148
+ child.ref();
149
+ pipe.ref?.();
150
+ }
151
+ else {
152
+ child.unref();
153
+ pipe.unref?.();
154
+ }
155
+ },
156
+ close() {
157
+ input.end();
158
+ },
159
+ };
160
+ const lost = () => {
161
+ fail();
162
+ child.kill();
163
+ };
164
+ input.on("error", lost);
165
+ output.on("error", lost);
166
+ output.on("end", lost);
167
+ readline
168
+ .createInterface({ input: output, crlfDelay: Infinity })
169
+ .on("line", (line) => {
170
+ let message;
171
+ try {
172
+ message = JSON.parse(line);
173
+ }
174
+ catch {
175
+ lost();
176
+ return;
177
+ }
178
+ routeWatchBrokerMessage.routeWatchBrokerMessage(broker, message);
179
+ });
180
+ }
111
181
  child.on("error", fail);
112
182
  child.on("exit", fail);
113
183
  child.on("message", (message) => routeWatchBrokerMessage.routeWatchBrokerMessage(broker, message));
@@ -1 +1 @@
1
- {"version":3,"file":"getWatchBroker.js","sources":["../../../../../src/core/transform/tracker/broker/getWatchBroker.ts"],"sourcesContent":[null],"names":["WATCH_BROKER","fseventsBindingPath","warnMissingFseventsBinding","traceProcessSpawn","watchBrokerSource","routeWatchBrokerMessage"],"mappings":";;;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DG;SACa,cAAc,GAAA;AAC5B,IAAA,IAAIA,yBAAY,CAAC,OAAO,KAAK,SAAS,EAAE;QACtC,OAAOA,yBAAY,CAAC,OAAO;IAC7B;AACA,IAAA,MAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,KAAK,QAAQ,GAAGC,uCAAmB,EAAE,GAAG,SAAS;IACnE,IAAI,QAAQ,KAAK,IAAI;AAAE,QAAAC,qDAA0B,EAAE;AACnD,IAAA,MAAM,KAAK,GAAGC,mCAAiB,CAC7B,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAEC,mCAAiB,CAAC,QAAQ,CAAC,CAAC,EACnC;QACE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AAC5C,QAAA,WAAW,EAAE,IAAI;AAClB,KAAA,CACF;AACD,IAAA,MAAM,MAAM,GAAgB;QAC1B,KAAK;QACL,MAAM,EAAE,IAAI,GAAG,EAAE;AACjB,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,aAAa,EAAE,CAAC;AAChB,QAAA,oBAAoB,EAAE,CAAC;AACvB,QAAA,MAAM,EAAE,OAAO,QAAQ,KAAK,QAAQ;QACpC,aAAa,EAAE,IAAI,GAAG,EAAE;KACzB;IACD,MAAM,IAAI,GAAG,MAAW;QACtB,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE;AACxD,YAAA,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;YAC1B,YAAY,CAAC,KAAK,EAAE;QACtB;AACA,QAAA,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE;;;;;QAK5B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;YAAE,OAAO,CAAC,KAAK,CAAC;AAC5D,QAAA,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;AACrB,QAAA,IAAIJ,yBAAY,CAAC,OAAO,KAAK,MAAM,EAAE;AACnC,YAAAA,yBAAY,CAAC,OAAO,GAAG,SAAS;QAClC;AACF,IAAA,CAAC;AACD,IAAA,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC;AACvB,IAAA,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;AACtB,IAAA,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAgB,KACnCK,+CAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,CACzC;AACD,IAAAL,yBAAY,CAAC,OAAO,GAAG,MAAM;AAC7B,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"getWatchBroker.js","sources":["../../../../../src/core/transform/tracker/broker/getWatchBroker.ts"],"sourcesContent":[null],"names":["WATCH_BROKER","fseventsBindingPath","warnMissingFseventsBinding","binary","resolveBinary","traceProcessSpawn","watchBrokerSource","routeWatchBrokerMessage"],"mappings":";;;;;;;;;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1,3 +1,5 @@
1
+ import readline from 'node:readline';
2
+ import { resolveBinary } from 'ttsc/binary';
1
3
  import { traceProcessSpawn } from '../../../tracing/traceProcessSpawn.mjs';
2
4
  import { WATCH_BROKER } from './WATCH_BROKER.mjs';
3
5
  import { fseventsBindingPath } from './fseventsBindingPath.mjs';
@@ -12,11 +14,11 @@ import { watchBrokerSource } from './watchBrokerSource.mjs';
12
14
  * caller-supplied watch capabilities can bypass it. Isolation has a reason on
13
15
  * each native backend:
14
16
  *
15
- * - Node's Windows fs-event backend can hit a native assertion that aborts the
16
- * whole process when a watched temporary tree is deleted. In the child that
17
- * crash becomes an ordinary exit that fails the affected trackers, and those
18
- * generations fall back to proving themselves from recorded state instead of
19
- * taking the host down.
17
+ * - Windows runs ttsc's native completion-port helper directly. Its directory
18
+ * filter excludes access-time notifications: reads must not masquerade as
19
+ * writes (#1719). Actual writes, metadata changes, native loss and failed
20
+ * coverage remain observable; equal bytes cannot erase an A-B-A event. No
21
+ * Node fs-event handle is opened in the host or an intermediate process.
20
22
  * - On macOS, libuv serves every directory watch of one event loop through a
21
23
  * single FSEventStream and re-creates it whenever any watch in that loop
22
24
  * opens or closes, losing the events in between (samchon/ttsc#1418), and it
@@ -25,10 +27,11 @@ import { watchBrokerSource } from './watchBrokerSource.mjs';
25
27
  * passes each drop on as a gap (samchon/ttsc#1425); see
26
28
  * {@link watchBrokerSource}.
27
29
  *
28
- * Registration/drain owners unreference the child and IPC channel after their
30
+ * Registration/drain owners unreference the child and its transport after their
29
31
  * outstanding acknowledgments finish; startup itself returns a referenced
30
- * child. Last-registration closure attempts disconnection and termination. This
31
- * accessor has no independent shutdown deadline or exit wait.
32
+ * child. Last-registration closure ends the request stream and attempts
33
+ * termination. This accessor has no independent shutdown deadline or exit
34
+ * wait.
32
35
  *
33
36
  * @evidence contracts/common.md#principled-implementation
34
37
  * Native watches run in a protocol child. Error/exit dispatch reports failure
@@ -44,13 +47,15 @@ import { watchBrokerSource } from './watchBrokerSource.mjs';
44
47
  * Native platform-reason list and lifecycle paragraph explain isolation and
45
48
  * process ownership under the documentation skill.
46
49
  * @evidence contracts/portability.md#os-neutral-implementation
47
- * OS-neutral startup uses this process's executable and argument-array spawn;
48
- * native FSEvents loading and platform differences remain in this boundary.
50
+ * Windows resolves the same ttsc binary as its compiler owner and uses the
51
+ * native __watch command; macOS uses this runtime and supported FSEvents.
52
+ * Argument-array spawn, hidden Windows processes and ordered transport stay
53
+ * inside this boundary.
49
54
  * @evidence contracts/performance.md#efficient-algorithms
50
- * A current-holder read is fixed work. Cold startup includes optional native
51
- * module resolution/warning, child source construction and native process/IPC
52
- * creation; resolution/path/source bytes and process startup cost do not
53
- * vanish into one spawn call. Failure visits R registrations and D drain
55
+ * A current-holder read is fixed work. Windows cold startup resolves the ttsc
56
+ * binary and opens native protocol pipes; macOS resolves the optional binding,
57
+ * reports missing capability and constructs its child program and IPC channel.
58
+ * Resolution/path/source bytes and native process startup cost remain real. Failure visits R registrations and D drain
54
59
  * callbacks, whose native/reference/sink work remains delegated; it does not
55
60
  * enumerate watched source trees.
56
61
  * Enabled private tracing serializes the actual executable/source argv and
@@ -62,7 +67,7 @@ import { watchBrokerSource } from './watchBrokerSource.mjs';
62
67
  * a health certificate; binding installation changes are not re-resolved
63
68
  * while it remains current, and sink exceptions can interrupt failure handling.
64
69
  * @evidence contracts/performance.md#bound-retention-and-release-resources
65
- * One current module holder retains a child and registration/drain maps;
70
+ * One current module holder retains a direct child and registration/drain maps;
66
71
  * those populations and caller-retained retired brokers have no cap here.
67
72
  * Request owners manage references/timers, and last closure attempts native
68
73
  * disconnection/kill rather than proving exit. Completed failure routing
@@ -76,8 +81,14 @@ function getWatchBroker() {
76
81
  const fsevents = process.platform === "darwin" ? fseventsBindingPath() : undefined;
77
82
  if (fsevents === null)
78
83
  warnMissingFseventsBinding();
79
- const child = traceProcessSpawn(process.execPath, ["-e", watchBrokerSource(fsevents)], {
80
- stdio: ["ignore", "ignore", "ignore", "ipc"],
84
+ const native = process.platform === "win32";
85
+ const binary = native ? resolveBinary() : process.execPath;
86
+ if (binary === null)
87
+ throw new Error("No ttsc native watch helper is available");
88
+ const child = traceProcessSpawn(binary, native ? ["__watch"] : ["-e", watchBrokerSource(fsevents)], {
89
+ stdio: native
90
+ ? ["pipe", "pipe", "ignore"]
91
+ : ["ignore", "ignore", "ignore", "ipc"],
81
92
  windowsHide: true,
82
93
  });
83
94
  const broker = {
@@ -106,6 +117,65 @@ function getWatchBroker() {
106
117
  WATCH_BROKER.current = undefined;
107
118
  }
108
119
  };
120
+ if (native) {
121
+ // All Windows registrations share one direct native child. No Node watcher,
122
+ // nested child, global runtime patch, or access-time system change is needed.
123
+ const input = child.stdin;
124
+ const output = child.stdout;
125
+ if (input === null || output === null) {
126
+ child.kill();
127
+ throw new Error("The native watch helper has no protocol pipes");
128
+ }
129
+ broker.transport = {
130
+ send(message) {
131
+ if (input.destroyed || input.writableEnded)
132
+ return false;
133
+ // write(false) means buffered backpressure, not refusal. The callback
134
+ // reports a real transport failure to every still-live registration.
135
+ input.write(JSON.stringify(message) + "\n", (error) => {
136
+ if (error !== null && error !== undefined) {
137
+ fail();
138
+ child.kill();
139
+ }
140
+ });
141
+ return true;
142
+ },
143
+ reference(active) {
144
+ const pipe = output;
145
+ if (active) {
146
+ child.ref();
147
+ pipe.ref?.();
148
+ }
149
+ else {
150
+ child.unref();
151
+ pipe.unref?.();
152
+ }
153
+ },
154
+ close() {
155
+ input.end();
156
+ },
157
+ };
158
+ const lost = () => {
159
+ fail();
160
+ child.kill();
161
+ };
162
+ input.on("error", lost);
163
+ output.on("error", lost);
164
+ output.on("end", lost);
165
+ readline
166
+ .createInterface({ input: output, crlfDelay: Infinity })
167
+ .on("line", (line) => {
168
+ let message;
169
+ try {
170
+ message = JSON.parse(line);
171
+ }
172
+ catch {
173
+ lost();
174
+ return;
175
+ }
176
+ routeWatchBrokerMessage(broker, message);
177
+ });
178
+ }
109
179
  child.on("error", fail);
110
180
  child.on("exit", fail);
111
181
  child.on("message", (message) => routeWatchBrokerMessage(broker, message));
@@ -1 +1 @@
1
- {"version":3,"file":"getWatchBroker.mjs","sources":["../../../../../src/core/transform/tracker/broker/getWatchBroker.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DG;SACa,cAAc,GAAA;AAC5B,IAAA,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE;QACtC,OAAO,YAAY,CAAC,OAAO;IAC7B;AACA,IAAA,MAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,KAAK,QAAQ,GAAG,mBAAmB,EAAE,GAAG,SAAS;IACnE,IAAI,QAAQ,KAAK,IAAI;AAAE,QAAA,0BAA0B,EAAE;AACnD,IAAA,MAAM,KAAK,GAAG,iBAAiB,CAC7B,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EACnC;QACE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AAC5C,QAAA,WAAW,EAAE,IAAI;AAClB,KAAA,CACF;AACD,IAAA,MAAM,MAAM,GAAgB;QAC1B,KAAK;QACL,MAAM,EAAE,IAAI,GAAG,EAAE;AACjB,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,aAAa,EAAE,CAAC;AAChB,QAAA,oBAAoB,EAAE,CAAC;AACvB,QAAA,MAAM,EAAE,OAAO,QAAQ,KAAK,QAAQ;QACpC,aAAa,EAAE,IAAI,GAAG,EAAE;KACzB;IACD,MAAM,IAAI,GAAG,MAAW;QACtB,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE;AACxD,YAAA,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;YAC1B,YAAY,CAAC,KAAK,EAAE;QACtB;AACA,QAAA,MAAM,CAAC,aAA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;aACG,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE;AACtD,aAAA,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,KAAI;AACnB,YAAA,IAAI,OAAgB;AACpB,YAAA,IAAI;AACF,gBAAA,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY;YACvC;AAAE,YAAA,MAAM;AACN,gBAAA,IAAI,EAAE;gBACN;YACF;AACA,YAAA,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC;AAC1C,QAAA,CAAC,CAAC;IACN;AACA,IAAA,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC;AACvB,IAAA,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;AACtB,IAAA,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAgB,KACnC,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,CACzC;AACD,IAAA,YAAY,CAAC,OAAO,GAAG,MAAM;AAC7B,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -5,11 +5,11 @@ import type { WatchBrokerSink } from "./WatchBrokerSink.cjs";
5
5
  * Open directory watches in the isolated watch process for one sink, and report
6
6
  * when they hear.
7
7
  *
8
- * On Windows, Node's fs-event backend can assert in native code when a watched
9
- * temporary tree is deleted. Isolation turns that unrecoverable process abort
10
- * into an ordinary broker exit and a conservative fallback in the host. On
11
- * macOS, each registration's watches are streams of their own, started before
12
- * the child reports ready, and a dropped event reaches the sink as a gap
8
+ * On Windows, ttsc's native helper owns completion-port directory subscriptions
9
+ * and omits access-only notifications (#1719). Native loss and failure withdraw
10
+ * coverage; actual change events remain authoritative even after A-B-A writes.
11
+ * On macOS, each registration's watches are streams of their own, started
12
+ * before the child reports ready, and a dropped event reaches the sink as a gap
13
13
  * (samchon/ttsc#1425). A stream that can be probed reports ready only once its
14
14
  * opening probe came back through it; the child suppresses ordinary callbacks
15
15
  * received before that probe. This is its backend protocol, not a guarantee
@@ -5,11 +5,11 @@ import type { WatchBrokerSink } from "./WatchBrokerSink.mjs";
5
5
  * Open directory watches in the isolated watch process for one sink, and report
6
6
  * when they hear.
7
7
  *
8
- * On Windows, Node's fs-event backend can assert in native code when a watched
9
- * temporary tree is deleted. Isolation turns that unrecoverable process abort
10
- * into an ordinary broker exit and a conservative fallback in the host. On
11
- * macOS, each registration's watches are streams of their own, started before
12
- * the child reports ready, and a dropped event reaches the sink as a gap
8
+ * On Windows, ttsc's native helper owns completion-port directory subscriptions
9
+ * and omits access-only notifications (#1719). Native loss and failure withdraw
10
+ * coverage; actual change events remain authoritative even after A-B-A writes.
11
+ * On macOS, each registration's watches are streams of their own, started
12
+ * before the child reports ready, and a dropped event reaches the sink as a gap
13
13
  * (samchon/ttsc#1425). A stream that can be probed reports ready only once its
14
14
  * opening probe came back through it; the child suppresses ordinary callbacks
15
15
  * received before that probe. This is its backend protocol, not a guarantee
@@ -5,11 +5,11 @@ import type { WatchBrokerSink } from "./WatchBrokerSink";
5
5
  * Open directory watches in the isolated watch process for one sink, and report
6
6
  * when they hear.
7
7
  *
8
- * On Windows, Node's fs-event backend can assert in native code when a watched
9
- * temporary tree is deleted. Isolation turns that unrecoverable process abort
10
- * into an ordinary broker exit and a conservative fallback in the host. On
11
- * macOS, each registration's watches are streams of their own, started before
12
- * the child reports ready, and a dropped event reaches the sink as a gap
8
+ * On Windows, ttsc's native helper owns completion-port directory subscriptions
9
+ * and omits access-only notifications (#1719). Native loss and failure withdraw
10
+ * coverage; actual change events remain authoritative even after A-B-A writes.
11
+ * On macOS, each registration's watches are streams of their own, started
12
+ * before the child reports ready, and a dropped event reaches the sink as a gap
13
13
  * (samchon/ttsc#1425). A stream that can be probed reports ready only once its
14
14
  * opening probe came back through it; the child suppresses ordinary callbacks
15
15
  * received before that probe. This is its backend protocol, not a guarantee
@@ -5,6 +5,7 @@ var path = require('node:path');
5
5
  var WATCH_BROKER = require('./WATCH_BROKER.js');
6
6
  var WATCH_PROBE_DIRECTORY_PREFIX = require('./WATCH_PROBE_DIRECTORY_PREFIX.js');
7
7
  var WATCH_PROBE_TIMEOUT_MS = require('./WATCH_PROBE_TIMEOUT_MS.js');
8
+ var WatchBrokerTransport = require('./WatchBrokerTransport.js');
8
9
  var drainWatchBroker = require('./drainWatchBroker.js');
9
10
  var getWatchBroker = require('./getWatchBroker.js');
10
11
  var probeForLocation = require('./probeForLocation.js');
@@ -14,11 +15,11 @@ var sweepAbandonedWatchProbes = require('./sweepAbandonedWatchProbes.js');
14
15
  * Open directory watches in the isolated watch process for one sink, and report
15
16
  * when they hear.
16
17
  *
17
- * On Windows, Node's fs-event backend can assert in native code when a watched
18
- * temporary tree is deleted. Isolation turns that unrecoverable process abort
19
- * into an ordinary broker exit and a conservative fallback in the host. On
20
- * macOS, each registration's watches are streams of their own, started before
21
- * the child reports ready, and a dropped event reaches the sink as a gap
18
+ * On Windows, ttsc's native helper owns completion-port directory subscriptions
19
+ * and omits access-only notifications (#1719). Native loss and failure withdraw
20
+ * coverage; actual change events remain authoritative even after A-B-A writes.
21
+ * On macOS, each registration's watches are streams of their own, started
22
+ * before the child reports ready, and a dropped event reaches the sink as a gap
22
23
  * (samchon/ttsc#1425). A stream that can be probed reports ready only once its
23
24
  * opening probe came back through it; the child suppresses ordinary callbacks
24
25
  * received before that probe. This is its backend protocol, not a guarantee
@@ -125,10 +126,7 @@ function openBrokeredWatch(locations, options) {
125
126
  };
126
127
  });
127
128
  broker.pendingRegistrations += 1;
128
- broker.child.ref();
129
- // Bun's IPC channel omits Node's Control.ref/unref methods. The child itself
130
- // still owns the outstanding acknowledgement on that runtime.
131
- broker.child.channel?.ref?.();
129
+ WatchBrokerTransport.WatchBrokerTransport.reference(broker, true);
132
130
  const id = broker.nextId++;
133
131
  let resolveReady;
134
132
  const answered = new Promise((resolve) => {
@@ -149,7 +147,7 @@ function openBrokeredWatch(locations, options) {
149
147
  let failed = false;
150
148
  let failure;
151
149
  try {
152
- broker.child.send?.({ id, op: "remove" });
150
+ WatchBrokerTransport.WatchBrokerTransport.send(broker, { id, op: "remove" });
153
151
  }
154
152
  catch (error) {
155
153
  failed = true;
@@ -160,7 +158,7 @@ function openBrokeredWatch(locations, options) {
160
158
  WATCH_BROKER.WATCH_BROKER.current = undefined;
161
159
  }
162
160
  try {
163
- broker.child.disconnect?.();
161
+ WatchBrokerTransport.WatchBrokerTransport.close(broker);
164
162
  }
165
163
  catch (error) {
166
164
  if (!failed) {
@@ -181,7 +179,7 @@ function openBrokeredWatch(locations, options) {
181
179
  if (failed)
182
180
  throw failure;
183
181
  };
184
- broker.child.send?.({
182
+ WatchBrokerTransport.WatchBrokerTransport.send(broker, {
185
183
  allEvents: options.allEvents,
186
184
  locations: normalized,
187
185
  id,
@@ -214,8 +212,7 @@ function openBrokeredWatch(locations, options) {
214
212
  // a reply over an unreferenced channel lets the loop empty and the process
215
213
  // exit mid-build.
216
214
  if (broker.pendingRegistrations === 0 && broker.pendingDrains === 0) {
217
- broker.child.unref();
218
- broker.child.channel?.unref?.();
215
+ WatchBrokerTransport.WatchBrokerTransport.reference(broker, false);
219
216
  }
220
217
  });
221
218
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"openBrokeredWatch.js","sources":["../../../../../src/core/transform/tracker/broker/openBrokeredWatch.ts"],"sourcesContent":[null],"names":["getWatchBroker","probeForLocation","WATCH_BROKER","WATCH_PROBE_TIMEOUT_MS","drainWatchBroker","sweepAbandonedWatchProbes","WATCH_PROBE_DIRECTORY_PREFIX"],"mappings":";;;;;;;;;;;;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EG;AACG,SAAU,iBAAiB,CAC/B,SAAyC,EACzC,OAMC,EAAA;AAMD,IAAA,MAAM,MAAM,GAAGA,6BAAc,EAAE;;;;;;;AAO/B,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB;IAC3C,MAAM,UA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I,GAAG,EAAkB;AAEnD;;;;;;;;;AASG;AACH,SAAS,cAAc,CAAC,SAAiB,EAAA;IACvC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC;IACjD,IAAI,QAAQ,KAAK,SAAS;AAAE,QAAA,OAAO,QAAQ;AAC3C,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC;IACrE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzCC,mDAAyB,CAAC,MAAM,CAAC;AACjC,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CACzB,MAAM,EACN,CAAA,EAAGC,yDAA4B,GAAG,OAAO,CAAC,GAAG,CAAA,CAAE,CAChD;AACD,IAAA,IAAI,iBAAiB,CAAC,IAAI,KAAK,CAAC,EAAE;AAChC,QAAA,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAK;YACxB,KAAK,MAAM,MAAM,IAAI,iBAAiB,CAAC,MAAM,EAAE,EAAE;AAC/C,gBAAA,IAAI;AACF,oBAAA,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;gBACrD;AAAE,gBAAA,MAAM;;gBAER;YACF;AACF,QAAA,CAAC,CAAC;IACJ;AACA,IAAA,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC;AAC3C,IAAA,OAAO,SAAS;AAClB;;;;"}
1
+ {"version":3,"file":"openBrokeredWatch.js","sources":["../../../../../src/core/transform/tracker/broker/openBrokeredWatch.ts"],"sourcesContent":[null],"names":["getWatchBroker","probeForLocation","WatchBrokerTransport","WATCH_BROKER","WATCH_PROBE_TIMEOUT_MS","drainWatchBroker","sweepAbandonedWatchProbes","WATCH_PROBE_DIRECTORY_PREFIX"],"mapp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