@simplysm/sd-cli 14.0.42 → 14.0.44

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 (338) 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 +41 -37
  10. package/dist/angular/ngtsc-build-core.d.ts.map +1 -1
  11. package/dist/angular/ngtsc-build-core.js +155 -52
  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.d.ts.map +1 -1
  36. package/dist/commands/publish/version-upgrade.js +16 -13
  37. package/dist/commands/publish/version-upgrade.js.map +1 -1
  38. package/dist/commands/replace-deps.d.ts.map +1 -1
  39. package/dist/commands/replace-deps.js +2 -1
  40. package/dist/commands/replace-deps.js.map +1 -1
  41. package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -1
  42. package/dist/deps/replace-deps/collect-deps.js +5 -2
  43. package/dist/deps/replace-deps/collect-deps.js.map +1 -1
  44. package/dist/deps/replace-deps/replace-deps-resolve.d.ts.map +1 -1
  45. package/dist/deps/replace-deps/replace-deps-resolve.js +6 -7
  46. package/dist/deps/replace-deps/replace-deps-resolve.js.map +1 -1
  47. package/dist/deps/replace-deps/replace-deps.d.ts +21 -3
  48. package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -1
  49. package/dist/deps/replace-deps/replace-deps.js +175 -66
  50. package/dist/deps/replace-deps/replace-deps.js.map +1 -1
  51. package/dist/electron/electron.js +7 -7
  52. package/dist/electron/electron.js.map +1 -1
  53. package/dist/engines/BaseEngine.d.ts.map +1 -1
  54. package/dist/engines/BaseEngine.js +2 -5
  55. package/dist/engines/BaseEngine.js.map +1 -1
  56. package/dist/engines/EsbuildClientEngine.d.ts.map +1 -1
  57. package/dist/engines/EsbuildClientEngine.js +16 -9
  58. package/dist/engines/EsbuildClientEngine.js.map +1 -1
  59. package/dist/engines/NgtscEngine.d.ts +4 -4
  60. package/dist/engines/NgtscEngine.d.ts.map +1 -1
  61. package/dist/engines/NgtscEngine.js +5 -5
  62. package/dist/engines/NgtscEngine.js.map +1 -1
  63. package/dist/engines/TscEngine.d.ts.map +1 -1
  64. package/dist/engines/TscEngine.js +0 -2
  65. package/dist/engines/TscEngine.js.map +1 -1
  66. package/dist/engines/types.d.ts +2 -0
  67. package/dist/engines/types.d.ts.map +1 -1
  68. package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts +36 -0
  69. package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts.map +1 -0
  70. package/dist/esbuild/esbuild-angular-compiler-plugin.js +464 -0
  71. package/dist/esbuild/esbuild-angular-compiler-plugin.js.map +1 -0
  72. package/dist/esbuild/esbuild-client-config.d.ts +8 -2
  73. package/dist/esbuild/esbuild-client-config.d.ts.map +1 -1
  74. package/dist/esbuild/esbuild-client-config.js +48 -33
  75. package/dist/esbuild/esbuild-client-config.js.map +1 -1
  76. package/dist/esbuild/esbuild-postcss-plugin.d.ts.map +1 -1
  77. package/dist/esbuild/esbuild-postcss-plugin.js +9 -6
  78. package/dist/esbuild/esbuild-postcss-plugin.js.map +1 -1
  79. package/dist/esbuild/esbuild-tsc-plugin.d.ts +4 -1
  80. package/dist/esbuild/esbuild-tsc-plugin.d.ts.map +1 -1
  81. package/dist/esbuild/esbuild-tsc-plugin.js +27 -23
  82. package/dist/esbuild/esbuild-tsc-plugin.js.map +1 -1
  83. package/dist/esbuild/file-reference-tracker.d.ts +24 -0
  84. package/dist/esbuild/file-reference-tracker.d.ts.map +1 -0
  85. package/dist/esbuild/file-reference-tracker.js +57 -0
  86. package/dist/esbuild/file-reference-tracker.js.map +1 -0
  87. package/dist/esbuild/lmdb-cache-store.d.ts +18 -0
  88. package/dist/esbuild/lmdb-cache-store.d.ts.map +1 -0
  89. package/dist/esbuild/lmdb-cache-store.js +41 -0
  90. package/dist/esbuild/lmdb-cache-store.js.map +1 -0
  91. package/dist/esbuild/load-result-cache.d.ts +17 -0
  92. package/dist/esbuild/load-result-cache.d.ts.map +1 -0
  93. package/dist/esbuild/load-result-cache.js +61 -0
  94. package/dist/esbuild/load-result-cache.js.map +1 -0
  95. package/dist/index.d.ts +3 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +2 -0
  98. package/dist/index.js.map +1 -1
  99. package/dist/lint/lint-core.js +7 -7
  100. package/dist/lint/lint-core.js.map +1 -1
  101. package/dist/orchestrators/BaseOrchestrator.js +2 -2
  102. package/dist/orchestrators/BaseOrchestrator.js.map +1 -1
  103. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  104. package/dist/orchestrators/BuildOrchestrator.js +5 -19
  105. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  106. package/dist/orchestrators/DevOrchestrator.js +5 -5
  107. package/dist/orchestrators/DevOrchestrator.js.map +1 -1
  108. package/dist/orchestrators/WatchOrchestrator.js +6 -6
  109. package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
  110. package/dist/runtime/ResultCollector.d.ts +1 -0
  111. package/dist/runtime/ResultCollector.d.ts.map +1 -1
  112. package/dist/runtime/ResultCollector.js.map +1 -1
  113. package/dist/runtime/engine-watch-events.d.ts.map +1 -1
  114. package/dist/runtime/engine-watch-events.js +3 -0
  115. package/dist/runtime/engine-watch-events.js.map +1 -1
  116. package/dist/runtime/rebuild-manager.js +1 -1
  117. package/dist/runtime/rebuild-manager.js.map +1 -1
  118. package/dist/runtime/worker-utils.js +1 -1
  119. package/dist/runtime/worker-utils.js.map +1 -1
  120. package/dist/sd-cli-entry.d.ts.map +1 -1
  121. package/dist/sd-cli-entry.js +4 -3
  122. package/dist/sd-cli-entry.js.map +1 -1
  123. package/dist/sd-cli.js +3 -3
  124. package/dist/sd-cli.js.map +1 -1
  125. package/dist/ts-compiler/SdTsCompiler.d.ts +39 -0
  126. package/dist/ts-compiler/SdTsCompiler.d.ts.map +1 -0
  127. package/dist/ts-compiler/SdTsCompiler.js +593 -0
  128. package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
  129. package/dist/ts-compiler/sd-ts-compiler-options.d.ts +40 -0
  130. package/dist/ts-compiler/sd-ts-compiler-options.d.ts.map +1 -0
  131. package/dist/ts-compiler/sd-ts-compiler-options.js +2 -0
  132. package/dist/ts-compiler/sd-ts-compiler-options.js.map +1 -0
  133. package/dist/ts-compiler/sd-ts-compiler-result.d.ts +34 -0
  134. package/dist/ts-compiler/sd-ts-compiler-result.d.ts.map +1 -0
  135. package/dist/ts-compiler/sd-ts-compiler-result.js +2 -0
  136. package/dist/ts-compiler/sd-ts-compiler-result.js.map +1 -0
  137. package/dist/utils/copy-public.d.ts +6 -4
  138. package/dist/utils/copy-public.d.ts.map +1 -1
  139. package/dist/utils/copy-public.js +9 -7
  140. package/dist/utils/copy-public.js.map +1 -1
  141. package/dist/utils/diagnostic-utils.d.ts +2 -3
  142. package/dist/utils/diagnostic-utils.d.ts.map +1 -1
  143. package/dist/utils/diagnostic-utils.js +8 -9
  144. package/dist/utils/diagnostic-utils.js.map +1 -1
  145. package/dist/utils/output-utils.d.ts +8 -2
  146. package/dist/utils/output-utils.d.ts.map +1 -1
  147. package/dist/utils/output-utils.js +32 -8
  148. package/dist/utils/output-utils.js.map +1 -1
  149. package/dist/workers/client.worker.d.ts +1 -1
  150. package/dist/workers/client.worker.d.ts.map +1 -1
  151. package/dist/workers/client.worker.js +115 -110
  152. package/dist/workers/client.worker.js.map +1 -1
  153. package/dist/workers/incremental-mtime-tracker.d.ts +13 -0
  154. package/dist/workers/incremental-mtime-tracker.d.ts.map +1 -0
  155. package/dist/workers/incremental-mtime-tracker.js +65 -0
  156. package/dist/workers/incremental-mtime-tracker.js.map +1 -0
  157. package/dist/workers/library-build.worker.d.ts +0 -2
  158. package/dist/workers/library-build.worker.d.ts.map +1 -1
  159. package/dist/workers/library-build.worker.js +169 -70
  160. package/dist/workers/library-build.worker.js.map +1 -1
  161. package/dist/workers/server-build.worker.d.ts.map +1 -1
  162. package/dist/workers/server-build.worker.js +30 -57
  163. package/dist/workers/server-build.worker.js.map +1 -1
  164. package/dist/workers/server-esbuild-context.d.ts +7 -0
  165. package/dist/workers/server-esbuild-context.d.ts.map +1 -1
  166. package/dist/workers/server-esbuild-context.js +11 -2
  167. package/dist/workers/server-esbuild-context.js.map +1 -1
  168. package/package.json +5 -4
  169. package/src/angular/angular-compiler.ts +0 -502
  170. package/src/angular/hmr-candidates.ts +295 -0
  171. package/src/angular/ngtsc-build-core.ts +192 -91
  172. package/src/angular/vite-angular-plugin.ts +71 -65
  173. package/src/angular/web-worker-transformer.ts +117 -0
  174. package/src/capacitor/capacitor.ts +6 -4
  175. package/src/commands/check.ts +17 -76
  176. package/src/commands/publish/deployment-phase.ts +11 -7
  177. package/src/commands/publish/npm-publisher.ts +1 -1
  178. package/src/commands/publish/publish-command.ts +1 -1
  179. package/src/commands/publish/version-upgrade.ts +44 -35
  180. package/src/commands/replace-deps.ts +3 -1
  181. package/src/deps/replace-deps/collect-deps.ts +4 -2
  182. package/src/deps/replace-deps/replace-deps-resolve.ts +12 -7
  183. package/src/deps/replace-deps/replace-deps.ts +191 -69
  184. package/src/electron/electron.ts +7 -7
  185. package/src/engines/BaseEngine.ts +2 -6
  186. package/src/engines/EsbuildClientEngine.ts +16 -10
  187. package/src/engines/NgtscEngine.ts +7 -7
  188. package/src/engines/TscEngine.ts +0 -2
  189. package/src/engines/types.ts +2 -0
  190. package/src/esbuild/esbuild-angular-compiler-plugin.ts +647 -0
  191. package/src/esbuild/esbuild-client-config.ts +57 -41
  192. package/src/esbuild/esbuild-postcss-plugin.ts +9 -6
  193. package/src/esbuild/esbuild-tsc-plugin.ts +33 -23
  194. package/src/esbuild/file-reference-tracker.ts +61 -0
  195. package/src/esbuild/lmdb-cache-store.ts +46 -0
  196. package/src/esbuild/load-result-cache.ts +85 -0
  197. package/src/index.ts +5 -0
  198. package/src/lint/lint-core.ts +7 -7
  199. package/src/orchestrators/BaseOrchestrator.ts +2 -2
  200. package/src/orchestrators/BuildOrchestrator.ts +5 -24
  201. package/src/orchestrators/DevOrchestrator.ts +5 -5
  202. package/src/orchestrators/WatchOrchestrator.ts +6 -6
  203. package/src/runtime/ResultCollector.ts +1 -0
  204. package/src/runtime/engine-watch-events.ts +3 -0
  205. package/src/runtime/rebuild-manager.ts +1 -1
  206. package/src/runtime/worker-utils.ts +1 -1
  207. package/src/sd-cli-entry.ts +5 -3
  208. package/src/sd-cli.ts +4 -4
  209. package/src/ts-compiler/SdTsCompiler.ts +815 -0
  210. package/src/ts-compiler/sd-ts-compiler-options.ts +46 -0
  211. package/src/ts-compiler/sd-ts-compiler-result.ts +34 -0
  212. package/src/utils/copy-public.ts +9 -6
  213. package/src/utils/diagnostic-utils.ts +8 -9
  214. package/src/utils/output-utils.ts +38 -8
  215. package/src/workers/client.worker.ts +141 -126
  216. package/src/workers/incremental-mtime-tracker.ts +68 -0
  217. package/src/workers/library-build.worker.ts +214 -75
  218. package/src/workers/server-build.worker.ts +31 -61
  219. package/src/workers/server-esbuild-context.ts +14 -2
  220. package/tests/angular/fixtures/packages/basic-app/dist/styles.css +3 -0
  221. package/tests/angular/fixtures/packages/basic-app/scss/styles.scss +5 -0
  222. package/tests/angular/ngtsc-build-core.acc.spec.ts +210 -0
  223. package/tests/angular/ngtsc-build-core.spec.ts +52 -0
  224. package/tests/angular/vite-angular-plugin-sdtscompiler.verify.md +13 -0
  225. package/tests/angular/web-worker-transformer.spec.ts +154 -0
  226. package/tests/capacitor/capacitor-build.spec.ts +1 -1
  227. package/tests/capacitor/capacitor-icon.spec.ts +1 -1
  228. package/tests/capacitor/capacitor-init.spec.ts +1 -1
  229. package/tests/commands/check.spec.ts +90 -104
  230. package/tests/commands/publish.spec.ts +12 -4
  231. package/tests/commands/slice3-severity-cleanup.verify.md +12 -0
  232. package/tests/commands/version-upgrade.acc.spec.ts +210 -0
  233. package/tests/commands/version-upgrade.spec.ts +148 -0
  234. package/tests/deps/replace-deps/collect-deps.acc.spec.ts +62 -0
  235. package/tests/deps/replace-deps/collect-deps.spec.ts +49 -0
  236. package/tests/deps/replace-deps/replace-deps-filter.spec.ts +103 -0
  237. package/tests/deps/replace-deps/replace-deps-perf.verify.md +15 -0
  238. package/tests/deps/replace-deps/replace-deps-resolve.acc.spec.ts +124 -0
  239. package/tests/deps/replace-deps/replace-deps-setup.acc.spec.ts +156 -0
  240. package/tests/electron/electron.spec.ts +4 -1
  241. package/tests/engines/engine-adapter-isolation.spec.ts +5 -6
  242. package/tests/engines/engine-duplicate-output-removal.verify.md +10 -0
  243. package/tests/engines/esbuild-client-engine.acc.spec.ts +79 -0
  244. package/tests/engines/esbuild-client-engine.spec.ts +73 -3
  245. package/tests/esbuild/esbuild-angular-compiler-plugin-hmr.verify.md +23 -0
  246. package/tests/esbuild/esbuild-angular-compiler-plugin-onload.verify.md +21 -0
  247. package/tests/esbuild/esbuild-angular-compiler-plugin-onstart-extraction.verify.md +16 -0
  248. package/tests/esbuild/esbuild-angular-compiler-plugin-sdtscompiler.verify.md +15 -0
  249. package/tests/esbuild/esbuild-angular-compiler-plugin-stylesheet.verify.md +31 -0
  250. package/tests/esbuild/esbuild-angular-compiler-plugin-worker.verify.md +31 -0
  251. package/tests/esbuild/esbuild-angular-compiler-plugin.spec.ts +397 -0
  252. package/tests/esbuild/esbuild-angular-compiler-plugin.verify.md +21 -0
  253. package/tests/esbuild/esbuild-postcss-plugin-chunking.verify.md +17 -0
  254. package/tests/esbuild/esbuild-postcss-plugin.acc.spec.ts +152 -0
  255. package/tests/esbuild/esbuild-tsc-plugin-imports.verify.md +13 -0
  256. package/tests/esbuild/esbuild-tsc-plugin.acc.spec.ts +56 -111
  257. package/tests/esbuild/esbuild-tsc-plugin.spec.ts +116 -52
  258. package/tests/esbuild/file-reference-tracker.spec.ts +99 -0
  259. package/tests/esbuild/lmdb-cache-store.spec.ts +58 -0
  260. package/tests/esbuild/load-result-cache.acc.spec.ts +55 -0
  261. package/tests/esbuild/load-result-cache.spec.ts +133 -0
  262. package/tests/orchestrators/build-orchestrator.spec.ts +4 -3
  263. package/tests/orchestrators/dev-orchestrator.spec.ts +5 -5
  264. package/tests/orchestrators/slice1-stdout-to-consola.verify.md +10 -0
  265. package/tests/orchestrators/typecheck-orchestrator.spec.ts +1 -1
  266. package/tests/orchestrators/watch-orchestrator.spec.ts +7 -7
  267. package/tests/runtime/result-collector.spec.ts +64 -0
  268. package/tests/sd-cli-entry.spec.ts +3 -4
  269. package/tests/sd-cli-log-tag.verify.md +11 -0
  270. package/tests/ts-compiler/SdTsCompiler-affected-files.verify.md +8 -0
  271. package/tests/ts-compiler/SdTsCompiler-diagnostics.verify.md +12 -0
  272. package/tests/ts-compiler/SdTsCompiler-emit.verify.md +9 -0
  273. package/tests/ts-compiler/SdTsCompiler.acc.spec.ts +603 -0
  274. package/tests/ts-compiler/SdTsCompiler.spec.ts +265 -0
  275. package/tests/ts-compiler/SdTsCompiler.verify.md +41 -0
  276. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-browser.tsbuildinfo +1 -0
  277. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-node.tsbuildinfo +1 -0
  278. package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck.tsbuildinfo +1 -0
  279. package/tests/ts-compiler/fixtures/non-angular-pkg/src/index.ts +3 -0
  280. package/tests/ts-compiler/fixtures/non-angular-pkg/src/util.ts +3 -0
  281. package/tests/ts-compiler/fixtures/non-angular-pkg/tests/sample.test-file.ts +3 -0
  282. package/tests/ts-compiler/fixtures/non-angular-pkg/tsconfig.json +12 -0
  283. package/tests/ts-compiler/scss-lint-integration.verify.md +14 -0
  284. package/tests/utils/angular-build.spec.ts +1 -1
  285. package/tests/utils/copy-public-outdir.verify.md +8 -0
  286. package/tests/utils/copy-public.acc.spec.ts +52 -0
  287. package/tests/utils/copy-public.spec.ts +56 -0
  288. package/tests/utils/diagnostic-utils.spec.ts +24 -15
  289. package/tests/utils/engine-watch-events.acc.spec.ts +59 -0
  290. package/tests/utils/engine-watch-events.spec.ts +58 -0
  291. package/tests/utils/esbuild-client-config-integration.verify.md +9 -0
  292. package/tests/utils/esbuild-client-config.acc.spec.ts +45 -61
  293. package/tests/utils/esbuild-client-config.spec.ts +70 -52
  294. package/tests/utils/ngtsc-build-core-write-emit.spec.ts +136 -12
  295. package/tests/utils/ngtsc-build-core.spec.ts +1 -44
  296. package/tests/utils/output-utils.spec.ts +133 -13
  297. package/tests/utils/replace-deps-watch.acc.spec.ts +7 -1
  298. package/tests/utils/replace-deps-watch.spec.ts +57 -1
  299. package/tests/utils/worker-utils.spec.ts +8 -2
  300. package/tests/workers/client-worker-initial-build-error.verify.md +2 -3
  301. package/tests/workers/client-worker-initial-build-warnings.verify.md +7 -0
  302. package/tests/workers/client-worker-mtime-incremental.verify.md +10 -0
  303. package/tests/workers/client-worker-refactor.verify.md +22 -0
  304. package/tests/workers/client-worker-ts-cache-invalidation.verify.md +12 -0
  305. package/tests/workers/client-worker.acc.spec.ts +6 -3
  306. package/tests/workers/incremental-mtime-tracker.acc.spec.ts +144 -0
  307. package/tests/workers/incremental-mtime-tracker.spec.ts +102 -0
  308. package/tests/workers/library-build-lint.spec.ts +40 -45
  309. package/tests/workers/library-build-worker.spec.ts +298 -40
  310. package/tests/workers/server-build-lint.spec.ts +59 -45
  311. package/tests/workers/server-build-worker.spec.ts +63 -24
  312. package/tests/workers/server-esbuild-context.acc.spec.ts +2 -0
  313. package/tests/workers/server-esbuild-context.spec.ts +2 -0
  314. package/tests/workers/server-runtime-worker.spec.ts +1 -1
  315. package/tests/workers/shared-worker-lifecycle.acc.spec.ts +1 -1
  316. package/dist/angular/angular-build-pipeline.d.ts +0 -97
  317. package/dist/angular/angular-build-pipeline.d.ts.map +0 -1
  318. package/dist/angular/angular-build-pipeline.js +0 -285
  319. package/dist/angular/angular-build-pipeline.js.map +0 -1
  320. package/dist/utils/tsc-build.d.ts +0 -51
  321. package/dist/utils/tsc-build.d.ts.map +0 -1
  322. package/dist/utils/tsc-build.js +0 -156
  323. package/dist/utils/tsc-build.js.map +0 -1
  324. package/dist/workers/ngtsc-build.worker.d.ts +0 -23
  325. package/dist/workers/ngtsc-build.worker.d.ts.map +0 -1
  326. package/dist/workers/ngtsc-build.worker.js +0 -267
  327. package/dist/workers/ngtsc-build.worker.js.map +0 -1
  328. package/src/angular/angular-build-pipeline.ts +0 -406
  329. package/src/utils/tsc-build.ts +0 -226
  330. package/src/workers/ngtsc-build.worker.ts +0 -351
  331. package/tests/angular/angular-build-pipeline.spec.ts +0 -247
  332. package/tests/angular/angular-compiler-aot.acc.spec.ts +0 -68
  333. package/tests/angular/angular-compiler-aot.spec.ts +0 -80
  334. package/tests/utils/angular-compiler-emit.spec.ts +0 -666
  335. package/tests/utils/angular-compiler.spec.ts +0 -707
  336. package/tests/utils/tsc-build.spec.ts +0 -527
  337. package/tests/workers/ngtsc-build-lint.spec.ts +0 -141
  338. package/tests/workers/ngtsc-build-worker.spec.ts +0 -199
@@ -1,666 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from "vitest";
2
- import ts from "typescript";
3
- import path from "path";
4
- import fs from "fs";
5
- import os from "os";
6
-
7
- // --- Mock Setup ---
8
-
9
- const mockAnalyzeAsync = vi.fn().mockResolvedValue(undefined);
10
- const mockGetDiagnosticsForFile = vi.fn().mockReturnValue([]);
11
- const mockGetOptionDiagnostics = vi.fn().mockReturnValue([]);
12
- const mockGetResourceDependencies = vi.fn().mockReturnValue([]);
13
- const mockIgnoreForDiagnostics = new Set<ts.SourceFile>();
14
- const mockIgnoreForEmit = new Set<ts.SourceFile>();
15
- const mockSafeToSkipEmit = vi.fn().mockReturnValue(false);
16
- const mockRecordSuccessfulEmit = vi.fn();
17
- const mockPrepareEmit = vi.fn().mockReturnValue({
18
- transformers: { before: [], after: [] },
19
- });
20
-
21
- const ngtscConstructorSpy = vi.fn();
22
-
23
- function createRealTsProgram(
24
- files: Record<string, string> = { "index.ts": "export const x = 1;" },
25
- extraOptions: ts.CompilerOptions = {},
26
- ): { program: ts.Program; dir: string; rootNames: string[] } {
27
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), "angular-compiler-test-"));
28
- const rootNames: string[] = [];
29
- for (const [name, content] of Object.entries(files)) {
30
- const filePath = path.join(dir, name);
31
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
32
- fs.writeFileSync(filePath, content, "utf-8");
33
- rootNames.push(filePath);
34
- }
35
-
36
- const options: ts.CompilerOptions = {
37
- target: ts.ScriptTarget.ESNext,
38
- module: ts.ModuleKind.ESNext,
39
- moduleResolution: ts.ModuleResolutionKind.Bundler,
40
- strict: false,
41
- skipLibCheck: true,
42
- types: [],
43
- outDir: path.join(dir, "out"),
44
- ...extraOptions,
45
- };
46
- const host = ts.createCompilerHost(options);
47
- const program = ts.createProgram(rootNames, options, host);
48
- return { program, dir, rootNames };
49
- }
50
-
51
- let realProgram: { program: ts.Program; dir: string; rootNames: string[] };
52
-
53
- vi.mock("../../src/angular/angular-build", () => {
54
- class NgtscProgram {
55
- compiler = {
56
- analyzeAsync: mockAnalyzeAsync,
57
- getDiagnosticsForFile: mockGetDiagnosticsForFile,
58
- getOptionDiagnostics: mockGetOptionDiagnostics,
59
- getResourceDependencies: mockGetResourceDependencies,
60
- ignoreForDiagnostics: mockIgnoreForDiagnostics,
61
- ignoreForEmit: mockIgnoreForEmit,
62
- incrementalCompilation: {
63
- safeToSkipEmit: mockSafeToSkipEmit,
64
- recordSuccessfulEmit: mockRecordSuccessfulEmit,
65
- },
66
- prepareEmit: mockPrepareEmit,
67
- };
68
- constructor(...args: unknown[]) {
69
- ngtscConstructorSpy(...args);
70
- }
71
- getTsProgram() {
72
- return realProgram.program;
73
- }
74
- }
75
- return {
76
- NgtscProgram,
77
- OptimizeFor: { WholeProgram: 0, SingleFile: 1 },
78
- };
79
- });
80
-
81
- const { AngularCompiler, AngularSourceFileCache } = await import(
82
- "../../src/angular/angular-compiler"
83
- );
84
-
85
- // --- Common beforeEach ---
86
-
87
- beforeEach(() => {
88
- vi.clearAllMocks();
89
- mockIgnoreForDiagnostics.clear();
90
- mockIgnoreForEmit.clear();
91
- mockGetResourceDependencies.mockReturnValue([]);
92
- mockGetDiagnosticsForFile.mockReturnValue([]);
93
- mockSafeToSkipEmit.mockReturnValue(false);
94
- mockRecordSuccessfulEmit.mockReset();
95
- mockPrepareEmit.mockReturnValue({
96
- transformers: { before: [], after: [] },
97
- });
98
-
99
- realProgram = createRealTsProgram();
100
- });
101
-
102
- // =============================================================================
103
- // emitAffectedFiles — Unit Tests
104
- // =============================================================================
105
-
106
- describe("emitAffectedFiles — Unit Tests", () => {
107
- it("initialize() 전 호출 시 에러를 던진다", () => {
108
- const compiler = new AngularCompiler({
109
- rootNames: ["src/main.ts"],
110
- compilerOptions: { target: ts.ScriptTarget.ESNext },
111
- });
112
-
113
- expect(() => [...compiler.emitAffectedFiles()]).toThrow("initialize()");
114
- });
115
-
116
- it("noEmit=true이면 빈 Iterator를 반환한다", async () => {
117
- realProgram = createRealTsProgram({ "index.ts": "export const x = 1;" }, { noEmit: true });
118
-
119
- const compiler = new AngularCompiler({
120
- rootNames: realProgram.rootNames,
121
- compilerOptions: {
122
- target: ts.ScriptTarget.ESNext,
123
- module: ts.ModuleKind.ESNext,
124
- moduleResolution: ts.ModuleResolutionKind.Bundler,
125
- skipLibCheck: true,
126
- types: [],
127
- noEmit: true,
128
- },
129
- });
130
-
131
- await compiler.initialize();
132
-
133
- const results = [...compiler.emitAffectedFiles()];
134
- expect(results).toHaveLength(0);
135
- });
136
-
137
- it("ignoreForEmit에 포함된 파일은 emit되지 않는다", async () => {
138
- const compiler = new AngularCompiler({
139
- rootNames: realProgram.rootNames,
140
- compilerOptions: {
141
- target: ts.ScriptTarget.ESNext,
142
- module: ts.ModuleKind.ESNext,
143
- moduleResolution: ts.ModuleResolutionKind.Bundler,
144
- skipLibCheck: true,
145
- types: [],
146
- },
147
- });
148
-
149
- await compiler.initialize();
150
-
151
- const tsProgram = compiler.getTsProgram();
152
- for (const sf of tsProgram.getSourceFiles()) {
153
- mockIgnoreForEmit.add(sf);
154
- }
155
-
156
- const results = [...compiler.emitAffectedFiles()];
157
- expect(results).toHaveLength(0);
158
- });
159
-
160
- it("declaration file은 2차 루프에서 skip된다", async () => {
161
- const compiler = new AngularCompiler({
162
- rootNames: realProgram.rootNames,
163
- compilerOptions: {
164
- target: ts.ScriptTarget.ESNext,
165
- module: ts.ModuleKind.ESNext,
166
- moduleResolution: ts.ModuleResolutionKind.Bundler,
167
- skipLibCheck: true,
168
- types: [],
169
- },
170
- });
171
-
172
- await compiler.initialize();
173
-
174
- const results = [...compiler.emitAffectedFiles()];
175
- const hasNodeModules = results.some((r) => r.filename.includes("node_modules"));
176
- expect(hasNodeModules).toBe(false);
177
- });
178
-
179
- it("sourceFilter가 적용되면 필터를 통과하지 못한 파일은 결과에 포함되지 않는다", async () => {
180
- realProgram = createRealTsProgram({
181
- "a.ts": "export const a = 1;",
182
- "b.ts": "export const b = 2;",
183
- });
184
-
185
- const compiler = new AngularCompiler({
186
- rootNames: realProgram.rootNames,
187
- compilerOptions: {
188
- target: ts.ScriptTarget.ESNext,
189
- module: ts.ModuleKind.ESNext,
190
- moduleResolution: ts.ModuleResolutionKind.Bundler,
191
- skipLibCheck: true,
192
- types: [],
193
- },
194
- });
195
-
196
- await compiler.initialize();
197
-
198
- const results = [
199
- ...compiler.emitAffectedFiles({
200
- sourceFilter: (fileName: string) => fileName.includes("a.ts"),
201
- }),
202
- ];
203
-
204
- expect(results.length).toBeGreaterThan(0);
205
- for (const r of results) {
206
- expect(r.sourceFileName).toContain("a.ts");
207
- }
208
- });
209
-
210
- it("EmitResult는 filename과 contents를 포함한다", async () => {
211
- const compiler = new AngularCompiler({
212
- rootNames: realProgram.rootNames,
213
- compilerOptions: {
214
- target: ts.ScriptTarget.ESNext,
215
- module: ts.ModuleKind.ESNext,
216
- moduleResolution: ts.ModuleResolutionKind.Bundler,
217
- skipLibCheck: true,
218
- types: [],
219
- },
220
- });
221
-
222
- await compiler.initialize();
223
-
224
- const results = [...compiler.emitAffectedFiles()];
225
- expect(results.length).toBeGreaterThan(0);
226
- for (const r of results) {
227
- expect(typeof r.filename).toBe("string");
228
- expect(typeof r.contents).toBe("string");
229
- }
230
- });
231
- });
232
-
233
- // =============================================================================
234
- // emitAffectedFiles
235
- // =============================================================================
236
-
237
- describe("emitAffectedFiles", () => {
238
- it("변경된 파일만 emit하고 변경되지 않은 파일은 emit하지 않는다", async () => {
239
- const compiler = new AngularCompiler({
240
- rootNames: realProgram.rootNames,
241
- compilerOptions: {
242
- target: ts.ScriptTarget.ESNext,
243
- module: ts.ModuleKind.ESNext,
244
- moduleResolution: ts.ModuleResolutionKind.Bundler,
245
- skipLibCheck: true,
246
- types: [],
247
- },
248
- });
249
-
250
- await compiler.initialize();
251
-
252
- // 첫 빌드: 모든 파일 emit
253
- const firstResults = [...compiler.emitAffectedFiles()];
254
- expect(firstResults.length).toBeGreaterThan(0);
255
-
256
- // 두번째 빌드: safeToSkipEmit=true이면 emit 안됨
257
- mockSafeToSkipEmit.mockReturnValue(true);
258
- await compiler.initialize();
259
-
260
- const secondResults = [...compiler.emitAffectedFiles()];
261
- expect(secondResults).toHaveLength(0);
262
- });
263
-
264
- it("첫 빌드에서 모든 소스 파일이 emit된다", async () => {
265
- realProgram = createRealTsProgram({
266
- "a.ts": "export const a = 1;",
267
- "b.ts": "export const b = 2;",
268
- });
269
-
270
- const compiler = new AngularCompiler({
271
- rootNames: realProgram.rootNames,
272
- compilerOptions: {
273
- target: ts.ScriptTarget.ESNext,
274
- module: ts.ModuleKind.ESNext,
275
- moduleResolution: ts.ModuleResolutionKind.Bundler,
276
- skipLibCheck: true,
277
- types: [],
278
- },
279
- });
280
-
281
- await compiler.initialize();
282
-
283
- const results = [...compiler.emitAffectedFiles()];
284
- expect(results.length).toBeGreaterThanOrEqual(2);
285
- });
286
-
287
- it("safeToSkipEmit이 false인 파일이 emit된다", async () => {
288
- const compiler = new AngularCompiler({
289
- rootNames: realProgram.rootNames,
290
- compilerOptions: {
291
- target: ts.ScriptTarget.ESNext,
292
- module: ts.ModuleKind.ESNext,
293
- moduleResolution: ts.ModuleResolutionKind.Bundler,
294
- skipLibCheck: true,
295
- types: [],
296
- },
297
- });
298
-
299
- mockSafeToSkipEmit.mockReturnValue(false);
300
-
301
- await compiler.initialize();
302
-
303
- const results = [...compiler.emitAffectedFiles()];
304
- expect(results.length).toBeGreaterThan(0);
305
- });
306
-
307
- it("safeToSkipEmit이 true이고 affectedFiles에 없으면 emit하지 않는다", async () => {
308
- const compiler = new AngularCompiler({
309
- rootNames: realProgram.rootNames,
310
- compilerOptions: {
311
- target: ts.ScriptTarget.ESNext,
312
- module: ts.ModuleKind.ESNext,
313
- moduleResolution: ts.ModuleResolutionKind.Bundler,
314
- skipLibCheck: true,
315
- types: [],
316
- },
317
- });
318
-
319
- // 첫 빌드 수행
320
- await compiler.initialize();
321
- void [...compiler.emitAffectedFiles()];
322
-
323
- // 두번째 빌드: safeToSkipEmit=true
324
- mockSafeToSkipEmit.mockReturnValue(true);
325
- await compiler.initialize();
326
-
327
- const results = [...compiler.emitAffectedFiles()];
328
- expect(results).toHaveLength(0);
329
- });
330
-
331
- it("emit 성공 시 recordSuccessfulEmit이 호출된다", async () => {
332
- const compiler = new AngularCompiler({
333
- rootNames: realProgram.rootNames,
334
- compilerOptions: {
335
- target: ts.ScriptTarget.ESNext,
336
- module: ts.ModuleKind.ESNext,
337
- moduleResolution: ts.ModuleResolutionKind.Bundler,
338
- skipLibCheck: true,
339
- types: [],
340
- },
341
- });
342
-
343
- await compiler.initialize();
344
-
345
- const results = [...compiler.emitAffectedFiles()];
346
- expect(results.length).toBeGreaterThan(0);
347
- });
348
-
349
- it("prepareEmit()의 transformers가 emit에 적용된다", async () => {
350
- const mockTransformer = vi.fn(
351
- (_context: ts.TransformationContext) => (sf: ts.SourceFile) => sf,
352
- );
353
- mockPrepareEmit.mockReturnValue({
354
- transformers: { before: [mockTransformer], after: [] },
355
- });
356
-
357
- const compiler = new AngularCompiler({
358
- rootNames: realProgram.rootNames,
359
- compilerOptions: {
360
- target: ts.ScriptTarget.ESNext,
361
- module: ts.ModuleKind.ESNext,
362
- moduleResolution: ts.ModuleResolutionKind.Bundler,
363
- skipLibCheck: true,
364
- types: [],
365
- },
366
- });
367
-
368
- await compiler.initialize();
369
-
370
- const results = [...compiler.emitAffectedFiles()];
371
- expect(results.length).toBeGreaterThan(0);
372
- });
373
-
374
- it("additionalTransformers가 emit 시 적용된다", async () => {
375
- const additionalBefore = vi.fn(
376
- (_context: ts.TransformationContext) => (sf: ts.SourceFile) => sf,
377
- );
378
-
379
- const compiler = new AngularCompiler({
380
- rootNames: realProgram.rootNames,
381
- compilerOptions: {
382
- target: ts.ScriptTarget.ESNext,
383
- module: ts.ModuleKind.ESNext,
384
- moduleResolution: ts.ModuleResolutionKind.Bundler,
385
- skipLibCheck: true,
386
- types: [],
387
- },
388
- });
389
-
390
- await compiler.initialize();
391
-
392
- const results = [
393
- ...compiler.emitAffectedFiles({
394
- additionalTransformers: { before: [additionalBefore] },
395
- }),
396
- ];
397
- expect(results.length).toBeGreaterThan(0);
398
- });
399
-
400
- it("declaration=true, noEmit=false일 때 .js와 .d.ts 모두 emit된다", async () => {
401
- realProgram = createRealTsProgram(
402
- { "index.ts": "export const x = 1;" },
403
- { declaration: true },
404
- );
405
-
406
- const compiler = new AngularCompiler({
407
- rootNames: realProgram.rootNames,
408
- compilerOptions: {
409
- target: ts.ScriptTarget.ESNext,
410
- module: ts.ModuleKind.ESNext,
411
- moduleResolution: ts.ModuleResolutionKind.Bundler,
412
- skipLibCheck: true,
413
- types: [],
414
- declaration: true,
415
- },
416
- });
417
-
418
- await compiler.initialize();
419
-
420
- const results = [...compiler.emitAffectedFiles()];
421
- const filenames = results.map((r) => r.filename);
422
- const hasJs = filenames.some((f) => f.endsWith(".js"));
423
- const hasDts = filenames.some((f) => f.endsWith(".d.ts"));
424
- expect(hasJs).toBe(true);
425
- expect(hasDts).toBe(true);
426
- });
427
-
428
- it("declaration=false일 때 .js만 emit되고 .d.ts는 생성되지 않는다", async () => {
429
- realProgram = createRealTsProgram(
430
- { "index.ts": "export const x = 1;" },
431
- { declaration: false },
432
- );
433
-
434
- const compiler = new AngularCompiler({
435
- rootNames: realProgram.rootNames,
436
- compilerOptions: {
437
- target: ts.ScriptTarget.ESNext,
438
- module: ts.ModuleKind.ESNext,
439
- moduleResolution: ts.ModuleResolutionKind.Bundler,
440
- skipLibCheck: true,
441
- types: [],
442
- declaration: false,
443
- },
444
- });
445
-
446
- await compiler.initialize();
447
-
448
- const results = [...compiler.emitAffectedFiles()];
449
- const filenames = results.map((r) => r.filename);
450
- const hasJs = filenames.some((f) => f.endsWith(".js"));
451
- const hasDts = filenames.some((f) => f.endsWith(".d.ts"));
452
- expect(hasJs).toBe(true);
453
- expect(hasDts).toBe(false);
454
- });
455
-
456
- it("emitDeclarationOnly=true일 때 .d.ts만 emit되고 .js는 생성되지 않는다", async () => {
457
- realProgram = createRealTsProgram(
458
- { "index.ts": "export const x = 1;" },
459
- { declaration: true, emitDeclarationOnly: true },
460
- );
461
-
462
- const compiler = new AngularCompiler({
463
- rootNames: realProgram.rootNames,
464
- compilerOptions: {
465
- target: ts.ScriptTarget.ESNext,
466
- module: ts.ModuleKind.ESNext,
467
- moduleResolution: ts.ModuleResolutionKind.Bundler,
468
- skipLibCheck: true,
469
- types: [],
470
- declaration: true,
471
- emitDeclarationOnly: true,
472
- },
473
- });
474
-
475
- await compiler.initialize();
476
-
477
- const results = [...compiler.emitAffectedFiles()];
478
- const filenames = results.map((r) => r.filename);
479
- const hasJs = filenames.some((f) => f.endsWith(".js"));
480
- const hasDts = filenames.some((f) => f.endsWith(".d.ts"));
481
- expect(hasJs).toBe(false);
482
- expect(hasDts).toBe(true);
483
- });
484
-
485
- it("noEmit=true일 때 어떤 파일도 emit되지 않는다", async () => {
486
- realProgram = createRealTsProgram({ "index.ts": "export const x = 1;" }, { noEmit: true });
487
-
488
- const compiler = new AngularCompiler({
489
- rootNames: realProgram.rootNames,
490
- compilerOptions: {
491
- target: ts.ScriptTarget.ESNext,
492
- module: ts.ModuleKind.ESNext,
493
- moduleResolution: ts.ModuleResolutionKind.Bundler,
494
- skipLibCheck: true,
495
- types: [],
496
- noEmit: true,
497
- },
498
- });
499
-
500
- await compiler.initialize();
501
-
502
- const results = [...compiler.emitAffectedFiles()];
503
- expect(results).toHaveLength(0);
504
- });
505
- });
506
-
507
- // =============================================================================
508
- // update — Unit Tests
509
- // =============================================================================
510
-
511
- describe("update — Unit Tests", () => {
512
- it("sourceFileCache가 없으면 에러를 던진다", async () => {
513
- const compiler = new AngularCompiler({
514
- rootNames: realProgram.rootNames,
515
- compilerOptions: {
516
- target: ts.ScriptTarget.ESNext,
517
- module: ts.ModuleKind.ESNext,
518
- moduleResolution: ts.ModuleResolutionKind.Bundler,
519
- skipLibCheck: true,
520
- types: [],
521
- },
522
- });
523
-
524
- await compiler.initialize();
525
-
526
- await expect(compiler.update([realProgram.rootNames[0]])).rejects.toThrow("sourceFileCache");
527
- });
528
-
529
- it("update() 후 affectedFiles가 반환된다", async () => {
530
- const cache = new AngularSourceFileCache();
531
-
532
- const compiler = new AngularCompiler({
533
- rootNames: realProgram.rootNames,
534
- compilerOptions: {
535
- target: ts.ScriptTarget.ESNext,
536
- module: ts.ModuleKind.ESNext,
537
- moduleResolution: ts.ModuleResolutionKind.Bundler,
538
- skipLibCheck: true,
539
- types: [],
540
- },
541
- sourceFileCache: cache,
542
- });
543
-
544
- await compiler.initialize();
545
-
546
- const result = await compiler.update([realProgram.rootNames[0]]);
547
- expect(result.affectedFiles).toBeInstanceOf(Set);
548
- });
549
- });
550
-
551
- // =============================================================================
552
- // update
553
- // =============================================================================
554
-
555
- describe("update", () => {
556
- it("파일 변경 후 incremental rebuild", async () => {
557
- const cache = new AngularSourceFileCache();
558
-
559
- const compiler = new AngularCompiler({
560
- rootNames: realProgram.rootNames,
561
- compilerOptions: {
562
- target: ts.ScriptTarget.ESNext,
563
- module: ts.ModuleKind.ESNext,
564
- moduleResolution: ts.ModuleResolutionKind.Bundler,
565
- skipLibCheck: true,
566
- types: [],
567
- },
568
- sourceFileCache: cache,
569
- });
570
-
571
- await compiler.initialize();
572
- const initCallCount = ngtscConstructorSpy.mock.calls.length;
573
-
574
- await compiler.update([realProgram.rootNames[0]]);
575
- expect(ngtscConstructorSpy).toHaveBeenCalledTimes(initCallCount + 1);
576
- });
577
-
578
- it("node_modules 파일 변경 시 packageJsonCache clear", async () => {
579
- const cache = new AngularSourceFileCache();
580
-
581
- const compiler = new AngularCompiler({
582
- rootNames: realProgram.rootNames,
583
- compilerOptions: {
584
- target: ts.ScriptTarget.ESNext,
585
- module: ts.ModuleKind.ESNext,
586
- moduleResolution: ts.ModuleResolutionKind.Bundler,
587
- skipLibCheck: true,
588
- types: [],
589
- },
590
- sourceFileCache: cache,
591
- });
592
-
593
- await compiler.initialize();
594
-
595
- // node_modules 파일을 변경 파일로 전달
596
- await compiler.update(["node_modules/some-package/index.js"]);
597
-
598
- // packageJsonCache clear가 실행되더라도 에러 없이 완료되어야 함
599
- expect(ngtscConstructorSpy.mock.calls.length).toBeGreaterThanOrEqual(2);
600
- });
601
-
602
- it("SCSS 파일 변경 시 관련 컴포넌트가 affected에 포함", async () => {
603
- const scssPath = path.join(realProgram.dir, "component.scss");
604
- fs.writeFileSync(scssPath, ".x { color: red; }", "utf-8");
605
-
606
- const indexFile = realProgram.program
607
- .getSourceFiles()
608
- .find((sf) => sf.fileName.includes("index.ts"));
609
-
610
- mockGetResourceDependencies.mockImplementation((sf: ts.SourceFile) => {
611
- if (sf === indexFile) {
612
- return [scssPath];
613
- }
614
- return [];
615
- });
616
-
617
- const cache = new AngularSourceFileCache();
618
-
619
- const compiler = new AngularCompiler({
620
- rootNames: realProgram.rootNames,
621
- compilerOptions: {
622
- target: ts.ScriptTarget.ESNext,
623
- module: ts.ModuleKind.ESNext,
624
- moduleResolution: ts.ModuleResolutionKind.Bundler,
625
- skipLibCheck: true,
626
- types: [],
627
- },
628
- sourceFileCache: cache,
629
- });
630
-
631
- await compiler.initialize();
632
-
633
- const result = await compiler.update([scssPath]);
634
- const affectedFileNames = [...result.affectedFiles].map((sf) => sf.fileName);
635
- expect(affectedFileNames.some((f) => f.includes("index.ts"))).toBe(true);
636
- });
637
-
638
- it("리소스 변경 없으면 diagnosticCache 재사용", async () => {
639
- const cache = new AngularSourceFileCache();
640
-
641
- const compiler = new AngularCompiler({
642
- rootNames: realProgram.rootNames,
643
- compilerOptions: {
644
- target: ts.ScriptTarget.ESNext,
645
- module: ts.ModuleKind.ESNext,
646
- moduleResolution: ts.ModuleResolutionKind.Bundler,
647
- skipLibCheck: true,
648
- types: [],
649
- },
650
- sourceFileCache: cache,
651
- });
652
-
653
- await compiler.initialize();
654
-
655
- // 첫 번째 진단 수집
656
- const diags1 = [...compiler.collectDiagnostics()];
657
- expect(Array.isArray(diags1)).toBe(true);
658
-
659
- // 빈 set으로 update (리소스 변경 없음)
660
- await compiler.update([]);
661
-
662
- // diagnosticCache가 재사용되므로 진단 수집이 배열로 반환됨
663
- const diags2 = [...compiler.collectDiagnostics()];
664
- expect(Array.isArray(diags2)).toBe(true);
665
- });
666
- });