@simplysm/sd-cli 14.0.29 → 14.0.32

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 (626) hide show
  1. package/dist/{utils → angular}/angular-build-pipeline.d.ts +0 -2
  2. package/dist/angular/angular-build-pipeline.d.ts.map +1 -0
  3. package/dist/{utils → angular}/angular-build-pipeline.js +3 -6
  4. package/dist/angular/angular-build-pipeline.js.map +1 -0
  5. package/dist/{utils → angular}/angular-build.d.ts +1 -1
  6. package/dist/angular/angular-build.d.ts.map +1 -0
  7. package/dist/{utils → angular}/angular-build.js +1 -1
  8. package/dist/angular/angular-build.js.map +1 -0
  9. package/dist/{utils → angular}/angular-compiler.d.ts +0 -3
  10. package/dist/angular/angular-compiler.d.ts.map +1 -0
  11. package/dist/{utils → angular}/angular-compiler.js +1 -45
  12. package/dist/angular/angular-compiler.js.map +1 -0
  13. package/dist/angular/client-transform-stylesheet.js +1 -1
  14. package/dist/angular/client-transform-stylesheet.js.map +1 -1
  15. package/dist/{utils → angular}/ngtsc-build-core.d.ts +3 -3
  16. package/dist/angular/ngtsc-build-core.d.ts.map +1 -0
  17. package/dist/angular/ngtsc-build-core.js.map +1 -0
  18. package/dist/angular/scss-compiler.d.ts.map +1 -0
  19. package/dist/angular/scss-compiler.js.map +1 -0
  20. package/dist/angular/vite-angular-plugin.d.ts +2 -10
  21. package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
  22. package/dist/angular/vite-angular-plugin.js +20 -286
  23. package/dist/angular/vite-angular-plugin.js.map +1 -1
  24. package/dist/capacitor/capacitor-build.d.ts +14 -0
  25. package/dist/capacitor/capacitor-build.d.ts.map +1 -0
  26. package/dist/capacitor/capacitor-build.js +105 -0
  27. package/dist/capacitor/capacitor-build.js.map +1 -0
  28. package/dist/capacitor/capacitor-config-writer.d.ts +11 -0
  29. package/dist/capacitor/capacitor-config-writer.d.ts.map +1 -0
  30. package/dist/capacitor/capacitor-config-writer.js +54 -0
  31. package/dist/capacitor/capacitor-config-writer.js.map +1 -0
  32. package/dist/capacitor/capacitor-icon.d.ts +5 -0
  33. package/dist/capacitor/capacitor-icon.d.ts.map +1 -0
  34. package/dist/capacitor/capacitor-icon.js +58 -0
  35. package/dist/capacitor/capacitor-icon.js.map +1 -0
  36. package/dist/capacitor/capacitor-npm-config.d.ts +11 -0
  37. package/dist/capacitor/capacitor-npm-config.d.ts.map +1 -0
  38. package/dist/capacitor/capacitor-npm-config.js +145 -0
  39. package/dist/capacitor/capacitor-npm-config.js.map +1 -0
  40. package/dist/capacitor/capacitor.d.ts +0 -45
  41. package/dist/capacitor/capacitor.d.ts.map +1 -1
  42. package/dist/capacitor/capacitor.js +15 -354
  43. package/dist/capacitor/capacitor.js.map +1 -1
  44. package/dist/commands/check.js +2 -2
  45. package/dist/commands/check.js.map +1 -1
  46. package/dist/commands/dev.d.ts +3 -3
  47. package/dist/commands/dev.d.ts.map +1 -1
  48. package/dist/commands/dev.js +3 -3
  49. package/dist/commands/dev.js.map +1 -1
  50. package/dist/commands/lint.d.ts +1 -1
  51. package/dist/commands/lint.d.ts.map +1 -1
  52. package/dist/commands/lint.js +1 -1
  53. package/dist/commands/lint.js.map +1 -1
  54. package/dist/commands/publish/deployment-phase.d.ts +12 -0
  55. package/dist/commands/publish/deployment-phase.d.ts.map +1 -0
  56. package/dist/commands/publish/deployment-phase.js +94 -0
  57. package/dist/commands/publish/deployment-phase.js.map +1 -0
  58. package/dist/commands/publish/env-utils.d.ts +10 -0
  59. package/dist/commands/publish/env-utils.d.ts.map +1 -0
  60. package/dist/commands/publish/env-utils.js +41 -0
  61. package/dist/commands/publish/env-utils.js.map +1 -0
  62. package/dist/commands/publish/git-phase.d.ts +12 -0
  63. package/dist/commands/publish/git-phase.d.ts.map +1 -0
  64. package/dist/commands/publish/git-phase.js +79 -0
  65. package/dist/commands/publish/git-phase.js.map +1 -0
  66. package/dist/commands/{publish.d.ts → publish/index.d.ts} +1 -1
  67. package/dist/commands/publish/index.d.ts.map +1 -0
  68. package/dist/commands/publish/index.js +211 -0
  69. package/dist/commands/publish/index.js.map +1 -0
  70. package/dist/commands/publish/local-publisher.d.ts +6 -0
  71. package/dist/commands/publish/local-publisher.d.ts.map +1 -0
  72. package/dist/commands/publish/local-publisher.js +16 -0
  73. package/dist/commands/publish/local-publisher.js.map +1 -0
  74. package/dist/commands/publish/npm-publisher.d.ts +6 -0
  75. package/dist/commands/publish/npm-publisher.d.ts.map +1 -0
  76. package/dist/commands/publish/npm-publisher.js +21 -0
  77. package/dist/commands/publish/npm-publisher.js.map +1 -0
  78. package/dist/commands/publish/post-publish-phase.d.ts +8 -0
  79. package/dist/commands/publish/post-publish-phase.d.ts.map +1 -0
  80. package/dist/commands/publish/post-publish-phase.js +34 -0
  81. package/dist/commands/publish/post-publish-phase.js.map +1 -0
  82. package/dist/commands/publish/storage-publisher.d.ts +18 -0
  83. package/dist/commands/publish/storage-publisher.d.ts.map +1 -0
  84. package/dist/commands/publish/storage-publisher.js +173 -0
  85. package/dist/commands/publish/storage-publisher.js.map +1 -0
  86. package/dist/commands/publish/version-upgrade.d.ts +28 -0
  87. package/dist/commands/publish/version-upgrade.d.ts.map +1 -0
  88. package/dist/commands/publish/version-upgrade.js +96 -0
  89. package/dist/commands/publish/version-upgrade.js.map +1 -0
  90. package/dist/commands/replace-deps.js +1 -1
  91. package/dist/commands/replace-deps.js.map +1 -1
  92. package/dist/commands/watch.d.ts +3 -4
  93. package/dist/commands/watch.d.ts.map +1 -1
  94. package/dist/commands/watch.js +3 -4
  95. package/dist/commands/watch.js.map +1 -1
  96. package/dist/deps/replace-deps/collect-deps.d.ts +6 -0
  97. package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -0
  98. package/dist/deps/replace-deps/collect-deps.js +71 -0
  99. package/dist/deps/replace-deps/collect-deps.js.map +1 -0
  100. package/dist/{utils/replace-deps.d.ts → deps/replace-deps/replace-deps-resolve.d.ts} +7 -24
  101. package/dist/deps/replace-deps/replace-deps-resolve.d.ts.map +1 -0
  102. package/dist/{utils/replace-deps.js → deps/replace-deps/replace-deps-resolve.js} +4 -152
  103. package/dist/deps/replace-deps/replace-deps-resolve.js.map +1 -0
  104. package/dist/deps/replace-deps/replace-deps.d.ts +36 -0
  105. package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -0
  106. package/dist/deps/replace-deps/replace-deps.js +155 -0
  107. package/dist/deps/replace-deps/replace-deps.js.map +1 -0
  108. package/dist/{utils → deps/server-externals}/server-production-files.d.ts +1 -1
  109. package/dist/deps/server-externals/server-production-files.d.ts.map +1 -0
  110. package/dist/{utils → deps/server-externals}/server-production-files.js +1 -1
  111. package/dist/deps/server-externals/server-production-files.js.map +1 -0
  112. package/dist/dev-server/dev-http-server.d.ts +23 -0
  113. package/dist/dev-server/dev-http-server.d.ts.map +1 -0
  114. package/dist/dev-server/dev-http-server.js +116 -0
  115. package/dist/dev-server/dev-http-server.js.map +1 -0
  116. package/dist/dev-server/hmr-client-script.d.ts +13 -0
  117. package/dist/dev-server/hmr-client-script.d.ts.map +1 -0
  118. package/dist/dev-server/hmr-client-script.js +73 -0
  119. package/dist/dev-server/hmr-client-script.js.map +1 -0
  120. package/dist/dev-server/hmr-service.d.ts +23 -0
  121. package/dist/dev-server/hmr-service.d.ts.map +1 -0
  122. package/dist/dev-server/hmr-service.js +139 -0
  123. package/dist/dev-server/hmr-service.js.map +1 -0
  124. package/dist/electron/electron.d.ts +5 -0
  125. package/dist/electron/electron.d.ts.map +1 -1
  126. package/dist/electron/electron.js +17 -24
  127. package/dist/electron/electron.js.map +1 -1
  128. package/dist/engines/BaseEngine.d.ts +18 -4
  129. package/dist/engines/BaseEngine.d.ts.map +1 -1
  130. package/dist/engines/BaseEngine.js +45 -66
  131. package/dist/engines/BaseEngine.js.map +1 -1
  132. package/dist/engines/{ViteEngine.d.ts → EsbuildClientEngine.d.ts} +11 -18
  133. package/dist/engines/EsbuildClientEngine.d.ts.map +1 -0
  134. package/dist/engines/{ViteEngine.js → EsbuildClientEngine.js} +28 -55
  135. package/dist/engines/EsbuildClientEngine.js.map +1 -0
  136. package/dist/engines/NgtscEngine.d.ts +2 -2
  137. package/dist/engines/NgtscEngine.d.ts.map +1 -1
  138. package/dist/engines/NgtscEngine.js +1 -9
  139. package/dist/engines/NgtscEngine.js.map +1 -1
  140. package/dist/engines/ServerEsbuildEngine.d.ts +2 -2
  141. package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
  142. package/dist/engines/ServerEsbuildEngine.js +1 -9
  143. package/dist/engines/ServerEsbuildEngine.js.map +1 -1
  144. package/dist/engines/TscEngine.d.ts +2 -2
  145. package/dist/engines/TscEngine.d.ts.map +1 -1
  146. package/dist/engines/TscEngine.js +1 -9
  147. package/dist/engines/TscEngine.js.map +1 -1
  148. package/dist/engines/index.d.ts +15 -5
  149. package/dist/engines/index.d.ts.map +1 -1
  150. package/dist/engines/index.js +21 -5
  151. package/dist/engines/index.js.map +1 -1
  152. package/dist/engines/types.d.ts +3 -3
  153. package/dist/engines/types.d.ts.map +1 -1
  154. package/dist/esbuild/esbuild-client-config.d.ts +38 -0
  155. package/dist/esbuild/esbuild-client-config.d.ts.map +1 -0
  156. package/dist/esbuild/esbuild-client-config.js +171 -0
  157. package/dist/esbuild/esbuild-client-config.js.map +1 -0
  158. package/dist/esbuild/esbuild-config.d.ts.map +1 -0
  159. package/dist/{utils → esbuild}/esbuild-config.js +1 -0
  160. package/dist/esbuild/esbuild-config.js.map +1 -0
  161. package/dist/esbuild/esbuild-index-html.d.ts +39 -0
  162. package/dist/esbuild/esbuild-index-html.d.ts.map +1 -0
  163. package/dist/esbuild/esbuild-index-html.js +68 -0
  164. package/dist/esbuild/esbuild-index-html.js.map +1 -0
  165. package/dist/esbuild/esbuild-pwa.d.ts +21 -0
  166. package/dist/esbuild/esbuild-pwa.d.ts.map +1 -0
  167. package/dist/esbuild/esbuild-pwa.js +105 -0
  168. package/dist/esbuild/esbuild-pwa.js.map +1 -0
  169. package/dist/esbuild/esbuild-scss-plugin.d.ts +6 -0
  170. package/dist/esbuild/esbuild-scss-plugin.d.ts.map +1 -0
  171. package/dist/esbuild/esbuild-scss-plugin.js +41 -0
  172. package/dist/esbuild/esbuild-scss-plugin.js.map +1 -0
  173. package/dist/lint/lint-core.d.ts.map +1 -0
  174. package/dist/lint/lint-core.js.map +1 -0
  175. package/dist/lint/lint-utils.d.ts.map +1 -0
  176. package/dist/lint/lint-utils.js.map +1 -0
  177. package/dist/lint/lint-with-program.d.ts.map +1 -0
  178. package/dist/lint/lint-with-program.js.map +1 -0
  179. package/dist/orchestrators/BaseOrchestrator.d.ts +44 -0
  180. package/dist/orchestrators/BaseOrchestrator.d.ts.map +1 -0
  181. package/dist/orchestrators/BaseOrchestrator.js +92 -0
  182. package/dist/orchestrators/BaseOrchestrator.js.map +1 -0
  183. package/dist/orchestrators/BuildOrchestrator.d.ts +45 -3
  184. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  185. package/dist/orchestrators/BuildOrchestrator.js +170 -143
  186. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  187. package/dist/orchestrators/DevOrchestrator.d.ts +39 -0
  188. package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -0
  189. package/dist/orchestrators/DevOrchestrator.js +249 -0
  190. package/dist/orchestrators/DevOrchestrator.js.map +1 -0
  191. package/dist/orchestrators/ServerRuntimeManager.d.ts +22 -0
  192. package/dist/orchestrators/ServerRuntimeManager.d.ts.map +1 -0
  193. package/dist/orchestrators/ServerRuntimeManager.js +66 -0
  194. package/dist/orchestrators/ServerRuntimeManager.js.map +1 -0
  195. package/dist/orchestrators/TypecheckOrchestrator.d.ts +17 -2
  196. package/dist/orchestrators/TypecheckOrchestrator.d.ts.map +1 -1
  197. package/dist/orchestrators/TypecheckOrchestrator.js +122 -108
  198. package/dist/orchestrators/TypecheckOrchestrator.js.map +1 -1
  199. package/dist/orchestrators/WatchOrchestrator.d.ts +33 -0
  200. package/dist/orchestrators/WatchOrchestrator.d.ts.map +1 -0
  201. package/dist/orchestrators/WatchOrchestrator.js +158 -0
  202. package/dist/orchestrators/WatchOrchestrator.js.map +1 -0
  203. package/dist/orchestrators/types.d.ts +17 -0
  204. package/dist/orchestrators/types.d.ts.map +1 -0
  205. package/dist/orchestrators/types.js +2 -0
  206. package/dist/orchestrators/types.js.map +1 -0
  207. package/dist/runtime/ResultCollector.d.ts.map +1 -0
  208. package/dist/runtime/ResultCollector.js.map +1 -0
  209. package/dist/runtime/SignalHandler.d.ts.map +1 -0
  210. package/dist/runtime/SignalHandler.js.map +1 -0
  211. package/dist/{utils → runtime}/engine-stop.d.ts +1 -1
  212. package/dist/runtime/engine-stop.d.ts.map +1 -0
  213. package/dist/{utils → runtime}/engine-stop.js +1 -1
  214. package/dist/runtime/engine-stop.js.map +1 -0
  215. package/dist/runtime/engine-watch-events.d.ts +43 -0
  216. package/dist/runtime/engine-watch-events.d.ts.map +1 -0
  217. package/dist/runtime/engine-watch-events.js +72 -0
  218. package/dist/runtime/engine-watch-events.js.map +1 -0
  219. package/dist/{utils → runtime}/rebuild-manager.d.ts +1 -0
  220. package/dist/runtime/rebuild-manager.d.ts.map +1 -0
  221. package/dist/{utils → runtime}/rebuild-manager.js +8 -1
  222. package/dist/runtime/rebuild-manager.js.map +1 -0
  223. package/dist/runtime/worker-events.d.ts +22 -0
  224. package/dist/runtime/worker-events.d.ts.map +1 -0
  225. package/dist/runtime/worker-events.js +2 -0
  226. package/dist/runtime/worker-events.js.map +1 -0
  227. package/dist/runtime/worker-utils.d.ts.map +1 -0
  228. package/dist/runtime/worker-utils.js.map +1 -0
  229. package/dist/sd-cli-entry.d.ts.map +1 -1
  230. package/dist/sd-cli-entry.js +61 -54
  231. package/dist/sd-cli-entry.js.map +1 -1
  232. package/dist/sd-cli.js +1 -1
  233. package/dist/sd-cli.js.map +1 -1
  234. package/dist/sd-config.types.d.ts +6 -15
  235. package/dist/sd-config.types.d.ts.map +1 -1
  236. package/dist/typecheck/typecheck-non-package.d.ts.map +1 -0
  237. package/dist/{utils → typecheck}/typecheck-non-package.js +1 -1
  238. package/dist/typecheck/typecheck-non-package.js.map +1 -0
  239. package/dist/typecheck/typecheck-serialization.d.ts.map +1 -0
  240. package/dist/typecheck/typecheck-serialization.js.map +1 -0
  241. package/dist/utils/diagnostic-utils.d.ts +5 -0
  242. package/dist/utils/diagnostic-utils.d.ts.map +1 -1
  243. package/dist/utils/diagnostic-utils.js +15 -0
  244. package/dist/utils/diagnostic-utils.js.map +1 -1
  245. package/dist/utils/orchestrator-utils.d.ts +1 -5
  246. package/dist/utils/orchestrator-utils.d.ts.map +1 -1
  247. package/dist/utils/orchestrator-utils.js +2 -5
  248. package/dist/utils/orchestrator-utils.js.map +1 -1
  249. package/dist/utils/output-utils.d.ts +1 -1
  250. package/dist/utils/output-utils.d.ts.map +1 -1
  251. package/dist/utils/package-classify.d.ts +54 -0
  252. package/dist/utils/package-classify.d.ts.map +1 -0
  253. package/dist/utils/package-classify.js +134 -0
  254. package/dist/utils/package-classify.js.map +1 -0
  255. package/dist/utils/package-utils.d.ts +1 -58
  256. package/dist/utils/package-utils.d.ts.map +1 -1
  257. package/dist/utils/package-utils.js +0 -193
  258. package/dist/utils/package-utils.js.map +1 -1
  259. package/dist/utils/tsc-build.d.ts +1 -1
  260. package/dist/utils/tsc-build.d.ts.map +1 -1
  261. package/dist/utils/tsc-build.js +1 -1
  262. package/dist/utils/tsc-build.js.map +1 -1
  263. package/dist/workers/build-change-filter.d.ts +8 -0
  264. package/dist/workers/build-change-filter.d.ts.map +1 -0
  265. package/dist/workers/build-change-filter.js +16 -0
  266. package/dist/workers/build-change-filter.js.map +1 -0
  267. package/dist/workers/build-watch-paths.d.ts +20 -0
  268. package/dist/workers/build-watch-paths.d.ts.map +1 -0
  269. package/dist/workers/build-watch-paths.js +29 -0
  270. package/dist/workers/build-watch-paths.js.map +1 -0
  271. package/dist/workers/client.worker.d.ts +11 -18
  272. package/dist/workers/client.worker.d.ts.map +1 -1
  273. package/dist/workers/client.worker.js +218 -289
  274. package/dist/workers/client.worker.js.map +1 -1
  275. package/dist/workers/library-build.worker.d.ts +2 -2
  276. package/dist/workers/library-build.worker.d.ts.map +1 -1
  277. package/dist/workers/library-build.worker.js +13 -24
  278. package/dist/workers/library-build.worker.js.map +1 -1
  279. package/dist/workers/lint.worker.d.ts +1 -1
  280. package/dist/workers/lint.worker.d.ts.map +1 -1
  281. package/dist/workers/lint.worker.js +1 -1
  282. package/dist/workers/lint.worker.js.map +1 -1
  283. package/dist/workers/ngtsc-build.worker.d.ts +1 -1
  284. package/dist/workers/ngtsc-build.worker.d.ts.map +1 -1
  285. package/dist/workers/ngtsc-build.worker.js +19 -35
  286. package/dist/workers/ngtsc-build.worker.js.map +1 -1
  287. package/dist/workers/server-build.worker.d.ts +2 -2
  288. package/dist/workers/server-build.worker.d.ts.map +1 -1
  289. package/dist/workers/server-build.worker.js +36 -137
  290. package/dist/workers/server-build.worker.js.map +1 -1
  291. package/dist/workers/server-esbuild-context.d.ts +47 -0
  292. package/dist/workers/server-esbuild-context.d.ts.map +1 -0
  293. package/dist/workers/server-esbuild-context.js +92 -0
  294. package/dist/workers/server-esbuild-context.js.map +1 -0
  295. package/dist/workers/server-runtime.worker.d.ts.map +1 -1
  296. package/dist/workers/server-runtime.worker.js +3 -1
  297. package/dist/workers/server-runtime.worker.js.map +1 -1
  298. package/dist/workers/server-watch-manager.d.ts +44 -0
  299. package/dist/workers/server-watch-manager.d.ts.map +1 -0
  300. package/dist/workers/server-watch-manager.js +87 -0
  301. package/dist/workers/server-watch-manager.js.map +1 -0
  302. package/dist/workers/shared-worker-lifecycle.d.ts +14 -0
  303. package/dist/workers/shared-worker-lifecycle.d.ts.map +1 -0
  304. package/dist/workers/shared-worker-lifecycle.js +17 -0
  305. package/dist/workers/shared-worker-lifecycle.js.map +1 -0
  306. package/package.json +9 -9
  307. package/src/{utils → angular}/angular-build-pipeline.ts +3 -8
  308. package/src/{utils → angular}/angular-build.ts +1 -1
  309. package/src/{utils → angular}/angular-compiler.ts +1 -64
  310. package/src/angular/client-transform-stylesheet.ts +1 -1
  311. package/src/{utils → angular}/ngtsc-build-core.ts +3 -3
  312. package/src/angular/vite-angular-plugin.ts +22 -355
  313. package/src/capacitor/capacitor-build.ts +142 -0
  314. package/src/capacitor/capacitor-config-writer.ts +66 -0
  315. package/src/capacitor/capacitor-icon.ts +75 -0
  316. package/src/capacitor/capacitor-npm-config.ts +192 -0
  317. package/src/capacitor/capacitor.ts +32 -441
  318. package/src/commands/check.ts +2 -2
  319. package/src/commands/dev.ts +6 -6
  320. package/src/commands/lint.ts +1 -1
  321. package/src/commands/publish/deployment-phase.ts +125 -0
  322. package/src/commands/publish/env-utils.ts +44 -0
  323. package/src/commands/publish/git-phase.ts +99 -0
  324. package/src/commands/publish/index.ts +266 -0
  325. package/src/commands/publish/local-publisher.ts +23 -0
  326. package/src/commands/publish/npm-publisher.ts +30 -0
  327. package/src/commands/publish/post-publish-phase.ts +43 -0
  328. package/src/commands/publish/storage-publisher.ts +208 -0
  329. package/src/commands/publish/version-upgrade.ts +132 -0
  330. package/src/commands/replace-deps.ts +1 -1
  331. package/src/commands/watch.ts +6 -7
  332. package/src/deps/replace-deps/collect-deps.ts +92 -0
  333. package/src/{utils/replace-deps.ts → deps/replace-deps/replace-deps-resolve.ts} +4 -188
  334. package/src/deps/replace-deps/replace-deps.ts +193 -0
  335. package/src/{utils → deps/server-externals}/server-production-files.ts +2 -2
  336. package/src/dev-server/dev-http-server.ts +149 -0
  337. package/src/dev-server/hmr-client-script.ts +74 -0
  338. package/src/dev-server/hmr-service.ts +178 -0
  339. package/src/electron/electron.ts +21 -28
  340. package/src/engines/BaseEngine.ts +64 -83
  341. package/src/engines/{ViteEngine.ts → EsbuildClientEngine.ts} +33 -72
  342. package/src/engines/NgtscEngine.ts +3 -11
  343. package/src/engines/ServerEsbuildEngine.ts +3 -11
  344. package/src/engines/TscEngine.ts +3 -11
  345. package/src/engines/index.ts +29 -9
  346. package/src/engines/types.ts +3 -3
  347. package/src/esbuild/esbuild-client-config.ts +230 -0
  348. package/src/{utils → esbuild}/esbuild-config.ts +1 -0
  349. package/src/esbuild/esbuild-index-html.ts +119 -0
  350. package/src/esbuild/esbuild-pwa.ts +139 -0
  351. package/src/esbuild/esbuild-scss-plugin.ts +48 -0
  352. package/src/orchestrators/BaseOrchestrator.ts +118 -0
  353. package/src/orchestrators/BuildOrchestrator.ts +234 -171
  354. package/src/orchestrators/DevOrchestrator.ts +315 -0
  355. package/src/orchestrators/ServerRuntimeManager.ts +85 -0
  356. package/src/orchestrators/TypecheckOrchestrator.ts +166 -117
  357. package/src/orchestrators/WatchOrchestrator.ts +203 -0
  358. package/src/orchestrators/types.ts +18 -0
  359. package/src/{utils → runtime}/engine-stop.ts +1 -1
  360. package/src/runtime/engine-watch-events.ts +121 -0
  361. package/src/{utils → runtime}/rebuild-manager.ts +8 -1
  362. package/src/runtime/worker-events.ts +25 -0
  363. package/src/sd-cli-entry.ts +69 -54
  364. package/src/sd-cli.ts +1 -1
  365. package/src/sd-config.types.ts +6 -16
  366. package/src/{utils → typecheck}/typecheck-non-package.ts +1 -1
  367. package/src/utils/diagnostic-utils.ts +15 -0
  368. package/src/utils/orchestrator-utils.ts +2 -6
  369. package/src/utils/output-utils.ts +1 -1
  370. package/src/utils/package-classify.ts +182 -0
  371. package/src/utils/package-utils.ts +0 -257
  372. package/src/utils/tsc-build.ts +1 -1
  373. package/src/workers/build-change-filter.ts +27 -0
  374. package/src/workers/build-watch-paths.ts +54 -0
  375. package/src/workers/client.worker.ts +258 -328
  376. package/src/workers/library-build.worker.ts +15 -34
  377. package/src/workers/lint.worker.ts +1 -1
  378. package/src/workers/ngtsc-build.worker.ts +19 -46
  379. package/src/workers/server-build.worker.ts +38 -168
  380. package/src/workers/server-esbuild-context.ts +122 -0
  381. package/src/workers/server-runtime.worker.ts +4 -1
  382. package/src/workers/server-watch-manager.ts +124 -0
  383. package/src/workers/shared-worker-lifecycle.ts +24 -0
  384. package/tests/angular/angular-build-pipeline.spec.ts +2 -2
  385. package/tests/angular/angular-compiler-aot.acc.spec.ts +68 -0
  386. package/tests/angular/angular-compiler-aot.spec.ts +80 -0
  387. package/tests/angular/angular-compiler-hmr-removal.verify.md +16 -0
  388. package/tests/angular/vite-angular-plugin-legacy-watch.spec.ts +0 -17
  389. package/tests/angular/vite-angular-plugin-vitest.spec.ts +1 -6
  390. package/tests/angular/vite-angular-plugin-vitest.verify.md +20 -0
  391. package/tests/angular/vite-angular-plugin.spec.ts +4 -178
  392. package/tests/capacitor/capacitor-android.spec.ts +1 -0
  393. package/tests/capacitor/capacitor-build.spec.ts +1 -0
  394. package/tests/capacitor/capacitor-config-writer.acc.spec.ts +108 -0
  395. package/tests/capacitor/capacitor-config-writer.spec.ts +95 -0
  396. package/tests/capacitor/capacitor-icon.spec.ts +1 -0
  397. package/tests/capacitor/capacitor-init.spec.ts +1 -0
  398. package/tests/capacitor/capacitor-npm-config.acc.spec.ts +236 -0
  399. package/tests/capacitor/capacitor-npm-config.spec.ts +132 -0
  400. package/tests/capacitor/capacitor-run.spec.ts +1 -0
  401. package/tests/capacitor/capacitor-workspace.spec.ts +1 -0
  402. package/tests/commands/check.spec.ts +2 -2
  403. package/tests/commands/deployment-phase.acc.spec.ts +142 -0
  404. package/tests/commands/git-phase.acc.spec.ts +158 -0
  405. package/tests/commands/lint.spec.ts +1 -1
  406. package/tests/commands/post-publish-phase.acc.spec.ts +82 -0
  407. package/tests/commands/publish-npm-local-split.verify.md +9 -0
  408. package/tests/commands/publish-responsibility-split.verify.md +13 -0
  409. package/tests/commands/publish-storage-split.verify.md +8 -0
  410. package/tests/commands/publish.spec.ts +1 -1
  411. package/tests/commands/typecheck.spec.ts +18 -18
  412. package/tests/deps/deps-directory-separation.verify.md +15 -0
  413. package/tests/engines/base-engine.spec.ts +65 -6
  414. package/tests/engines/engine-adapter-isolation.spec.ts +11 -18
  415. package/tests/engines/engine-selection.spec.ts +38 -5
  416. package/tests/engines/engine-typecheck-selection.acc.spec.ts +85 -0
  417. package/tests/engines/engine-typecheck-selection.verify.md +8 -0
  418. package/tests/engines/esbuild-client-engine.acc.spec.ts +161 -0
  419. package/tests/engines/esbuild-client-engine.spec.ts +320 -0
  420. package/tests/engines/esbuild-client-engine.verify.md +15 -0
  421. package/tests/engines/normalize-result.verify.md +9 -0
  422. package/tests/engines/vite-dependency-cleanup.verify.md +24 -0
  423. package/tests/orchestrators/build-orchestrator.spec.ts +3 -3
  424. package/tests/orchestrators/dev-orchestrator.spec.ts +799 -0
  425. package/tests/orchestrators/orchestrator-baseenv.verify.md +10 -0
  426. package/tests/orchestrators/orchestrator-diagnostic-formatting.verify.md +10 -0
  427. package/tests/orchestrators/orchestrator-initializemode-signature.verify.md +9 -0
  428. package/tests/orchestrators/typecheck-orchestrator.spec.ts +11 -11
  429. package/tests/orchestrators/watch-orchestrator.spec.ts +511 -0
  430. package/tests/{infra → runtime}/result-collector.spec.ts +1 -1
  431. package/tests/{infra → runtime}/signal-handler.spec.ts +1 -1
  432. package/tests/sd-cli-entry.spec.ts +9 -0
  433. package/tests/utils/angular-build.spec.ts +15 -20
  434. package/tests/utils/angular-compiler-emit.spec.ts +2 -2
  435. package/tests/utils/angular-compiler.spec.ts +2 -2
  436. package/tests/utils/angular-source-file-cache.spec.ts +2 -2
  437. package/tests/utils/concurrency.spec.ts +2 -10
  438. package/tests/utils/dev-http-server.acc.spec.ts +206 -0
  439. package/tests/utils/dev-http-server.spec.ts +181 -0
  440. package/tests/utils/dev-http-server.verify.md +8 -0
  441. package/tests/utils/diagnostic-utils.spec.ts +42 -1
  442. package/tests/utils/engine-stop.spec.ts +1 -1
  443. package/tests/utils/engine-watch-events.acc.spec.ts +217 -0
  444. package/tests/utils/engine-watch-events.spec.ts +141 -0
  445. package/tests/utils/engine-watch-events.verify.md +17 -0
  446. package/tests/utils/esbuild-client-config.acc.spec.ts +443 -0
  447. package/tests/utils/esbuild-client-config.spec.ts +590 -0
  448. package/tests/utils/esbuild-client-config.verify.md +26 -0
  449. package/tests/utils/esbuild-config.spec.ts +11 -1
  450. package/tests/utils/esbuild-index-html.acc.spec.ts +166 -0
  451. package/tests/utils/esbuild-index-html.spec.ts +194 -0
  452. package/tests/utils/esbuild-index-html.verify.md +10 -0
  453. package/tests/utils/esbuild-pwa.acc.spec.ts +203 -0
  454. package/tests/utils/esbuild-pwa.spec.ts +189 -0
  455. package/tests/utils/esbuild-pwa.verify.md +9 -0
  456. package/tests/utils/esbuild-scss-plugin.acc.spec.ts +111 -0
  457. package/tests/utils/esbuild-scss-plugin.spec.ts +150 -0
  458. package/tests/utils/esbuild-scss-plugin.verify.md +8 -0
  459. package/tests/utils/external-modules.spec.ts +1 -1
  460. package/tests/utils/hmr-client-script.acc.spec.ts +128 -0
  461. package/tests/utils/hmr-client-script.spec.ts +44 -0
  462. package/tests/utils/hmr-service-dispatcher.acc.spec.ts +217 -0
  463. package/tests/utils/hmr-service-dispatcher.spec.ts +143 -0
  464. package/tests/utils/hmr-service.acc.spec.ts +139 -0
  465. package/tests/utils/hmr-service.spec.ts +131 -0
  466. package/tests/utils/hmr-service.verify.md +17 -0
  467. package/tests/utils/lint-core.spec.ts +2 -1
  468. package/tests/utils/lint-utils.spec.ts +1 -1
  469. package/tests/utils/lint-with-program.spec.ts +1 -1
  470. package/tests/utils/ngtsc-build-core-write-emit.spec.ts +19 -19
  471. package/tests/utils/ngtsc-build-core.spec.ts +4 -4
  472. package/tests/utils/orchestrator-utils.spec.ts +2 -2
  473. package/tests/utils/output-utils.spec.ts +1 -1
  474. package/tests/utils/package-utils.spec.ts +1 -1
  475. package/tests/utils/rebuild-manager.spec.ts +20 -7
  476. package/tests/utils/replace-deps-split.verify.md +15 -0
  477. package/tests/utils/replace-deps-watch.acc.spec.ts +131 -0
  478. package/tests/utils/replace-deps-watch.spec.ts +91 -0
  479. package/tests/utils/replace-deps-watch.verify.md +9 -0
  480. package/tests/utils/replace-deps.spec.ts +1 -1
  481. package/tests/utils/scss-compiler.spec.ts +1 -1
  482. package/tests/utils/tsc-build.spec.ts +1 -1
  483. package/tests/utils/typecheck-non-package.spec.ts +2 -2
  484. package/tests/utils/worker-utils.spec.ts +2 -1
  485. package/tests/workers/build-change-filter.acc.spec.ts +78 -0
  486. package/tests/workers/build-change-filter.spec.ts +39 -0
  487. package/tests/workers/build-watch-paths-library.verify.md +10 -0
  488. package/tests/workers/build-watch-paths-ngtsc-server.verify.md +12 -0
  489. package/tests/workers/build-watch-paths.acc.spec.ts +101 -0
  490. package/tests/workers/build-watch-paths.spec.ts +121 -0
  491. package/tests/workers/client-worker-browser-support.verify.md +7 -0
  492. package/tests/workers/client-worker-onend-sync.verify.md +7 -0
  493. package/tests/workers/client-worker.acc.spec.ts +185 -0
  494. package/tests/workers/client-worker.spec.ts +91 -178
  495. package/tests/workers/library-build-lint.spec.ts +3 -3
  496. package/tests/workers/library-build-worker.spec.ts +10 -11
  497. package/tests/workers/ngtsc-build-lint.spec.ts +4 -4
  498. package/tests/workers/ngtsc-build-worker.spec.ts +2 -2
  499. package/tests/workers/server-build-lint.spec.ts +4 -4
  500. package/tests/workers/server-build-worker.spec.ts +14 -15
  501. package/tests/workers/server-esbuild-context-integration.verify.md +10 -0
  502. package/tests/workers/server-esbuild-context.acc.spec.ts +98 -0
  503. package/tests/workers/server-esbuild-context.spec.ts +198 -0
  504. package/tests/workers/server-runtime-worker.spec.ts +4 -3
  505. package/tests/workers/server-watch-manager.acc.spec.ts +162 -0
  506. package/tests/workers/server-watch-manager.spec.ts +199 -0
  507. package/tests/workers/shared-worker-lifecycle.acc.spec.ts +27 -0
  508. package/tests/workers/shared-worker-lifecycle.spec.ts +47 -0
  509. package/dist/angular/vite-postcss-inline-plugin.d.ts +0 -18
  510. package/dist/angular/vite-postcss-inline-plugin.d.ts.map +0 -1
  511. package/dist/angular/vite-postcss-inline-plugin.js +0 -108
  512. package/dist/angular/vite-postcss-inline-plugin.js.map +0 -1
  513. package/dist/commands/publish.d.ts.map +0 -1
  514. package/dist/commands/publish.js +0 -689
  515. package/dist/commands/publish.js.map +0 -1
  516. package/dist/engines/ViteEngine.d.ts.map +0 -1
  517. package/dist/engines/ViteEngine.js.map +0 -1
  518. package/dist/infra/ResultCollector.d.ts.map +0 -1
  519. package/dist/infra/ResultCollector.js.map +0 -1
  520. package/dist/infra/SignalHandler.d.ts.map +0 -1
  521. package/dist/infra/SignalHandler.js.map +0 -1
  522. package/dist/orchestrators/DevWatchOrchestrator.d.ts +0 -63
  523. package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +0 -1
  524. package/dist/orchestrators/DevWatchOrchestrator.js +0 -478
  525. package/dist/orchestrators/DevWatchOrchestrator.js.map +0 -1
  526. package/dist/utils/angular-build-pipeline.d.ts.map +0 -1
  527. package/dist/utils/angular-build-pipeline.js.map +0 -1
  528. package/dist/utils/angular-build.d.ts.map +0 -1
  529. package/dist/utils/angular-build.js.map +0 -1
  530. package/dist/utils/angular-compiler.d.ts.map +0 -1
  531. package/dist/utils/angular-compiler.js.map +0 -1
  532. package/dist/utils/engine-stop.d.ts.map +0 -1
  533. package/dist/utils/engine-stop.js.map +0 -1
  534. package/dist/utils/esbuild-config.d.ts.map +0 -1
  535. package/dist/utils/esbuild-config.js.map +0 -1
  536. package/dist/utils/hmr-candidates.d.ts +0 -15
  537. package/dist/utils/hmr-candidates.d.ts.map +0 -1
  538. package/dist/utils/hmr-candidates.js +0 -234
  539. package/dist/utils/hmr-candidates.js.map +0 -1
  540. package/dist/utils/lint-core.d.ts.map +0 -1
  541. package/dist/utils/lint-core.js.map +0 -1
  542. package/dist/utils/lint-utils.d.ts.map +0 -1
  543. package/dist/utils/lint-utils.js.map +0 -1
  544. package/dist/utils/lint-with-program.d.ts.map +0 -1
  545. package/dist/utils/lint-with-program.js.map +0 -1
  546. package/dist/utils/ngtsc-build-core.d.ts.map +0 -1
  547. package/dist/utils/ngtsc-build-core.js.map +0 -1
  548. package/dist/utils/rebuild-manager.d.ts.map +0 -1
  549. package/dist/utils/rebuild-manager.js.map +0 -1
  550. package/dist/utils/replace-deps.d.ts.map +0 -1
  551. package/dist/utils/replace-deps.js.map +0 -1
  552. package/dist/utils/scss-compiler.d.ts.map +0 -1
  553. package/dist/utils/scss-compiler.js.map +0 -1
  554. package/dist/utils/server-production-files.d.ts.map +0 -1
  555. package/dist/utils/server-production-files.js.map +0 -1
  556. package/dist/utils/typecheck-non-package.d.ts.map +0 -1
  557. package/dist/utils/typecheck-non-package.js.map +0 -1
  558. package/dist/utils/typecheck-serialization.d.ts.map +0 -1
  559. package/dist/utils/typecheck-serialization.js.map +0 -1
  560. package/dist/utils/vite-config.d.ts +0 -50
  561. package/dist/utils/vite-config.d.ts.map +0 -1
  562. package/dist/utils/vite-config.js +0 -242
  563. package/dist/utils/vite-config.js.map +0 -1
  564. package/dist/utils/vite-pwa-plugin.d.ts +0 -9
  565. package/dist/utils/vite-pwa-plugin.d.ts.map +0 -1
  566. package/dist/utils/vite-pwa-plugin.js +0 -139
  567. package/dist/utils/vite-pwa-plugin.js.map +0 -1
  568. package/dist/utils/vite-scope-watch-plugin.d.ts +0 -24
  569. package/dist/utils/vite-scope-watch-plugin.d.ts.map +0 -1
  570. package/dist/utils/vite-scope-watch-plugin.js +0 -51
  571. package/dist/utils/vite-scope-watch-plugin.js.map +0 -1
  572. package/dist/utils/worker-events.d.ts +0 -66
  573. package/dist/utils/worker-events.d.ts.map +0 -1
  574. package/dist/utils/worker-events.js +0 -55
  575. package/dist/utils/worker-events.js.map +0 -1
  576. package/dist/utils/worker-utils.d.ts.map +0 -1
  577. package/dist/utils/worker-utils.js.map +0 -1
  578. package/src/angular/vite-postcss-inline-plugin.ts +0 -139
  579. package/src/commands/publish.ts +0 -850
  580. package/src/orchestrators/DevWatchOrchestrator.ts +0 -594
  581. package/src/utils/hmr-candidates.ts +0 -327
  582. package/src/utils/vite-config.ts +0 -318
  583. package/src/utils/vite-pwa-plugin.ts +0 -168
  584. package/src/utils/vite-scope-watch-plugin.ts +0 -77
  585. package/src/utils/worker-events.ts +0 -128
  586. package/tests/angular/angular-compiler-hmr.spec.ts +0 -152
  587. package/tests/angular/hmr-candidates.spec.ts +0 -158
  588. package/tests/angular/linker-disk-cache.spec.ts +0 -171
  589. package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +0 -333
  590. package/tests/angular/vite-angular-plugin-hmr.spec.ts +0 -320
  591. package/tests/angular/vite-angular-plugin-scss-hmr.spec.ts +0 -95
  592. package/tests/angular/vite-postcss-inline-plugin.spec.ts +0 -60
  593. package/tests/engines/vite-engine.spec.ts +0 -409
  594. package/tests/orchestrators/dev-watch-orchestrator.spec.ts +0 -1542
  595. package/tests/utils/vite-config.spec.ts +0 -780
  596. package/tests/utils/vite-pwa-plugin.spec.ts +0 -401
  597. package/tests/utils/vite-scope-watch-plugin.spec.ts +0 -218
  598. package/tests/utils/worker-events.spec.ts +0 -147
  599. package/tests/workers/client-worker-legacy.spec.ts +0 -659
  600. /package/dist/{utils → angular}/ngtsc-build-core.js +0 -0
  601. /package/dist/{utils → angular}/scss-compiler.d.ts +0 -0
  602. /package/dist/{utils → angular}/scss-compiler.js +0 -0
  603. /package/dist/{utils → esbuild}/esbuild-config.d.ts +0 -0
  604. /package/dist/{utils → lint}/lint-core.d.ts +0 -0
  605. /package/dist/{utils → lint}/lint-core.js +0 -0
  606. /package/dist/{utils → lint}/lint-utils.d.ts +0 -0
  607. /package/dist/{utils → lint}/lint-utils.js +0 -0
  608. /package/dist/{utils → lint}/lint-with-program.d.ts +0 -0
  609. /package/dist/{utils → lint}/lint-with-program.js +0 -0
  610. /package/dist/{infra → runtime}/ResultCollector.d.ts +0 -0
  611. /package/dist/{infra → runtime}/ResultCollector.js +0 -0
  612. /package/dist/{infra → runtime}/SignalHandler.d.ts +0 -0
  613. /package/dist/{infra → runtime}/SignalHandler.js +0 -0
  614. /package/dist/{utils → runtime}/worker-utils.d.ts +0 -0
  615. /package/dist/{utils → runtime}/worker-utils.js +0 -0
  616. /package/dist/{utils → typecheck}/typecheck-non-package.d.ts +0 -0
  617. /package/dist/{utils → typecheck}/typecheck-serialization.d.ts +0 -0
  618. /package/dist/{utils → typecheck}/typecheck-serialization.js +0 -0
  619. /package/src/{utils → angular}/scss-compiler.ts +0 -0
  620. /package/src/{utils → lint}/lint-core.ts +0 -0
  621. /package/src/{utils → lint}/lint-utils.ts +0 -0
  622. /package/src/{utils → lint}/lint-with-program.ts +0 -0
  623. /package/src/{infra → runtime}/ResultCollector.ts +0 -0
  624. /package/src/{infra → runtime}/SignalHandler.ts +0 -0
  625. /package/src/{utils → runtime}/worker-utils.ts +0 -0
  626. /package/src/{utils → typecheck}/typecheck-serialization.ts +0 -0
@@ -2,12 +2,14 @@ import ts from "typescript";
2
2
  import { err as errNs } from "@simplysm/core-common";
3
3
  import { pathx } from "@simplysm/core-node";
4
4
  import { consola } from "consola";
5
- import { loadSdConfig } from "../utils/sd-config";
6
- import { deserializeDiagnostic } from "../utils/typecheck-serialization";
7
- import { createBuildEngine } from "../engines/index";
8
- import { typecheckNonPackageFiles } from "../utils/typecheck-non-package";
5
+ import { deserializeDiagnostic } from "../typecheck/typecheck-serialization";
6
+ import { createTypecheckEngine } from "../engines/index";
7
+ import { typecheckNonPackageFiles } from "../typecheck/typecheck-non-package";
9
8
  import { runWithConcurrency, getMaxConcurrency } from "../utils/concurrency";
10
9
  import { discoverWorkspacePackages, mergeTestsPackagesIntoConfig } from "../utils/package-utils";
10
+ import { loadAndValidateConfig } from "../utils/orchestrator-utils";
11
+ import { formatDiagnosticsOutput } from "../utils/diagnostic-utils";
12
+ import type { OrchestratorLifecycle } from "./types";
11
13
  import type { EngineResult } from "../engines/types";
12
14
  import type { TypecheckEnv } from "../utils/tsconfig";
13
15
  import { toTypecheckEnvs } from "../utils/tsconfig";
@@ -72,10 +74,10 @@ function extractTargetPackageNames(targets: string[]): Set<string> {
72
74
  /**
73
75
  * 타입체크를 조율하는 Orchestrator
74
76
  *
75
- * BuildOrchestrator/DevWatchOrchestrator와 동일한 initialize() → start() → shutdown() 생명주기를 따른다.
77
+ * BuildOrchestrator/WatchOrchestrator/DevOrchestrator와 동일한 initialize() → start() → shutdown() 생명주기를 따른다.
76
78
  * sd.config.ts 기반으로 패키지를 분류하고, BuildEngine을 사용하여 타입체크를 실행한다.
77
79
  */
78
- export class TypecheckOrchestrator {
80
+ export class TypecheckOrchestrator implements OrchestratorLifecycle<TypecheckResult> {
79
81
  private readonly _cwd: string;
80
82
  private readonly _options: TypecheckOptions;
81
83
  private readonly _logger = consola.withTag("sd:cli:typecheck");
@@ -104,8 +106,10 @@ export class TypecheckOrchestrator {
104
106
 
105
107
  this._logger.debug(`${phaseLabel} 시작`, { targets, lint: this._options.lint });
106
108
 
107
- // sd.config.ts 로드
108
- const sdConfig = await loadSdConfig({ cwd: this._cwd, dev: false, opt: this._options.options });
109
+ // sd.config.ts 로드 (targets=[] — check.ts에서 이미 검증 완료)
110
+ const sdConfig = await loadAndValidateConfig({
111
+ cwd: this._cwd, dev: false, options: this._options.options, targets: [],
112
+ });
109
113
  this._logger.debug("sd.config.ts 로드 완료");
110
114
 
111
115
  // 워크스페이스 패키지 탐색 및 tests/를 설정에 병합
@@ -131,15 +135,12 @@ export class TypecheckOrchestrator {
131
135
  if (targets.length > 0 && !targetNames.has(name)) continue;
132
136
 
133
137
  const relPath = pathMap.get(name) ?? `packages/${name}`;
134
- // 클라이언트 패키지의 경우 browser 타겟을 사용하여 createBuildEngine이 ViteEngine 대신 NgtscEngine으로 라우팅되도록 함
135
- const typecheckConfig =
136
- config.target === "client" ? { target: "browser" as const } : config;
137
138
  const envs = toTypecheckEnvs(config.target);
138
139
  for (const env of envs) {
139
140
  this._typecheckTasks.push({
140
141
  name,
141
142
  dir: pathx.posixResolve(this._cwd, relPath),
142
- config: typecheckConfig,
143
+ config,
143
144
  env,
144
145
  });
145
146
  }
@@ -159,11 +160,6 @@ export class TypecheckOrchestrator {
159
160
  */
160
161
  async start(): Promise<TypecheckResult> {
161
162
  const phaseLabel = this._options.lint === true ? "타입체크/린트" : "타입체크";
162
- const formatHost: ts.FormatDiagnosticsHost = {
163
- getCanonicalFileName: (f) => f,
164
- getCurrentDirectory: () => this._cwd,
165
- getNewLine: () => ts.sys.newLine,
166
- };
167
163
 
168
164
  if (this._typecheckTasks.length === 0 && !this._includeNonPackage) {
169
165
  this._logger.info(`${phaseLabel} 대상 없음`);
@@ -177,123 +173,180 @@ export class TypecheckOrchestrator {
177
173
  };
178
174
  }
179
175
 
180
- // 동시성 제한이 있는 BuildEngine 작업 생성
176
+ const fileCache = new Map<string, string>();
177
+ const packageResults = await this._executePackageTypechecks(fileCache, phaseLabel);
178
+ const nonPkgResults = this._executeNonPackageTypecheck(fileCache);
179
+ return this._aggregateTypecheckResults(packageResults, nonPkgResults, phaseLabel);
180
+ }
181
+
182
+ /**
183
+ * 패키지 타입체크 실행
184
+ * - 엔진 생성 및 동시성 제어된 실행
185
+ * - 결과 역직렬화 및 집계
186
+ */
187
+ private async _executePackageTypechecks(
188
+ fileCache: Map<string, string>,
189
+ phaseLabel: string,
190
+ ): Promise<{
191
+ allDiagnostics: ts.Diagnostic[];
192
+ totalErrorCount: number;
193
+ totalWarningCount: number;
194
+ lintErrorCount: number;
195
+ lintWarningCount: number;
196
+ lintSuccess: boolean;
197
+ lintOutputs: string[];
198
+ }> {
181
199
  const allDiagnostics: ts.Diagnostic[] = [];
182
200
  let totalErrorCount = 0;
183
201
  let totalWarningCount = 0;
184
- const fileCache = new Map<string, string>();
185
-
186
- // Lint 결과 집계
187
202
  let lintErrorCount = 0;
188
203
  let lintWarningCount = 0;
189
204
  let lintSuccess = true;
190
205
  const lintOutputs: string[] = [];
191
206
 
192
- if (this._typecheckTasks.length > 0) {
193
- const tasks = this._typecheckTasks.map((task) => async (): Promise<EngineResult> => {
194
- const label = `${task.name}:${task.env}`;
195
- const engine = createBuildEngine(
196
- { name: task.name, dir: task.dir, config: task.config },
197
- { cwd: this._cwd },
207
+ if (this._typecheckTasks.length === 0) {
208
+ return { allDiagnostics, totalErrorCount, totalWarningCount, lintErrorCount, lintWarningCount, lintSuccess, lintOutputs };
209
+ }
210
+
211
+ const tasks = this._typecheckTasks.map((task) => async (): Promise<EngineResult> => {
212
+ const label = `${task.name}:${task.env}`;
213
+ const engine = createTypecheckEngine(
214
+ { name: task.name, dir: task.dir, config: task.config },
215
+ { cwd: this._cwd },
216
+ );
217
+ try {
218
+ this._logger.debug(`[${label}] 타입체크 시작됨`);
219
+ const result = await engine.run({
220
+ js: false,
221
+ dts: false,
222
+ env: task.env,
223
+ includeTests: true,
224
+ ...(this._options.lint === true ? { lint: true } : {}),
225
+ });
226
+ this._logger.debug(
227
+ `[${label}] 타입체크 ${result.build.success ? "완료" : "실패"}`,
198
228
  );
199
- try {
200
- this._logger.debug(`[${label}] 타입체크 시작됨`);
201
- const result = await engine.run({
202
- js: false,
203
- dts: false,
204
- env: task.env,
205
- includeTests: true,
206
- ...(this._options.lint === true ? { lint: true } : {}),
207
- });
208
- this._logger.debug(
209
- `[${label}] 타입체크 ${result.build.success ? "완료" : "실패"}`,
210
- );
211
- return result;
212
- } catch (err) {
213
- const message = errNs.message(err);
214
- const stack = err instanceof Error ? err.stack : undefined;
215
- this._logger.error(`[${label}] 엔진 작업 실패: ${message}`);
216
- if (stack != null) {
217
- this._logger.debug(`[${label}] 스택 트레이스:\n${stack}`);
218
- }
219
- return {
220
- build: {
221
- success: false,
222
- errors: [`[${label}] ${message}`],
223
- warnings: [],
224
- diagnostics: [],
225
- },
226
- };
227
- } finally {
228
- await engine.stop();
229
+ return result;
230
+ } catch (err) {
231
+ const message = errNs.message(err);
232
+ const stack = err instanceof Error ? err.stack : undefined;
233
+ this._logger.error(`[${label}] 엔진 작업 실패: ${message}`);
234
+ if (stack != null) {
235
+ this._logger.debug(`[${label}] 스택 트레이스:\n${stack}`);
229
236
  }
230
- });
237
+ return {
238
+ build: {
239
+ success: false,
240
+ errors: [`[${label}] ${message}`],
241
+ warnings: [],
242
+ diagnostics: [],
243
+ },
244
+ };
245
+ } finally {
246
+ await engine.stop();
247
+ }
248
+ });
231
249
 
232
- const concurrency = getMaxConcurrency();
233
- this._logger.start(
234
- `${phaseLabel} 실행 중... (${tasks.length}개 작업, 동시성: ${concurrency})`,
250
+ const concurrency = getMaxConcurrency();
251
+ this._logger.start(
252
+ `${phaseLabel} 실행 중... (${tasks.length}개 작업, 동시성: ${concurrency})`,
253
+ );
254
+ const results = await runWithConcurrency(tasks, concurrency);
255
+ this._logger.success(`${phaseLabel} 실행 완료`);
256
+
257
+ // 엔진 결과 집계 (모든 task는 catch로 인해 항상 fulfilled)
258
+ for (const settled of results) {
259
+ if (settled.status !== "fulfilled") continue;
260
+ const engineResult = settled.value;
261
+ const buildDiags = engineResult.build.diagnostics.map((d) =>
262
+ deserializeDiagnostic(d, fileCache),
235
263
  );
236
- const results = await runWithConcurrency(tasks, concurrency);
237
- this._logger.success(`${phaseLabel} 실행 완료`);
238
-
239
- // 엔진 결과 집계 (모든 task는 catch로 인해 항상 fulfilled)
240
- for (const settled of results) {
241
- if (settled.status !== "fulfilled") continue;
242
- const engineResult = settled.value;
243
- const buildDiags = engineResult.build.diagnostics.map((d) =>
244
- deserializeDiagnostic(d, fileCache),
245
- );
246
- allDiagnostics.push(...buildDiags);
247
- // 역직렬화된 진단 정보에서 에러/경고 수 집계
248
- // 숫자 카테고리 값 사용 (ts.DiagnosticCategory: Error=1, Warning=0)
249
- totalErrorCount += buildDiags.filter((d) => d.category === 1).length;
250
- totalWarningCount += buildDiags.filter((d) => d.category === 0).length;
251
- if (!engineResult.build.success && buildDiags.length === 0) {
252
- for (const errMsg of engineResult.build.errors) {
253
- allDiagnostics.push({
254
- category: 1,
255
- code: 0,
256
- messageText: errMsg,
257
- file: undefined,
258
- start: undefined,
259
- length: undefined,
260
- });
261
- }
262
- totalErrorCount += engineResult.build.errors.length || 1;
264
+ allDiagnostics.push(...buildDiags);
265
+ totalErrorCount += buildDiags.filter((d) => d.category === 1).length;
266
+ totalWarningCount += buildDiags.filter((d) => d.category === 0).length;
267
+ if (!engineResult.build.success && buildDiags.length === 0) {
268
+ for (const errMsg of engineResult.build.errors) {
269
+ allDiagnostics.push({
270
+ category: 1,
271
+ code: 0,
272
+ messageText: errMsg,
273
+ file: undefined,
274
+ start: undefined,
275
+ length: undefined,
276
+ });
263
277
  }
278
+ totalErrorCount += engineResult.build.errors.length || 1;
279
+ }
264
280
 
265
- // Lint 결과 수집
266
- if (engineResult.lint != null) {
267
- lintErrorCount += engineResult.lint.errorCount;
268
- lintWarningCount += engineResult.lint.warningCount;
269
- if (!engineResult.lint.success) lintSuccess = false;
270
- if (engineResult.lint.formattedOutput !== "") {
271
- lintOutputs.push(engineResult.lint.formattedOutput);
272
- }
281
+ if (engineResult.lint != null) {
282
+ lintErrorCount += engineResult.lint.errorCount;
283
+ lintWarningCount += engineResult.lint.warningCount;
284
+ if (!engineResult.lint.success) lintSuccess = false;
285
+ if (engineResult.lint.formattedOutput !== "") {
286
+ lintOutputs.push(engineResult.lint.formattedOutput);
273
287
  }
274
288
  }
275
289
  }
276
290
 
277
- // 비패키지 타입체크
278
- if (this._includeNonPackage) {
279
- this._logger.debug("비패키지 타입체크 실행 중");
280
- const nonPkgResult = typecheckNonPackageFiles(this._cwd);
281
- totalErrorCount += nonPkgResult.errorCount;
282
- totalWarningCount += nonPkgResult.warningCount;
283
- const nonPkgDiags = nonPkgResult.diagnostics.map((d) =>
284
- deserializeDiagnostic(d, fileCache),
285
- );
286
- allDiagnostics.push(...nonPkgDiags);
291
+ return { allDiagnostics, totalErrorCount, totalWarningCount, lintErrorCount, lintWarningCount, lintSuccess, lintOutputs };
292
+ }
293
+
294
+ /**
295
+ * 비패키지 타입체크 실행 (sd.config.ts에 없는 루트 파일들)
296
+ */
297
+ private _executeNonPackageTypecheck(fileCache: Map<string, string>): {
298
+ diagnostics: ts.Diagnostic[];
299
+ errorCount: number;
300
+ warningCount: number;
301
+ } {
302
+ if (!this._includeNonPackage) {
303
+ return { diagnostics: [], errorCount: 0, warningCount: 0 };
287
304
  }
288
305
 
306
+ this._logger.debug("비패키지 타입체크 실행 중");
307
+ const nonPkgResult = typecheckNonPackageFiles(this._cwd);
308
+ const diagnostics = nonPkgResult.diagnostics.map((d) =>
309
+ deserializeDiagnostic(d, fileCache),
310
+ );
311
+ return {
312
+ diagnostics,
313
+ errorCount: nonPkgResult.errorCount,
314
+ warningCount: nonPkgResult.warningCount,
315
+ };
316
+ }
317
+
318
+ /**
319
+ * 타입체크 결과 집계 및 포맷 출력 생성
320
+ */
321
+ private _aggregateTypecheckResults(
322
+ packageResults: {
323
+ allDiagnostics: ts.Diagnostic[];
324
+ totalErrorCount: number;
325
+ totalWarningCount: number;
326
+ lintErrorCount: number;
327
+ lintWarningCount: number;
328
+ lintSuccess: boolean;
329
+ lintOutputs: string[];
330
+ },
331
+ nonPkgResults: {
332
+ diagnostics: ts.Diagnostic[];
333
+ errorCount: number;
334
+ warningCount: number;
335
+ },
336
+ phaseLabel: string,
337
+ ): TypecheckResult {
338
+ const allDiagnostics = [...packageResults.allDiagnostics, ...nonPkgResults.diagnostics];
339
+ const totalErrorCount = packageResults.totalErrorCount + nonPkgResults.errorCount;
340
+ const totalWarningCount = packageResults.totalWarningCount + nonPkgResults.warningCount;
341
+
289
342
  // 요약 로그
290
343
  const resultMeta: Record<string, number> = {
291
344
  errorCount: totalErrorCount,
292
345
  warningCount: totalWarningCount,
293
346
  };
294
347
  if (this._options.lint === true) {
295
- resultMeta["lintErrorCount"] = lintErrorCount;
296
- resultMeta["lintWarningCount"] = lintWarningCount;
348
+ resultMeta["lintErrorCount"] = packageResults.lintErrorCount;
349
+ resultMeta["lintWarningCount"] = packageResults.lintWarningCount;
297
350
  }
298
351
  if (totalErrorCount > 0) {
299
352
  this._logger.error(`${phaseLabel} 에러 발생`, resultMeta);
@@ -302,20 +355,16 @@ export class TypecheckOrchestrator {
302
355
  }
303
356
 
304
357
  // 진단 출력 포매팅
305
- let formattedOutput = "";
306
- if (allDiagnostics.length > 0) {
307
- const uniqueDiagnostics = ts.sortAndDeduplicateDiagnostics(allDiagnostics);
308
- formattedOutput = ts.formatDiagnosticsWithColorAndContext(uniqueDiagnostics, formatHost);
309
- }
358
+ const formattedOutput = formatDiagnosticsOutput(allDiagnostics, this._cwd);
310
359
 
311
360
  // lint가 요청된 경우 lint 결과 생성
312
361
  const lintResult =
313
362
  this._options.lint === true
314
363
  ? {
315
- success: lintSuccess,
316
- errorCount: lintErrorCount,
317
- warningCount: lintWarningCount,
318
- formattedOutput: lintOutputs.join("\n"),
364
+ success: packageResults.lintSuccess,
365
+ errorCount: packageResults.lintErrorCount,
366
+ warningCount: packageResults.lintWarningCount,
367
+ formattedOutput: packageResults.lintOutputs.join("\n"),
319
368
  }
320
369
  : undefined;
321
370
 
@@ -0,0 +1,203 @@
1
+ import { spawn, type ChildProcess } from "child_process";
2
+ import { FsWatcher, pathx } from "@simplysm/core-node";
3
+ import type {
4
+ SdBuildPackageConfig,
5
+ SdConfig,
6
+ SdScriptsPackageConfig,
7
+ } from "../sd-config.types";
8
+ import { filterPackagesByTargets, classifyWatchPackages } from "../utils/package-classify";
9
+ import { printErrors } from "../utils/output-utils";
10
+ import { createBuildEngine, type BuildEngine, type BuildPackageInfo } from "../engines/index";
11
+ import { watchCopySrcFiles } from "../utils/copy-src";
12
+ import { BaseOrchestrator } from "./BaseOrchestrator";
13
+ import type { OrchestratorLifecycle } from "./types";
14
+
15
+ /**
16
+ * WatchOrchestrator 옵션
17
+ */
18
+ export interface WatchOrchestratorOptions {
19
+ targets: string[];
20
+ options: string[];
21
+ }
22
+
23
+ /**
24
+ * watch 모드 전용 Orchestrator
25
+ *
26
+ * 라이브러리(JS+DTS) + Scripts(watch hook) + copySrc + replaceDeps 감시
27
+ */
28
+ export class WatchOrchestrator extends BaseOrchestrator implements OrchestratorLifecycle {
29
+ private readonly _options: WatchOrchestratorOptions;
30
+
31
+ // watch 전용 상태
32
+ private readonly _libraryEngines: BuildEngine[] = [];
33
+ private _libraryPackages: BuildPackageInfo[] = [];
34
+ private _watchHookPackages: Array<{ name: string; dir: string; config: SdScriptsPackageConfig | SdBuildPackageConfig }> = [];
35
+ private _copySrcWatchers: FsWatcher[] = [];
36
+ private _distDeleteWatchers: FsWatcher[] = [];
37
+ private readonly _watchHookWatchers: FsWatcher[] = [];
38
+ private readonly _watchHookChildren = new Map<string, ChildProcess>();
39
+
40
+ constructor(options: WatchOrchestratorOptions) {
41
+ super("sd:cli:watch");
42
+ this._options = options;
43
+ }
44
+
45
+ override async initialize(): Promise<void> {
46
+ await super.initialize({
47
+ targets: this._options.targets,
48
+ options: this._options.options,
49
+ dev: true,
50
+ });
51
+ }
52
+
53
+ protected _initializeMode(
54
+ config: SdConfig,
55
+ targets: string[],
56
+ ): void {
57
+ // 대상으로 필터링
58
+ const allPackages = filterPackagesByTargets(config.packages, targets);
59
+
60
+ // watch 모드 패키지 분류
61
+ const classified = classifyWatchPackages(allPackages, this._cwd, this._pathMap);
62
+ this._libraryPackages = classified.libraryPackages;
63
+ this._watchHookPackages = classified.watchHookPackages;
64
+
65
+ // 처리할 패키지가 있는지 확인
66
+ const totalPackages = this._libraryPackages.length + this._watchHookPackages.length;
67
+ if (totalPackages === 0) {
68
+ process.stdout.write("⚠ 워치 대상 패키지가 없습니다.\n");
69
+ return;
70
+ }
71
+
72
+ this._hasPackages = true;
73
+ }
74
+
75
+ protected _initializeEngines(_config: SdConfig): void {
76
+ // 배치 완료 핸들러 등록
77
+ this._rebuildManager.on("batchComplete", (_completedKeys) => {
78
+ printErrors(this._resultCollector.toMap());
79
+ });
80
+
81
+ // 라이브러리 패키지용 BuildEngine 생성
82
+ for (const pkg of this._libraryPackages) {
83
+ const engine = createBuildEngine(pkg, {
84
+ cwd: this._cwd,
85
+ replaceDeps: this._replaceDeps,
86
+ resultCollector: this._resultCollector,
87
+ rebuildManager: this._rebuildManager,
88
+ });
89
+ this._libraryEngines.push(engine);
90
+ }
91
+ }
92
+
93
+ async start(): Promise<void> {
94
+ if (!this._hasPackages) {
95
+ this._logger.debug("대상 패키지 없음, start 건너뜀");
96
+ return;
97
+ }
98
+ this._logger.debug("watch 모드 시작");
99
+
100
+ // 라이브러리 패키지 dist 삭제 감지 워처
101
+ for (const pkg of this._libraryPackages) {
102
+ const distDir = pathx.posixResolve(pkg.dir, "dist");
103
+ const watcher = await FsWatcher.watch([distDir]);
104
+ watcher.onChange({ delay: 100 }, (changes) => {
105
+ for (const c of changes) {
106
+ if (c.event === "unlink" || c.event === "unlinkDir") {
107
+ this._logger.error(`[dist-delete:${pkg.name}] ${c.event}: ${c.path}\n${new Error().stack}`);
108
+ }
109
+ }
110
+ });
111
+ this._distDeleteWatchers.push(watcher);
112
+ }
113
+
114
+ // Start copySrc watchers for library packages
115
+ for (const pkg of this._libraryPackages) {
116
+ if (pkg.config.copySrc != null && pkg.config.copySrc.length > 0) {
117
+ const watcher = await watchCopySrcFiles(pkg.dir, pkg.config.copySrc);
118
+ this._copySrcWatchers.push(watcher);
119
+ }
120
+ }
121
+
122
+ // Start all engines
123
+ const total = this._libraryEngines.length;
124
+ this._logger.start(`초기 빌드 실행 중... (${total}개 패키지)`);
125
+ let completed = 0;
126
+
127
+ const watchPromises = this._libraryEngines.map(async (engine, i) => {
128
+ const pkgName = this._libraryPackages[i].name;
129
+ await engine.startWatch({ js: true, dts: true, lint: false });
130
+ completed++;
131
+ this._logger.info(` [${completed}/${total}] ${pkgName} 완료`);
132
+ });
133
+
134
+ await Promise.allSettled(watchPromises);
135
+ this._logger.success("초기 빌드 실행 완료");
136
+
137
+ // Print initial build results
138
+ printErrors(this._resultCollector.toMap());
139
+
140
+ // Start watch hook watchers for scripts+watch packages
141
+ for (const pkg of this._watchHookPackages) {
142
+ const watchConfig = pkg.config.watch!;
143
+ const watchTargets = watchConfig.target.map((t) => pathx.posixResolve(pkg.dir, t));
144
+
145
+ // Run initial hook
146
+ this._runWatchHookCmd(pkg.name, pkg.dir, watchConfig.cmd, watchConfig.args);
147
+
148
+ // Start watching
149
+ const watcher = await FsWatcher.watch(watchTargets);
150
+ watcher.onChange({ delay: 300 }, () => {
151
+ this._runWatchHookCmd(pkg.name, pkg.dir, watchConfig.cmd, watchConfig.args);
152
+ });
153
+ this._watchHookWatchers.push(watcher);
154
+
155
+ this._logger.success(`워치 훅 시작됨: ${pkg.name}`);
156
+ }
157
+ }
158
+
159
+ protected async _shutdownMode(): Promise<void> {
160
+ const shutdownTasks: Array<Promise<void>> = [];
161
+
162
+ // 모든 엔진 중지
163
+ shutdownTasks.push(...this._libraryEngines.map((e) => e.stop()));
164
+
165
+ // 워처 종료
166
+ shutdownTasks.push(...this._copySrcWatchers.map((w) => w.close()));
167
+ shutdownTasks.push(...this._distDeleteWatchers.map((w) => w.close()));
168
+ shutdownTasks.push(...this._watchHookWatchers.map((w) => w.close()));
169
+
170
+ // hook 자식 프로세스 종료
171
+ for (const child of this._watchHookChildren.values()) {
172
+ if (child.exitCode == null) {
173
+ child.kill();
174
+ }
175
+ }
176
+ this._watchHookChildren.clear();
177
+
178
+ await Promise.all(shutdownTasks);
179
+ this._copySrcWatchers = [];
180
+ this._distDeleteWatchers = [];
181
+ this._watchHookWatchers.length = 0;
182
+ }
183
+
184
+ private _runWatchHookCmd(pkgName: string, cwd: string, cmd: string, args?: string[]): void {
185
+ // Kill previous hook process if still running
186
+ const prev = this._watchHookChildren.get(pkgName);
187
+ if (prev != null && prev.exitCode == null) {
188
+ prev.kill();
189
+ }
190
+
191
+ const child = spawn(cmd, args ?? [], { cwd, stdio: "inherit", shell: true });
192
+ this._watchHookChildren.set(pkgName, child);
193
+
194
+ child.on("error", (err) => {
195
+ this._logger.error(`[${pkgName}] 워치 훅 에러: ${err.message}`);
196
+ });
197
+ child.on("close", (code) => {
198
+ if (code !== 0 && code !== null) {
199
+ this._logger.warn(`[${pkgName}] 워치 훅이 코드 ${String(code)}로 종료됨`);
200
+ }
201
+ });
202
+ }
203
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Orchestrator 공통 생명주기 인터페이스
3
+ *
4
+ * 모든 Orchestrator(Build, Watch, Dev, Typecheck)가 따르는 계약.
5
+ * initialize() → start() → shutdown() 순서로 호출한다.
6
+ *
7
+ * @typeParam TStartResult start()의 반환 타입. 기본값 void.
8
+ */
9
+ export interface OrchestratorLifecycle<TStartResult = void> {
10
+ /** 초기화: config 로드, 패키지 분류, 엔진 생성 등 */
11
+ initialize(): Promise<void>;
12
+
13
+ /** 실행: 빌드/타입체크/watch 시작 */
14
+ start(): Promise<TStartResult>;
15
+
16
+ /** 종료: 리소스 정리 */
17
+ shutdown(): Promise<void>;
18
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 빌드 엔진(BaseEngine, ViteEngine)의 공유 중지 로직.
2
+ * 빌드 엔진(BaseEngine, EsbuildClientEngine)의 공유 중지 로직.
3
3
  *
4
4
  * 엔진 구현체 간 shutdown 타임아웃 + stopWatch 경쟁 + terminate
5
5
  * 패턴의 중복을 방지하기 위해 추출하였다.