@simplysm/sd-cli 14.0.42 → 14.0.43

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 (321) hide show
  1. package/dist/angular/angular-compiler.d.ts +0 -35
  2. package/dist/angular/angular-compiler.d.ts.map +1 -1
  3. package/dist/angular/angular-compiler.js +0 -374
  4. package/dist/angular/angular-compiler.js.map +1 -1
  5. package/dist/angular/hmr-candidates.d.ts +13 -0
  6. package/dist/angular/hmr-candidates.d.ts.map +1 -0
  7. package/dist/angular/hmr-candidates.js +230 -0
  8. package/dist/angular/hmr-candidates.js.map +1 -0
  9. package/dist/angular/ngtsc-build-core.d.ts +29 -34
  10. package/dist/angular/ngtsc-build-core.d.ts.map +1 -1
  11. package/dist/angular/ngtsc-build-core.js +90 -51
  12. package/dist/angular/ngtsc-build-core.js.map +1 -1
  13. package/dist/angular/vite-angular-plugin.d.ts +1 -1
  14. package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
  15. package/dist/angular/vite-angular-plugin.js +63 -56
  16. package/dist/angular/vite-angular-plugin.js.map +1 -1
  17. package/dist/angular/web-worker-transformer.d.ts +9 -0
  18. package/dist/angular/web-worker-transformer.d.ts.map +1 -0
  19. package/dist/angular/web-worker-transformer.js +73 -0
  20. package/dist/angular/web-worker-transformer.js.map +1 -0
  21. package/dist/capacitor/capacitor.d.ts.map +1 -1
  22. package/dist/capacitor/capacitor.js +6 -4
  23. package/dist/capacitor/capacitor.js.map +1 -1
  24. package/dist/commands/check.d.ts +1 -1
  25. package/dist/commands/check.d.ts.map +1 -1
  26. package/dist/commands/check.js +15 -65
  27. package/dist/commands/check.js.map +1 -1
  28. package/dist/commands/publish/deployment-phase.d.ts.map +1 -1
  29. package/dist/commands/publish/deployment-phase.js +13 -5
  30. package/dist/commands/publish/deployment-phase.js.map +1 -1
  31. package/dist/commands/publish/npm-publisher.js +1 -1
  32. package/dist/commands/publish/npm-publisher.js.map +1 -1
  33. package/dist/commands/publish/publish-command.js +1 -1
  34. package/dist/commands/publish/publish-command.js.map +1 -1
  35. package/dist/commands/publish/version-upgrade.js +1 -1
  36. package/dist/commands/publish/version-upgrade.js.map +1 -1
  37. package/dist/commands/replace-deps.d.ts.map +1 -1
  38. package/dist/commands/replace-deps.js +2 -1
  39. package/dist/commands/replace-deps.js.map +1 -1
  40. package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -1
  41. package/dist/deps/replace-deps/collect-deps.js +5 -2
  42. package/dist/deps/replace-deps/collect-deps.js.map +1 -1
  43. package/dist/deps/replace-deps/replace-deps.d.ts +21 -3
  44. package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -1
  45. package/dist/deps/replace-deps/replace-deps.js +107 -62
  46. package/dist/deps/replace-deps/replace-deps.js.map +1 -1
  47. package/dist/electron/electron.js +7 -7
  48. package/dist/electron/electron.js.map +1 -1
  49. package/dist/engines/BaseEngine.d.ts.map +1 -1
  50. package/dist/engines/BaseEngine.js +2 -5
  51. package/dist/engines/BaseEngine.js.map +1 -1
  52. package/dist/engines/EsbuildClientEngine.d.ts.map +1 -1
  53. package/dist/engines/EsbuildClientEngine.js +16 -9
  54. package/dist/engines/EsbuildClientEngine.js.map +1 -1
  55. package/dist/engines/NgtscEngine.d.ts +4 -4
  56. package/dist/engines/NgtscEngine.d.ts.map +1 -1
  57. package/dist/engines/NgtscEngine.js +5 -5
  58. package/dist/engines/NgtscEngine.js.map +1 -1
  59. package/dist/engines/TscEngine.d.ts.map +1 -1
  60. package/dist/engines/TscEngine.js +0 -2
  61. package/dist/engines/TscEngine.js.map +1 -1
  62. package/dist/engines/types.d.ts +2 -0
  63. package/dist/engines/types.d.ts.map +1 -1
  64. package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts +36 -0
  65. package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts.map +1 -0
  66. package/dist/esbuild/esbuild-angular-compiler-plugin.js +464 -0
  67. package/dist/esbuild/esbuild-angular-compiler-plugin.js.map +1 -0
  68. package/dist/esbuild/esbuild-client-config.d.ts +8 -2
  69. package/dist/esbuild/esbuild-client-config.d.ts.map +1 -1
  70. package/dist/esbuild/esbuild-client-config.js +48 -33
  71. package/dist/esbuild/esbuild-client-config.js.map +1 -1
  72. package/dist/esbuild/esbuild-tsc-plugin.d.ts +4 -1
  73. package/dist/esbuild/esbuild-tsc-plugin.d.ts.map +1 -1
  74. package/dist/esbuild/esbuild-tsc-plugin.js +27 -23
  75. package/dist/esbuild/esbuild-tsc-plugin.js.map +1 -1
  76. package/dist/esbuild/file-reference-tracker.d.ts +24 -0
  77. package/dist/esbuild/file-reference-tracker.d.ts.map +1 -0
  78. package/dist/esbuild/file-reference-tracker.js +57 -0
  79. package/dist/esbuild/file-reference-tracker.js.map +1 -0
  80. package/dist/esbuild/lmdb-cache-store.d.ts +18 -0
  81. package/dist/esbuild/lmdb-cache-store.d.ts.map +1 -0
  82. package/dist/esbuild/lmdb-cache-store.js +41 -0
  83. package/dist/esbuild/lmdb-cache-store.js.map +1 -0
  84. package/dist/esbuild/load-result-cache.d.ts +17 -0
  85. package/dist/esbuild/load-result-cache.d.ts.map +1 -0
  86. package/dist/esbuild/load-result-cache.js +61 -0
  87. package/dist/esbuild/load-result-cache.js.map +1 -0
  88. package/dist/index.d.ts +3 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +2 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/lint/lint-core.js +7 -7
  93. package/dist/lint/lint-core.js.map +1 -1
  94. package/dist/orchestrators/BaseOrchestrator.js +2 -2
  95. package/dist/orchestrators/BaseOrchestrator.js.map +1 -1
  96. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  97. package/dist/orchestrators/BuildOrchestrator.js +5 -19
  98. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  99. package/dist/orchestrators/DevOrchestrator.js +5 -5
  100. package/dist/orchestrators/DevOrchestrator.js.map +1 -1
  101. package/dist/orchestrators/WatchOrchestrator.js +6 -6
  102. package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
  103. package/dist/runtime/ResultCollector.d.ts +1 -0
  104. package/dist/runtime/ResultCollector.d.ts.map +1 -1
  105. package/dist/runtime/ResultCollector.js.map +1 -1
  106. package/dist/runtime/engine-watch-events.d.ts.map +1 -1
  107. package/dist/runtime/engine-watch-events.js +3 -0
  108. package/dist/runtime/engine-watch-events.js.map +1 -1
  109. package/dist/runtime/rebuild-manager.js +1 -1
  110. package/dist/runtime/rebuild-manager.js.map +1 -1
  111. package/dist/runtime/worker-utils.js +1 -1
  112. package/dist/runtime/worker-utils.js.map +1 -1
  113. package/dist/sd-cli-entry.d.ts.map +1 -1
  114. package/dist/sd-cli-entry.js +4 -3
  115. package/dist/sd-cli-entry.js.map +1 -1
  116. package/dist/sd-cli.js +3 -3
  117. package/dist/sd-cli.js.map +1 -1
  118. package/dist/ts-compiler/SdTsCompiler.d.ts +39 -0
  119. package/dist/ts-compiler/SdTsCompiler.d.ts.map +1 -0
  120. package/dist/ts-compiler/SdTsCompiler.js +593 -0
  121. package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
  122. package/dist/ts-compiler/sd-ts-compiler-options.d.ts +40 -0
  123. package/dist/ts-compiler/sd-ts-compiler-options.d.ts.map +1 -0
  124. package/dist/ts-compiler/sd-ts-compiler-options.js +2 -0
  125. package/dist/ts-compiler/sd-ts-compiler-options.js.map +1 -0
  126. package/dist/ts-compiler/sd-ts-compiler-result.d.ts +34 -0
  127. package/dist/ts-compiler/sd-ts-compiler-result.d.ts.map +1 -0
  128. package/dist/ts-compiler/sd-ts-compiler-result.js +2 -0
  129. package/dist/ts-compiler/sd-ts-compiler-result.js.map +1 -0
  130. package/dist/utils/copy-public.d.ts +6 -4
  131. package/dist/utils/copy-public.d.ts.map +1 -1
  132. package/dist/utils/copy-public.js +9 -7
  133. package/dist/utils/copy-public.js.map +1 -1
  134. package/dist/utils/diagnostic-utils.d.ts +2 -3
  135. package/dist/utils/diagnostic-utils.d.ts.map +1 -1
  136. package/dist/utils/diagnostic-utils.js +8 -9
  137. package/dist/utils/diagnostic-utils.js.map +1 -1
  138. package/dist/utils/output-utils.d.ts +8 -2
  139. package/dist/utils/output-utils.d.ts.map +1 -1
  140. package/dist/utils/output-utils.js +32 -8
  141. package/dist/utils/output-utils.js.map +1 -1
  142. package/dist/workers/client.worker.d.ts +1 -1
  143. package/dist/workers/client.worker.d.ts.map +1 -1
  144. package/dist/workers/client.worker.js +136 -110
  145. package/dist/workers/client.worker.js.map +1 -1
  146. package/dist/workers/library-build.worker.d.ts +0 -2
  147. package/dist/workers/library-build.worker.d.ts.map +1 -1
  148. package/dist/workers/library-build.worker.js +147 -70
  149. package/dist/workers/library-build.worker.js.map +1 -1
  150. package/dist/workers/server-build.worker.d.ts.map +1 -1
  151. package/dist/workers/server-build.worker.js +30 -57
  152. package/dist/workers/server-build.worker.js.map +1 -1
  153. package/dist/workers/server-esbuild-context.d.ts +7 -0
  154. package/dist/workers/server-esbuild-context.d.ts.map +1 -1
  155. package/dist/workers/server-esbuild-context.js +11 -2
  156. package/dist/workers/server-esbuild-context.js.map +1 -1
  157. package/package.json +5 -4
  158. package/src/angular/angular-compiler.ts +0 -502
  159. package/src/angular/hmr-candidates.ts +295 -0
  160. package/src/angular/ngtsc-build-core.ts +125 -92
  161. package/src/angular/vite-angular-plugin.ts +71 -65
  162. package/src/angular/web-worker-transformer.ts +117 -0
  163. package/src/capacitor/capacitor.ts +6 -4
  164. package/src/commands/check.ts +17 -76
  165. package/src/commands/publish/deployment-phase.ts +11 -7
  166. package/src/commands/publish/npm-publisher.ts +1 -1
  167. package/src/commands/publish/publish-command.ts +1 -1
  168. package/src/commands/publish/version-upgrade.ts +1 -1
  169. package/src/commands/replace-deps.ts +3 -1
  170. package/src/deps/replace-deps/collect-deps.ts +4 -2
  171. package/src/deps/replace-deps/replace-deps.ts +114 -66
  172. package/src/electron/electron.ts +7 -7
  173. package/src/engines/BaseEngine.ts +2 -6
  174. package/src/engines/EsbuildClientEngine.ts +16 -10
  175. package/src/engines/NgtscEngine.ts +7 -7
  176. package/src/engines/TscEngine.ts +0 -2
  177. package/src/engines/types.ts +2 -0
  178. package/src/esbuild/esbuild-angular-compiler-plugin.ts +647 -0
  179. package/src/esbuild/esbuild-client-config.ts +57 -41
  180. package/src/esbuild/esbuild-tsc-plugin.ts +33 -23
  181. package/src/esbuild/file-reference-tracker.ts +61 -0
  182. package/src/esbuild/lmdb-cache-store.ts +46 -0
  183. package/src/esbuild/load-result-cache.ts +85 -0
  184. package/src/index.ts +5 -0
  185. package/src/lint/lint-core.ts +7 -7
  186. package/src/orchestrators/BaseOrchestrator.ts +2 -2
  187. package/src/orchestrators/BuildOrchestrator.ts +5 -24
  188. package/src/orchestrators/DevOrchestrator.ts +5 -5
  189. package/src/orchestrators/WatchOrchestrator.ts +6 -6
  190. package/src/runtime/ResultCollector.ts +1 -0
  191. package/src/runtime/engine-watch-events.ts +3 -0
  192. package/src/runtime/rebuild-manager.ts +1 -1
  193. package/src/runtime/worker-utils.ts +1 -1
  194. package/src/sd-cli-entry.ts +5 -3
  195. package/src/sd-cli.ts +4 -4
  196. package/src/ts-compiler/SdTsCompiler.ts +815 -0
  197. package/src/ts-compiler/sd-ts-compiler-options.ts +46 -0
  198. package/src/ts-compiler/sd-ts-compiler-result.ts +34 -0
  199. package/src/utils/copy-public.ts +9 -6
  200. package/src/utils/diagnostic-utils.ts +8 -9
  201. package/src/utils/output-utils.ts +38 -8
  202. package/src/workers/client.worker.ts +160 -126
  203. package/src/workers/library-build.worker.ts +187 -75
  204. package/src/workers/server-build.worker.ts +31 -61
  205. package/src/workers/server-esbuild-context.ts +14 -2
  206. package/tests/angular/fixtures/packages/basic-app/dist/styles.css +3 -0
  207. package/tests/angular/fixtures/packages/basic-app/scss/styles.scss +5 -0
  208. package/tests/angular/vite-angular-plugin-sdtscompiler.verify.md +13 -0
  209. package/tests/angular/web-worker-transformer.spec.ts +154 -0
  210. package/tests/capacitor/capacitor-build.spec.ts +1 -1
  211. package/tests/capacitor/capacitor-icon.spec.ts +1 -1
  212. package/tests/capacitor/capacitor-init.spec.ts +1 -1
  213. package/tests/commands/check.spec.ts +90 -104
  214. package/tests/commands/publish.spec.ts +12 -4
  215. package/tests/commands/slice3-severity-cleanup.verify.md +12 -0
  216. package/tests/deps/replace-deps/collect-deps.acc.spec.ts +62 -0
  217. package/tests/deps/replace-deps/collect-deps.spec.ts +49 -0
  218. package/tests/deps/replace-deps/replace-deps-filter.spec.ts +103 -0
  219. package/tests/deps/replace-deps/replace-deps-setup.acc.spec.ts +156 -0
  220. package/tests/electron/electron.spec.ts +4 -1
  221. package/tests/engines/engine-adapter-isolation.spec.ts +5 -6
  222. package/tests/engines/engine-duplicate-output-removal.verify.md +10 -0
  223. package/tests/engines/esbuild-client-engine.acc.spec.ts +79 -0
  224. package/tests/engines/esbuild-client-engine.spec.ts +73 -3
  225. package/tests/esbuild/esbuild-angular-compiler-plugin-hmr.verify.md +23 -0
  226. package/tests/esbuild/esbuild-angular-compiler-plugin-onload.verify.md +21 -0
  227. package/tests/esbuild/esbuild-angular-compiler-plugin-onstart-extraction.verify.md +16 -0
  228. package/tests/esbuild/esbuild-angular-compiler-plugin-sdtscompiler.verify.md +15 -0
  229. package/tests/esbuild/esbuild-angular-compiler-plugin-stylesheet.verify.md +31 -0
  230. package/tests/esbuild/esbuild-angular-compiler-plugin-worker.verify.md +31 -0
  231. package/tests/esbuild/esbuild-angular-compiler-plugin.spec.ts +397 -0
  232. package/tests/esbuild/esbuild-angular-compiler-plugin.verify.md +21 -0
  233. package/tests/esbuild/esbuild-tsc-plugin-imports.verify.md +13 -0
  234. package/tests/esbuild/esbuild-tsc-plugin.acc.spec.ts +56 -111
  235. package/tests/esbuild/esbuild-tsc-plugin.spec.ts +116 -52
  236. package/tests/esbuild/file-reference-tracker.spec.ts +99 -0
  237. package/tests/esbuild/lmdb-cache-store.spec.ts +58 -0
  238. package/tests/esbuild/load-result-cache.acc.spec.ts +55 -0
  239. package/tests/esbuild/load-result-cache.spec.ts +133 -0
  240. package/tests/orchestrators/build-orchestrator.spec.ts +4 -3
  241. package/tests/orchestrators/dev-orchestrator.spec.ts +5 -5
  242. package/tests/orchestrators/slice1-stdout-to-consola.verify.md +10 -0
  243. package/tests/orchestrators/typecheck-orchestrator.spec.ts +1 -1
  244. package/tests/orchestrators/watch-orchestrator.spec.ts +7 -7
  245. package/tests/runtime/result-collector.spec.ts +64 -0
  246. package/tests/sd-cli-entry.spec.ts +3 -4
  247. package/tests/sd-cli-log-tag.verify.md +11 -0
  248. package/tests/ts-compiler/SdTsCompiler-affected-files.verify.md +8 -0
  249. package/tests/ts-compiler/SdTsCompiler-diagnostics.verify.md +12 -0
  250. package/tests/ts-compiler/SdTsCompiler-emit.verify.md +9 -0
  251. package/tests/ts-compiler/SdTsCompiler.acc.spec.ts +603 -0
  252. package/tests/ts-compiler/SdTsCompiler.spec.ts +265 -0
  253. package/tests/ts-compiler/SdTsCompiler.verify.md +41 -0
  254. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-browser.tsbuildinfo +1 -0
  255. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-node.tsbuildinfo +1 -0
  256. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck.tsbuildinfo +1 -0
  257. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.d.ts +2 -0
  258. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.d.ts.map +1 -0
  259. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.js +4 -0
  260. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.js.map +1 -0
  261. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.d.ts +2 -0
  262. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.d.ts.map +1 -0
  263. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.js +4 -0
  264. package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.js.map +1 -0
  265. package/tests/ts-compiler/fixtures/non-angular-pkg/src/index.ts +3 -0
  266. package/tests/ts-compiler/fixtures/non-angular-pkg/src/util.ts +3 -0
  267. package/tests/ts-compiler/fixtures/non-angular-pkg/tests/sample.test-file.ts +3 -0
  268. package/tests/ts-compiler/fixtures/non-angular-pkg/tsconfig.json +12 -0
  269. package/tests/ts-compiler/scss-lint-integration.verify.md +14 -0
  270. package/tests/utils/angular-build.spec.ts +1 -1
  271. package/tests/utils/copy-public-outdir.verify.md +8 -0
  272. package/tests/utils/copy-public.acc.spec.ts +52 -0
  273. package/tests/utils/copy-public.spec.ts +56 -0
  274. package/tests/utils/diagnostic-utils.spec.ts +24 -15
  275. package/tests/utils/engine-watch-events.acc.spec.ts +59 -0
  276. package/tests/utils/engine-watch-events.spec.ts +58 -0
  277. package/tests/utils/esbuild-client-config-integration.verify.md +9 -0
  278. package/tests/utils/esbuild-client-config.acc.spec.ts +45 -61
  279. package/tests/utils/esbuild-client-config.spec.ts +70 -52
  280. package/tests/utils/ngtsc-build-core-write-emit.spec.ts +12 -12
  281. package/tests/utils/ngtsc-build-core.spec.ts +1 -44
  282. package/tests/utils/output-utils.spec.ts +133 -13
  283. package/tests/utils/replace-deps-watch.acc.spec.ts +7 -1
  284. package/tests/utils/replace-deps-watch.spec.ts +57 -1
  285. package/tests/utils/worker-utils.spec.ts +8 -2
  286. package/tests/workers/client-worker-initial-build-error.verify.md +2 -3
  287. package/tests/workers/client-worker-initial-build-warnings.verify.md +7 -0
  288. package/tests/workers/client-worker-refactor.verify.md +22 -0
  289. package/tests/workers/client-worker-ts-cache-invalidation.verify.md +12 -0
  290. package/tests/workers/client-worker.acc.spec.ts +6 -3
  291. package/tests/workers/library-build-lint.spec.ts +40 -45
  292. package/tests/workers/library-build-worker.spec.ts +294 -40
  293. package/tests/workers/server-build-lint.spec.ts +59 -45
  294. package/tests/workers/server-build-worker.spec.ts +63 -24
  295. package/tests/workers/server-esbuild-context.acc.spec.ts +2 -0
  296. package/tests/workers/server-esbuild-context.spec.ts +2 -0
  297. package/tests/workers/server-runtime-worker.spec.ts +1 -1
  298. package/tests/workers/shared-worker-lifecycle.acc.spec.ts +1 -1
  299. package/dist/angular/angular-build-pipeline.d.ts +0 -97
  300. package/dist/angular/angular-build-pipeline.d.ts.map +0 -1
  301. package/dist/angular/angular-build-pipeline.js +0 -285
  302. package/dist/angular/angular-build-pipeline.js.map +0 -1
  303. package/dist/utils/tsc-build.d.ts +0 -51
  304. package/dist/utils/tsc-build.d.ts.map +0 -1
  305. package/dist/utils/tsc-build.js +0 -156
  306. package/dist/utils/tsc-build.js.map +0 -1
  307. package/dist/workers/ngtsc-build.worker.d.ts +0 -23
  308. package/dist/workers/ngtsc-build.worker.d.ts.map +0 -1
  309. package/dist/workers/ngtsc-build.worker.js +0 -267
  310. package/dist/workers/ngtsc-build.worker.js.map +0 -1
  311. package/src/angular/angular-build-pipeline.ts +0 -406
  312. package/src/utils/tsc-build.ts +0 -226
  313. package/src/workers/ngtsc-build.worker.ts +0 -351
  314. package/tests/angular/angular-build-pipeline.spec.ts +0 -247
  315. package/tests/angular/angular-compiler-aot.acc.spec.ts +0 -68
  316. package/tests/angular/angular-compiler-aot.spec.ts +0 -80
  317. package/tests/utils/angular-compiler-emit.spec.ts +0 -666
  318. package/tests/utils/angular-compiler.spec.ts +0 -707
  319. package/tests/utils/tsc-build.spec.ts +0 -527
  320. package/tests/workers/ngtsc-build-lint.spec.ts +0 -141
  321. package/tests/workers/ngtsc-build-worker.spec.ts +0 -199
@@ -1,12 +1,13 @@
1
+ import path from "path";
1
2
  import type ts from "typescript";
2
3
  import { createWorker, FsWatcher, pathx } from "@simplysm/core-node";
3
4
  import { err as errNs } from "@simplysm/core-common";
4
- import type { SdBuildPackageConfig } from "../sd-config.types";
5
5
  import type { BuildOutput } from "../engines/types";
6
6
  import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization";
7
7
  import type { LintWithProgramResult } from "../lint/lint-with-program";
8
- import { runTscPackageBuild } from "../utils/tsc-build";
9
- import { LintWithProgramRunner } from "../lint/lint-with-program";
8
+ import { SdTsCompiler } from "../ts-compiler/SdTsCompiler";
9
+ import type { ISdTsCompilerResult } from "../ts-compiler/sd-ts-compiler-result";
10
+ import { writeEmitResults, compileSideEffectScss } from "../angular/ngtsc-build-core";
10
11
  import { setupWorkerLifecycle } from "./shared-worker-lifecycle";
11
12
  import { buildWatchPaths } from "./build-watch-paths";
12
13
  import { hasFileAddOrRemove, shouldSkipRebuild } from "./build-change-filter";
@@ -15,7 +16,6 @@ import { hasFileAddOrRemove, shouldSkipRebuild } from "./build-change-filter";
15
16
 
16
17
  export interface LibraryBuildInfo {
17
18
  name: string;
18
- config: SdBuildPackageConfig;
19
19
  cwd: string;
20
20
  pkgDir: string;
21
21
  output: BuildOutput;
@@ -44,12 +44,15 @@ export interface LibraryBuildWorkerEvents extends Record<string, unknown> {
44
44
  //#region Resource Management
45
45
 
46
46
  let fsWatcher: FsWatcher | undefined;
47
+ let compiler: SdTsCompiler | undefined;
48
+ let combinedScssDeps = new Map<string, Set<string>>();
47
49
 
48
50
  async function cleanup(): Promise<void> {
49
51
  const watcherToClose = fsWatcher;
50
52
  fsWatcher = undefined;
53
+ compiler = undefined;
51
54
  lastSourceFilePaths = undefined;
52
- lastBuilderProgram = undefined;
55
+ combinedScssDeps = new Map();
53
56
  await watcherToClose?.close();
54
57
  }
55
58
 
@@ -61,36 +64,71 @@ const { logger, guardStartWatch } = setupWorkerLifecycle("library-build", cleanu
61
64
 
62
65
  async function build(info: LibraryBuildInfo): Promise<LibraryBuildResult> {
63
66
  logger.debug(`[${info.name}] library worker build 시작 (pkgDir: ${info.pkgDir})`);
64
- const tscResult = runTscPackageBuild({
65
- pkgDir: info.pkgDir,
66
- cwd: info.cwd,
67
- output: info.output,
68
- env: info.output.env,
69
- includeTests: info.output.includeTests,
70
- });
71
- logger.debug(`[${info.name}] library worker build 완료 (success: ${tscResult.success})`);
72
67
 
73
- // lint 실행 (활성화 + program 사용 가능 시)
74
- let lint: LintWithProgramResult | undefined;
75
- if (info.output.lint === true && tscResult.program != null) {
76
- logger.debug(`[${info.name}] lint 시작`);
77
- const lintRunner = new LintWithProgramRunner({
68
+ try {
69
+ compiler = new SdTsCompiler({
70
+ pkgDir: info.pkgDir,
78
71
  cwd: info.cwd,
79
- pkgName: info.name,
72
+ output: { js: info.output.js, dts: info.output.dts },
73
+ includeTests: info.output.includeTests,
74
+ env: info.output.env,
75
+ lint: info.output.lint,
76
+ globalScss: info.output.globalScss,
80
77
  });
81
- lint = await lintRunner.lint({ program: tscResult.program });
82
- logger.debug(`[${info.name}] lint 완료`);
83
- }
78
+ const result = await compiler.compileAsync();
79
+ const isAngular = info.output.globalScss === true;
80
+
81
+ // Angular: emit 결과 디스크 쓰기 + side-effect SCSS 처리
82
+ const sideEffectScssErrors: string[] = [];
83
+ if (result.emitResults != null) {
84
+ const normalizedSrcDir = pathx.posix(path.join(info.pkgDir, "src"));
85
+ const filteredEmitResults = result.emitResults.filter((r) =>
86
+ pathx.posix(r.sourceFileName).startsWith(normalizedSrcDir + "/"),
87
+ );
88
+
89
+ if (isAngular) {
90
+ const loadPaths = [path.join(info.pkgDir, "scss"), path.join(info.cwd, "node_modules")];
91
+ writeEmitResults(filteredEmitResults, info.pkgDir, {
92
+ loadPaths,
93
+ scssErrors: sideEffectScssErrors,
94
+ scssDependencies: combinedScssDeps,
95
+ registry: compiler.sideEffectScssRegistry,
96
+ });
97
+ // 초기 빌드: 등록된 side-effect SCSS 전체 컴파일
98
+ compileSideEffectScss(
99
+ compiler.sideEffectScssRegistry,
100
+ loadPaths,
101
+ sideEffectScssErrors,
102
+ combinedScssDeps,
103
+ );
104
+ } else {
105
+ writeEmitResults(filteredEmitResults, info.pkgDir);
106
+ }
107
+ }
84
108
 
85
- return {
86
- build: {
87
- success: tscResult.success,
88
- errors: tscResult.errors,
89
- warnings: undefined,
90
- diagnostics: tscResult.diagnostics,
91
- },
92
- lint,
93
- };
109
+ // 에러 통합 (ts errors + scss errors + side-effect scss errors)
110
+ const allErrors = [...(result.errors ?? []), ...result.scssErrors, ...sideEffectScssErrors];
111
+
112
+ logger.debug(`[${info.name}] library worker build 완료 (success: ${result.errorCount === 0})`);
113
+ return {
114
+ build: {
115
+ success:
116
+ result.errorCount === 0 &&
117
+ result.scssErrors.length === 0 &&
118
+ sideEffectScssErrors.length === 0,
119
+ errors: allErrors.length > 0 ? allErrors : undefined,
120
+ warnings: undefined,
121
+ diagnostics: result.diagnostics,
122
+ },
123
+ lint: result.lint,
124
+ };
125
+ } catch (err) {
126
+ const message = errNs.message(err);
127
+ logger.debug(`[${info.name}] library worker build 예외 발생: ${message}`);
128
+ return {
129
+ build: { success: false, errors: [message], diagnostics: [] },
130
+ };
131
+ }
94
132
  }
95
133
 
96
134
  //#endregion
@@ -98,10 +136,7 @@ async function build(info: LibraryBuildInfo): Promise<LibraryBuildResult> {
98
136
  //#region startWatch (watch mode)
99
137
 
100
138
  // watch 모드용 가변 상태
101
- let watchInfo: LibraryBuildInfo | undefined;
102
- let watchLintRunner: LintWithProgramRunner | undefined;
103
139
  let lastSourceFilePaths: Set<string> | undefined;
104
- let lastBuilderProgram: ts.EmitAndSemanticDiagnosticsBuilderProgram | undefined;
105
140
 
106
141
  function extractSourceFilePaths(program: ts.Program | undefined): Set<string> | undefined {
107
142
  if (program == null) return undefined;
@@ -112,61 +147,108 @@ function extractSourceFilePaths(program: ts.Program | undefined): Set<string> |
112
147
  return paths;
113
148
  }
114
149
 
115
- async function rebuildAll(): Promise<CombinedBuildEvent> {
116
- const info = watchInfo!;
117
- logger.debug(`[${info.name}] rebuildAll 시작`);
150
+ /** compile-time SCSS 의존성으로 combinedScssDeps를 갱신한다 */
151
+ function updateCombinedScssDeps(result: ISdTsCompilerResult): void {
152
+ combinedScssDeps = new Map();
153
+ for (const [file, deps] of result.scssDependencies) {
154
+ combinedScssDeps.set(file, new Set(deps));
155
+ }
156
+ }
118
157
 
119
- const tscResult = runTscPackageBuild({
120
- pkgDir: info.pkgDir,
121
- cwd: info.cwd,
122
- output: info.output,
123
- env: info.output.env,
124
- includeTests: info.output.includeTests,
125
- oldBuilderProgram: lastBuilderProgram,
126
- });
127
- lastBuilderProgram = tscResult.builderProgram ?? lastBuilderProgram;
128
-
129
- // 의존성 필터링을 위한 소스 파일 경로 업데이트
130
- lastSourceFilePaths = extractSourceFilePaths(tscResult.program) ?? lastSourceFilePaths;
131
-
132
- // lint 실행 (활성화 + program 사용 가능 시)
133
- let lint: LintWithProgramResult | undefined;
134
- if (info.output.lint === true && tscResult.program != null) {
135
- logger.debug(`[${info.name}] lint 시작`);
136
- if (watchLintRunner == null) {
137
- watchLintRunner = new LintWithProgramRunner({
138
- cwd: info.cwd,
139
- pkgName: info.name,
140
- });
158
+ /**
159
+ * SdTsCompiler 결과를 CombinedBuildEvent로 변환한다.
160
+ * Angular일 경우 emit 디스크 쓰기 + side-effect SCSS 처리를 포함한다.
161
+ */
162
+ function buildWatchEvent(
163
+ info: LibraryBuildInfo,
164
+ result: ISdTsCompilerResult,
165
+ hasScssChanges: boolean,
166
+ ): CombinedBuildEvent {
167
+ const isAngular = info.output.globalScss === true;
168
+
169
+ if (isAngular && result.emitResults != null) {
170
+ const normalizedSrcDir = pathx.posix(path.join(info.pkgDir, "src"));
171
+ const loadPaths = [path.join(info.pkgDir, "scss"), path.join(info.cwd, "node_modules")];
172
+ const sideEffectScssErrors: string[] = [];
173
+
174
+ // emit 결과 디스크 쓰기 (side-effect SCSS 등록 포함)
175
+ writeEmitResults(
176
+ result.emitResults.filter((r) =>
177
+ pathx.posix(r.sourceFileName).startsWith(normalizedSrcDir + "/"),
178
+ ),
179
+ info.pkgDir,
180
+ {
181
+ loadPaths,
182
+ scssErrors: sideEffectScssErrors,
183
+ scssDependencies: combinedScssDeps,
184
+ registry: compiler!.sideEffectScssRegistry,
185
+ },
186
+ );
187
+
188
+ // SCSS 변경 시 side-effect SCSS 재컴파일
189
+ if (hasScssChanges) {
190
+ compileSideEffectScss(
191
+ compiler!.sideEffectScssRegistry,
192
+ loadPaths,
193
+ sideEffectScssErrors,
194
+ combinedScssDeps,
195
+ );
141
196
  }
142
- lint = await watchLintRunner.lint({
143
- program: tscResult.program,
144
- affectedFiles: tscResult.affectedFiles,
145
- });
146
- logger.debug(`[${info.name}] lint 완료`);
197
+
198
+ // 모든 에러 통합
199
+ const allErrors = [...(result.errors ?? []), ...result.scssErrors, ...sideEffectScssErrors];
200
+ return {
201
+ build: {
202
+ success:
203
+ result.errorCount === 0 &&
204
+ result.scssErrors.length === 0 &&
205
+ sideEffectScssErrors.length === 0,
206
+ errors: allErrors.length > 0 ? allErrors : undefined,
207
+ },
208
+ lint: result.lint,
209
+ };
147
210
  }
148
211
 
149
- logger.debug(`[${info.name}] rebuildAll 완료`);
212
+ // Non-Angular 경로
150
213
  return {
151
- build: { success: tscResult.success, errors: tscResult.errors },
152
- lint,
214
+ build: {
215
+ success: result.errorCount === 0,
216
+ errors: result.errors,
217
+ },
218
+ lint: result.lint,
153
219
  };
154
220
  }
155
221
 
156
222
  async function startWatch(info: LibraryBuildInfo): Promise<void> {
157
223
  guardStartWatch();
158
- watchInfo = info;
224
+ const isAngular = info.output.globalScss === true;
225
+
226
+ compiler = new SdTsCompiler({
227
+ pkgDir: info.pkgDir,
228
+ cwd: info.cwd,
229
+ output: { js: info.output.js, dts: info.output.dts },
230
+ includeTests: info.output.includeTests,
231
+ env: info.output.env,
232
+ lint: info.output.lint,
233
+ globalScss: info.output.globalScss,
234
+ });
159
235
 
160
236
  try {
161
237
  // 초기 빌드
162
- const initialResult = await rebuildAll();
163
- sender.send("build", initialResult);
238
+ const initialResult = await compiler.compileAsync();
239
+ lastSourceFilePaths = extractSourceFilePaths(initialResult.program) ?? lastSourceFilePaths;
240
+ if (isAngular) {
241
+ updateCombinedScssDeps(initialResult);
242
+ }
243
+ const initialEvent = buildWatchEvent(info, initialResult, isAngular);
244
+ sender.send("build", initialEvent);
164
245
 
165
246
  // workspace 의존성 경로 + replaceDeps 수집
166
247
  const { watchPaths } = buildWatchPaths({
167
248
  pkgDir: info.pkgDir,
168
249
  cwd: info.cwd,
169
- srcGlobs: ["*.ts"],
250
+ srcGlobs: isAngular ? ["*.{ts,scss,css}"] : ["*.ts"],
251
+ extraDirs: isAngular ? [{ dir: "scss", globs: ["*.{scss,css}"] }] : undefined,
170
252
  replaceDeps: info.replaceDeps,
171
253
  });
172
254
 
@@ -174,15 +256,45 @@ async function startWatch(info: LibraryBuildInfo): Promise<void> {
174
256
  logger.debug(`[${info.name}] FsWatcher 시작`);
175
257
  fsWatcher = await FsWatcher.watch(watchPaths);
176
258
 
177
- fsWatcher.onChange({ delay: 300 }, async (changes) => {
259
+ fsWatcher.onChange({ delay: 300 }, async (changedFiles) => {
178
260
  try {
179
- if (shouldSkipRebuild(changes.map((c) => c.path), hasFileAddOrRemove(changes), lastSourceFilePaths, logger)) {
261
+ const addOrRemove = hasFileAddOrRemove(changedFiles);
262
+
263
+ // 변경된 파일 수집
264
+ const modifiedFiles = new Set<string>();
265
+ for (const f of changedFiles) {
266
+ modifiedFiles.add(f.path);
267
+
268
+ // Angular: SCSS 역방향 의존성 탐색
269
+ if (isAngular && (f.path.endsWith(".scss") || f.path.endsWith(".css"))) {
270
+ const normalizedPath = pathx.posix(f.path);
271
+ for (const [ownerFile, deps] of combinedScssDeps) {
272
+ if (deps.has(normalizedPath)) {
273
+ modifiedFiles.add(ownerFile);
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ // 의존성 필터: 관련 변경이 없으면 리빌드 건너뜀
280
+ if (shouldSkipRebuild(modifiedFiles, addOrRemove, lastSourceFilePaths, logger)) {
180
281
  return;
181
282
  }
182
283
 
183
284
  sender.send("buildStart", {});
184
- const result = await rebuildAll();
185
- sender.send("build", result);
285
+
286
+ const result = await compiler!.compileAsync(modifiedFiles);
287
+ lastSourceFilePaths = extractSourceFilePaths(result.program) ?? lastSourceFilePaths;
288
+ if (isAngular) {
289
+ updateCombinedScssDeps(result);
290
+ }
291
+
292
+ const hasScssChanges = changedFiles.some(
293
+ (f) => f.path.endsWith(".scss") || f.path.endsWith(".css"),
294
+ );
295
+
296
+ const event = buildWatchEvent(info, result, hasScssChanges);
297
+ sender.send("build", event);
186
298
  } catch (err) {
187
299
  sender.send("error", { message: errNs.message(err) });
188
300
  }
@@ -1,9 +1,9 @@
1
- import type ts from "typescript";
2
1
  import path from "path";
3
2
  import fs from "fs";
4
3
  import esbuild from "esbuild";
5
4
  import { createWorker, FsWatcher, pathx } from "@simplysm/core-node";
6
5
  import { err as errNs } from "@simplysm/core-common";
6
+ import { formatEsbuildMessages } from "../utils/output-utils";
7
7
  import type { BuildOutput } from "../engines/types";
8
8
  import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization";
9
9
  import type { LintWithProgramResult } from "../lint/lint-with-program";
@@ -16,9 +16,8 @@ import {
16
16
  writeChangedOutputFiles,
17
17
  } from "../esbuild/esbuild-config";
18
18
  import { collectAllExternals, generateProductionFiles } from "../deps/server-externals/server-production-files";
19
- import { runTscPackageBuild } from "../utils/tsc-build";
19
+ import { SdTsCompiler } from "../ts-compiler/SdTsCompiler";
20
20
  import { createTscPlugin } from "../esbuild/esbuild-tsc-plugin";
21
- import { LintWithProgramRunner } from "../lint/lint-with-program";
22
21
  import { setupWorkerLifecycle } from "./shared-worker-lifecycle";
23
22
  import { buildWatchPaths } from "./build-watch-paths";
24
23
  import { copyPublicFiles, watchPublicFiles } from "../utils/copy-public";
@@ -146,7 +145,7 @@ async function build(info: ServerBuildInfo): Promise<ServerBuildResult> {
146
145
  let jsResult: { success: boolean; errors?: string[]; warnings?: string[] };
147
146
  let tscErrors: string[];
148
147
  let tscDiagnostics: SerializedDiagnostic[];
149
- let tscProgram: ts.Program | undefined;
148
+ let lint: LintWithProgramResult | undefined;
150
149
 
151
150
  if (info.output.js) {
152
151
  // js=true: tsc 플러그인 통합 — 단일 esbuild.build() 호출
@@ -156,6 +155,7 @@ async function build(info: ServerBuildInfo): Promise<ServerBuildResult> {
156
155
  output: { dts: info.output.dts },
157
156
  env: info.output.env,
158
157
  includeTests: info.output.includeTests,
158
+ lint: info.output.lint,
159
159
  });
160
160
 
161
161
  const esbuildOptions = createServerEsbuildOptions({
@@ -170,8 +170,8 @@ async function build(info: ServerBuildInfo): Promise<ServerBuildResult> {
170
170
  if (result.outputFiles) {
171
171
  await writeChangedOutputFiles(result.outputFiles);
172
172
  }
173
- const errors = result.errors.map((e) => e.text);
174
- const warnings = result.warnings.map((w) => w.text);
173
+ const errors = formatEsbuildMessages(result.errors, "error");
174
+ const warnings = formatEsbuildMessages(result.warnings, "warning");
175
175
  return {
176
176
  success: result.errors.length === 0,
177
177
  errors: errors.length > 0 ? errors : undefined,
@@ -186,34 +186,23 @@ async function build(info: ServerBuildInfo): Promise<ServerBuildResult> {
186
186
 
187
187
  tscErrors = tscPlugin.getErrors() ?? [];
188
188
  tscDiagnostics = tscPlugin.getDiagnostics();
189
- tscProgram = tscPlugin.getProgram();
189
+ lint = tscPlugin.getLintResult();
190
190
  } else {
191
- // js=false: runTscPackageBuild 직접 호출 (플러그인 경유 불가)
192
- const tscResult = runTscPackageBuild({
191
+ // js=false: SdTsCompiler 직접 호출 (플러그인 경유 불가)
192
+ const compiler = new SdTsCompiler({
193
193
  pkgDir: info.pkgDir,
194
194
  cwd: info.cwd,
195
195
  output: { js: false, dts: info.output.dts },
196
- parsedConfig,
197
196
  env: info.output.env,
198
197
  includeTests: info.output.includeTests,
198
+ lint: info.output.lint,
199
199
  });
200
+ const tscResult = await compiler.compileAsync();
200
201
 
201
202
  jsResult = { success: true, errors: undefined, warnings: undefined };
202
203
  tscErrors = tscResult.errors ?? [];
203
204
  tscDiagnostics = tscResult.diagnostics;
204
- tscProgram = tscResult.program;
205
- }
206
-
207
- // lint 실행 (활성화 + program 사용 가능 시)
208
- let lint: LintWithProgramResult | undefined;
209
- if (info.output.lint === true && tscProgram != null) {
210
- logger.debug(`[${info.name}] lint 시작`);
211
- const lintRunner = new LintWithProgramRunner({
212
- cwd: info.cwd,
213
- pkgName: info.name,
214
- });
215
- lint = await lintRunner.lint({ program: tscProgram });
216
- logger.debug(`[${info.name}] lint 완료`);
205
+ lint = tscResult.lint;
217
206
  }
218
207
 
219
208
  // JS 출력이 요청된 경우에만 프로덕션 아티팩트 생성
@@ -261,65 +250,45 @@ async function startWatch(info: ServerWatchInfo): Promise<void> {
261
250
  logger.debug(`[${info.name}] server worker startWatch 시작`);
262
251
 
263
252
  // watch 모드 로컬 상태 (클로저로 관리)
264
- let lastBuilderProgram: ts.EmitAndSemanticDiagnosticsBuilderProgram | undefined;
265
- let watchLintRunner: LintWithProgramRunner | undefined;
253
+ // js=false 경로에서 SdTsCompiler 인스턴스를 유지하여 증분 빌드를 지원한다
254
+ let watchCompiler: SdTsCompiler | undefined;
266
255
 
267
256
  /**
268
257
  * esbuild + tsc 리빌드 (watch 모드)
269
258
  * js=true: esbuildCtx.rebuild() 단일 호출 (tsc 플러그인 자동 트리거)
270
- * js=false: runTscPackageBuild 직접 호출
259
+ * js=false: SdTsCompiler.compileAsync() 직접 호출
271
260
  */
272
261
  async function rebuildAll(): Promise<ServerCombinedBuildEvent> {
273
262
  logger.debug(`[${info.name}] rebuildAll 시작`);
274
263
  const mainJsPath = pathx.posixResolve(info.pkgDir, "dist", "main.js");
275
264
 
276
265
  let jsResult: { success: boolean; errors?: string[]; warnings?: string[] };
277
- let tscProgram: ts.Program | undefined;
278
- let tscAffectedFiles: ReadonlySet<string> | undefined;
279
266
  let tscErrors: string[];
267
+ let lint: LintWithProgramResult | undefined;
280
268
 
281
269
  if (info.output.js) {
282
270
  // js=true: esbuildCtx.rebuild() 단일 호출 (tsc 에러 자동 병합)
283
271
  const rebuildResult = await esbuildCtx.rebuild();
284
272
  jsResult = rebuildResult ?? { success: true, errors: undefined, warnings: undefined };
285
- tscProgram = esbuildCtx.getTscProgram();
286
- tscAffectedFiles = esbuildCtx.getTscAffectedFiles();
287
273
  tscErrors = [];
274
+ lint = esbuildCtx.getTscLintResult();
288
275
  } else {
289
- // js=false: runTscPackageBuild 직접 호출
290
- const parsedConfig = parseTsconfig(info.pkgDir);
291
- const tscResult = runTscPackageBuild({
292
- pkgDir: info.pkgDir,
293
- cwd: info.cwd,
294
- output: { js: false, dts: info.output.dts },
295
- parsedConfig,
296
- env: info.output.env,
297
- includeTests: info.output.includeTests,
298
- oldBuilderProgram: lastBuilderProgram,
299
- });
300
- lastBuilderProgram = tscResult.builderProgram ?? lastBuilderProgram;
301
-
302
- jsResult = { success: true, errors: undefined, warnings: undefined };
303
- tscProgram = tscResult.program;
304
- tscAffectedFiles = tscResult.affectedFiles;
305
- tscErrors = tscResult.errors ?? [];
306
- }
307
-
308
- // lint 실행 (활성화 + program 사용 가능 시)
309
- let lint: LintWithProgramResult | undefined;
310
- if (info.output.lint === true && tscProgram != null) {
311
- logger.debug(`[${info.name}] lint 시작`);
312
- if (watchLintRunner == null) {
313
- watchLintRunner = new LintWithProgramRunner({
276
+ // js=false: SdTsCompiler 직접 호출
277
+ if (watchCompiler == null) {
278
+ watchCompiler = new SdTsCompiler({
279
+ pkgDir: info.pkgDir,
314
280
  cwd: info.cwd,
315
- pkgName: info.name,
281
+ output: { js: false, dts: info.output.dts },
282
+ env: info.output.env,
283
+ includeTests: info.output.includeTests,
284
+ lint: info.output.lint,
316
285
  });
317
286
  }
318
- lint = await watchLintRunner.lint({
319
- program: tscProgram,
320
- affectedFiles: tscAffectedFiles,
321
- });
322
- logger.debug(`[${info.name}] lint 완료`);
287
+ const tscResult = await watchCompiler.compileAsync();
288
+
289
+ jsResult = { success: true, errors: undefined, warnings: undefined };
290
+ tscErrors = tscResult.errors ?? [];
291
+ lint = tscResult.lint;
323
292
  }
324
293
 
325
294
  const allErrors = [...(jsResult.errors ?? []), ...tscErrors];
@@ -355,6 +324,7 @@ async function startWatch(info: ServerWatchInfo): Promise<void> {
355
324
  output: { dts: info.output.dts },
356
325
  env: info.output.env,
357
326
  includeTests: info.output.includeTests,
327
+ lint: info.output.lint,
358
328
  },
359
329
  });
360
330
  }
@@ -1,6 +1,7 @@
1
1
  import type ts from "typescript";
2
2
  import esbuild from "esbuild";
3
3
  import { err as errNs } from "@simplysm/core-common";
4
+ import { formatEsbuildMessages } from "../utils/output-utils";
4
5
  import {
5
6
  createServerEsbuildOptions,
6
7
  writeChangedOutputFiles,
@@ -8,6 +9,7 @@ import {
8
9
  import { createTscPlugin, type TscPluginResult } from "../esbuild/esbuild-tsc-plugin";
9
10
  import type { TypecheckEnv } from "../utils/tsconfig";
10
11
  import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization";
12
+ import type { LintWithProgramResult } from "../lint/lint-with-program";
11
13
 
12
14
  /**
13
15
  * esbuild watch context 생성 옵션
@@ -23,6 +25,7 @@ export interface EsbuildContextOptions {
23
25
  output: { dts: boolean };
24
26
  env?: TypecheckEnv;
25
27
  includeTests?: boolean;
28
+ lint?: boolean;
26
29
  };
27
30
  }
28
31
 
@@ -47,6 +50,7 @@ export async function createContext(options: EsbuildContextOptions): Promise<voi
47
50
  output: options.tsc.output,
48
51
  env: options.tsc.env,
49
52
  includeTests: options.tsc.includeTests,
53
+ lint: options.tsc.lint,
50
54
  });
51
55
  }
52
56
 
@@ -98,10 +102,10 @@ export async function rebuild(): Promise<{
98
102
  await writeChangedOutputFiles(result.outputFiles);
99
103
  }
100
104
 
101
- const esbuildErrors = result.errors.map((e) => e.text);
105
+ const esbuildErrors = formatEsbuildMessages(result.errors, "error");
102
106
  const tscErrors = tscPlugin?.getErrors() ?? [];
103
107
  const allErrors = [...esbuildErrors, ...tscErrors];
104
- const warnings = result.warnings.map((w) => w.text);
108
+ const warnings = formatEsbuildMessages(result.warnings, "warning");
105
109
 
106
110
  return {
107
111
  success: allErrors.length === 0,
@@ -188,3 +192,11 @@ export function getTscAffectedFiles(): ReadonlySet<string> | undefined {
188
192
  export function getTscDiagnostics(): SerializedDiagnostic[] {
189
193
  return tscPlugin?.getDiagnostics() ?? [];
190
194
  }
195
+
196
+ /**
197
+ * tsc 플러그인의 lint 결과를 반환한다.
198
+ * 플러그인이 없거나 lint가 비활성이면 undefined를 반환한다.
199
+ */
200
+ export function getTscLintResult(): LintWithProgramResult | undefined {
201
+ return tscPlugin?.getLintResult();
202
+ }
@@ -0,0 +1,3 @@
1
+ body {
2
+ color: blue;
3
+ }
@@ -0,0 +1,5 @@
1
+ @use 'variables' as vars;
2
+
3
+ body {
4
+ color: vars.$primary;
5
+ }
@@ -0,0 +1,13 @@
1
+ # vite-angular-plugin SdTsCompiler 전환 — LLM 검증
2
+
3
+ ## 검증 항목
4
+
5
+ - [x] AngularBuildPipeline import 제거: `vite-angular-plugin.ts:6` — `SdTsCompiler` import으로 교체, `AngularBuildPipeline` 미사용
6
+ - [x] SdTsCompiler 인스턴스 생성: `:69-81` — `new SdTsCompiler({ pkgDir, cwd, output: { js: true, dts: false }, sourceFileCache, compilerOptionsTransformer })` 올바르게 구성
7
+ - [x] compileAsync 호출: `:90` — `sdTsCompiler.compileAsync(modifiedFiles)` 호출, modifiedFiles는 pendingWatchChanges에서 수집
8
+ - [x] emitResults → emittedFilesBySource 매핑: `:93-95` — `pathx.posix(sourceFileName)` 키로 저장
9
+ - [x] transform 훅: `:107-124` — `emittedFilesBySource.get(normalizedId)` 조회, 인라인 소스맵 분리 유지
10
+ - [x] buildEnd에서 sdTsCompiler 참조 해제: `:127` — `sdTsCompiler = undefined`
11
+ - [x] watch 모드 증분 빌드: `:61-66` — pendingWatchChanges를 modifiedFiles로 전달, compileAsync에서 증분 처리
12
+ - [x] 이미 초기화됐고 변경 없으면 건너뜀: `:84-87` — `emittedFilesBySource.size > 0 && modifiedFiles == null` 조건
13
+ - [x] 기존 테스트 회귀: vite-angular-plugin.spec.ts 6개, vite-angular-plugin-vitest.spec.ts + legacy-watch.spec.ts 5개 모두 통과