@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
@@ -0,0 +1,230 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+ import esbuild from "esbuild";
4
+ import browserslistToEsbuild from "browserslist-to-esbuild";
5
+ import {
6
+ createCompilerPlugin,
7
+ SourceFileCache,
8
+ type CompilerPluginOptions,
9
+ type BundleStylesheetOptions,
10
+ } from "@angular/build/private";
11
+ import { createScssPlugin } from "./esbuild-scss-plugin";
12
+
13
+ export interface CreateClientEsbuildOptions {
14
+ /** 패키지 디렉토리 경로 */
15
+ pkgDir: string;
16
+ /** 모노레포 루트 (workspaceRoot) */
17
+ cwd: string;
18
+ /** 빌드 모드 */
19
+ mode: "dev" | "build";
20
+ /** tsconfig 경로 (기본: pkgDir/tsconfig.json) */
21
+ tsconfig?: string;
22
+ /** 빌드 시 치환할 환경변수 */
23
+ env?: Record<string, string>;
24
+ /** 추가 esbuild 플러그인 (Feature 1.1b에서 사용) */
25
+ plugins?: esbuild.Plugin[];
26
+ /** HMR용 templateUpdates Map (Feature 2.2에서 사용) */
27
+ templateUpdates?: Map<string, string>;
28
+ /** watch 모드 빌드 완료 콜백 */
29
+ onEnd?: (result: esbuild.BuildResult) => void | Promise<void>;
30
+ /** PostCSS 플러그인 ([name, options] 튜플 배열) */
31
+ postcssPlugins?: [string, (object | string)?][];
32
+ /** PostCSS 설정 기준 경로 */
33
+ postcssConfigPath?: string;
34
+ /** 빌드 출력 경로 (기본: pkgDir/dist) */
35
+ outdir?: string;
36
+ /** browserslist 쿼리. 미설정 시 "es2022" 기본값 */
37
+ browserslist?: string | string[];
38
+ /** polyfills 경로 (pkgDir 기준 상대경로, 예: ["src/polyfills.ts"]). entryPoints에 추가됨 */
39
+ polyfills?: string[];
40
+ /** 레거시 모듈 지원 (코드 분할 비활성화 + import.meta 치환 + 잔여 import() 제거) */
41
+ legacyModule?: boolean;
42
+ }
43
+
44
+ export interface ClientEsbuildResult {
45
+ context: esbuild.BuildContext;
46
+ sourceFileCache: InstanceType<typeof SourceFileCache>;
47
+ }
48
+
49
+ export async function createClientEsbuildContext(
50
+ options: CreateClientEsbuildOptions,
51
+ ): Promise<ClientEsbuildResult> {
52
+ const isDev = options.mode === "dev";
53
+
54
+ // browserslist → esbuild target 변환
55
+ let esbuildTarget: string[] = ["es2022"];
56
+ if (options.browserslist != null) {
57
+ const queries = Array.isArray(options.browserslist)
58
+ ? options.browserslist
59
+ : [options.browserslist];
60
+ esbuildTarget = browserslistToEsbuild(queries);
61
+ }
62
+
63
+ // SourceFileCache 생성 (LMDB 디스크 캐시)
64
+ const cachePath = path.join(options.pkgDir, ".angular", "cache");
65
+ const sourceFileCache = new SourceFileCache(cachePath);
66
+
67
+ // CompilerPluginOptions
68
+ const pluginOptions: CompilerPluginOptions & { browserOnlyBuild?: boolean } = {
69
+ tsconfig: options.tsconfig ?? path.join(options.pkgDir, "tsconfig.json"),
70
+ sourcemap: isDev,
71
+ advancedOptimizations: !isDev,
72
+ thirdPartySourcemaps: isDev,
73
+ incremental: true,
74
+ sourceFileCache,
75
+ loadResultCache: sourceFileCache.loadResultCache,
76
+ templateUpdates: options.templateUpdates,
77
+ browserOnlyBuild: true,
78
+ };
79
+
80
+ // BundleStylesheetOptions
81
+ const styleOptions: BundleStylesheetOptions & { inlineStyleLanguage: string } = {
82
+ workspaceRoot: options.cwd,
83
+ optimization: !isDev,
84
+ inlineFonts: false,
85
+ sourcemap: isDev ? "linked" : false,
86
+ outputNames: { bundles: "[name]", media: "media/[name]" },
87
+ includePaths: [],
88
+ target: esbuildTarget,
89
+ cacheOptions: {
90
+ enabled: true,
91
+ path: cachePath,
92
+ basePath: cachePath,
93
+ },
94
+ postcssConfiguration:
95
+ options.postcssPlugins != null
96
+ ? {
97
+ config: { plugins: options.postcssPlugins },
98
+ configPath: options.postcssConfigPath ?? options.pkgDir,
99
+ }
100
+ : undefined,
101
+ inlineStyleLanguage: "scss",
102
+ };
103
+
104
+ const angularPlugin = createCompilerPlugin(pluginOptions, styleOptions);
105
+
106
+ // SCSS side-effect import 처리 플러그인
107
+ const scssPlugin = createScssPlugin({
108
+ loadPaths: [
109
+ path.join(options.pkgDir, "scss"),
110
+ path.join(options.cwd, "node_modules"),
111
+ ],
112
+ });
113
+
114
+ // define 주입
115
+ const define: Record<string, string> = {};
116
+
117
+ // Angular 플래그
118
+ if (!isDev) {
119
+ define["ngDevMode"] = "false";
120
+ }
121
+ define["ngJitMode"] = "false";
122
+ if (isDev && options.templateUpdates != null && options.legacyModule !== true) {
123
+ define["ngHmrMode"] = "true";
124
+ } else if (!isDev) {
125
+ define["ngHmrMode"] = "false";
126
+ }
127
+
128
+ // 커스텀 env
129
+ if (options.env != null) {
130
+ for (const [key, value] of Object.entries(options.env)) {
131
+ define[`import.meta.env.${key}`] = JSON.stringify(value);
132
+ }
133
+ }
134
+
135
+ // import.meta.hot 폴리필 banner (Angular HMR 런타임용)
136
+ // Angular의 compileHmrInitializer가 import.meta.hot.on('angular:component-update', ...)을 사용.
137
+ // Vite 없이 동작하도록 import.meta.hot을 폴리필하고, globalThis.__hmr_dispatch로 외부 트리거 제공.
138
+ const hmrBanner =
139
+ options.templateUpdates != null && options.legacyModule !== true
140
+ ? [
141
+ 'if(typeof ngHmrMode!=="undefined"&&ngHmrMode){(function(){',
142
+ "var _l={};",
143
+ "import.meta.hot={on:function(e,c){if(!_l[e])_l[e]=[];_l[e].push(c);},off:function(e,c){var a=_l[e];if(a){var i=a.indexOf(c);if(i!==-1)a.splice(i,1);}}};",
144
+ "globalThis.__hmr_dispatch=function(e,d){var a=_l[e];if(a)for(var i=0;i<a.length;i++)a[i](d);};",
145
+ "})()}",
146
+ ].join("")
147
+ : undefined;
148
+
149
+ // esbuild context 생성
150
+ const context = await esbuild.context({
151
+ entryPoints: [
152
+ path.join(options.pkgDir, "src", "main.ts"),
153
+ ...(options.polyfills != null
154
+ ? options.polyfills.map((p) => path.join(options.pkgDir, p))
155
+ : []),
156
+ ],
157
+ target: esbuildTarget,
158
+ entryNames: isDev ? "[name]" : "[name]-[hash]",
159
+ chunkNames: isDev ? "[name]" : "[name]-[hash]",
160
+ assetNames: isDev ? "[name]" : "[name]-[hash]",
161
+ bundle: true,
162
+ splitting: options.legacyModule !== true,
163
+ format: "esm",
164
+ platform: "browser",
165
+ outdir: options.outdir ?? path.join(options.pkgDir, "dist"),
166
+ metafile: true,
167
+ write: true,
168
+ sourcemap: isDev ? "linked" : false,
169
+ logLevel: "silent",
170
+ tsconfig: options.tsconfig ?? path.join(options.pkgDir, "tsconfig.json"),
171
+ define,
172
+ banner: hmrBanner != null ? { js: hmrBanner } : undefined,
173
+ ...(options.legacyModule === true ? { supported: { "import-meta": false } } : {}),
174
+ plugins: [
175
+ ...(options.templateUpdates != null
176
+ ? [
177
+ {
178
+ name: "sd-hmr-reset",
179
+ setup(build: esbuild.PluginBuild) {
180
+ build.onStart(() => {
181
+ options.templateUpdates!.clear();
182
+ });
183
+ },
184
+ },
185
+ ]
186
+ : []),
187
+ angularPlugin,
188
+ scssPlugin,
189
+ ...(options.plugins ?? []),
190
+ ...(options.legacyModule === true
191
+ ? [
192
+ {
193
+ name: "sd-legacy-strip-dynamic-import",
194
+ setup(build: esbuild.PluginBuild) {
195
+ build.onEnd(async (result) => {
196
+ if (result.metafile == null) return;
197
+ const jsFiles = Object.keys(result.metafile.outputs).filter((f) =>
198
+ f.endsWith(".js"),
199
+ );
200
+ for (const file of jsFiles) {
201
+ const code = await fs.promises.readFile(file, "utf-8");
202
+ if (!code.includes("import(")) continue;
203
+ const replaced = code.replace(
204
+ /\bimport\s*\(/g,
205
+ '(function(){return Promise.reject(new Error("Dynamic import not supported"))})(',
206
+ );
207
+ await fs.promises.writeFile(file, replaced);
208
+ }
209
+ });
210
+ },
211
+ },
212
+ ]
213
+ : []),
214
+ ...(options.onEnd != null
215
+ ? [
216
+ {
217
+ name: "sd-on-end",
218
+ setup(build: esbuild.PluginBuild) {
219
+ build.onEnd((result) => {
220
+ return options.onEnd!(result);
221
+ });
222
+ },
223
+ },
224
+ ]
225
+ : []),
226
+ ],
227
+ });
228
+
229
+ return { context, sourceFileCache };
230
+ }
@@ -85,6 +85,7 @@ export function createServerEsbuildOptions(options: ServerEsbuildOptions): esbui
85
85
  outdir: path.join(options.pkgDir, "dist"),
86
86
  format: "esm",
87
87
  minify: options.dev !== true,
88
+ sourcemap: options.dev === true ? "linked" : undefined,
88
89
  platform: "node",
89
90
  target: "node20",
90
91
  bundle: true,
@@ -0,0 +1,119 @@
1
+ import type esbuild from "esbuild";
2
+ import {
3
+ IndexHtmlGenerator,
4
+ type IndexHtmlTransform,
5
+ } from "@angular/build/private";
6
+ import path from "path";
7
+
8
+ /** metafile.outputs에서 추출된 파일 정보 (IndexHtmlGenerator.FileInfo 호환) */
9
+ export interface FileInfo {
10
+ file: string;
11
+ name?: string;
12
+ extension: string;
13
+ }
14
+
15
+ export interface GenerateIndexHtmlOptions {
16
+ /** src/index.html 경로 */
17
+ indexPath: string;
18
+ /** esbuild 빌드 결과 metafile */
19
+ metafile: esbuild.Metafile;
20
+ /** 출력 디렉토리 (dist/) */
21
+ outdir: string;
22
+ /** <base href> (기본: "/") */
23
+ baseHref?: string;
24
+ /** 빌드 모드 */
25
+ mode: "dev" | "build";
26
+ /** entryPoints의 이름 목록 (main, polyfills 등) */
27
+ entryNames: string[];
28
+ /** HTML 후처리 훅 (HMR 스크립트 주입용) */
29
+ postTransform?: IndexHtmlTransform;
30
+ }
31
+
32
+ export interface GenerateIndexHtmlResult {
33
+ content: string;
34
+ warnings: string[];
35
+ errors: string[];
36
+ }
37
+
38
+ /**
39
+ * esbuild metafile.outputs에서 JS/CSS 파일을 추출하여 FileInfo[] 로 변환한다.
40
+ */
41
+ export function extractFilesFromMetafile(
42
+ metafile: esbuild.Metafile,
43
+ outdir: string,
44
+ ): FileInfo[] {
45
+ const files: FileInfo[] = [];
46
+ const normalizedOutdir = outdir.replace(/\\/g, "/");
47
+
48
+ // cssBundle → entry name 매핑 (JS entry의 cssBundle로 CSS에 name 전파)
49
+ const cssBundleToName = new Map<string, string>();
50
+ for (const output of Object.values(metafile.outputs)) {
51
+ if (output.entryPoint != null && output.cssBundle != null) {
52
+ const name = path.basename(output.entryPoint, path.extname(output.entryPoint));
53
+ cssBundleToName.set(output.cssBundle.replace(/\\/g, "/"), name);
54
+ }
55
+ }
56
+
57
+ for (const [outputPath, output] of Object.entries(metafile.outputs)) {
58
+ const normalizedPath = outputPath.replace(/\\/g, "/");
59
+ const ext = path.extname(normalizedPath);
60
+
61
+ if (ext !== ".js" && ext !== ".css") {
62
+ continue;
63
+ }
64
+
65
+ const relativePath = normalizedPath.startsWith(normalizedOutdir)
66
+ ? normalizedPath.slice(normalizedOutdir.length).replace(/^\//, "")
67
+ : path.relative(normalizedOutdir, normalizedPath).replace(/\\/g, "/");
68
+
69
+ const fileInfo: FileInfo = {
70
+ file: relativePath,
71
+ extension: ext,
72
+ };
73
+
74
+ if (output.entryPoint != null) {
75
+ fileInfo.name = path.basename(output.entryPoint, path.extname(output.entryPoint));
76
+ } else if (ext === ".css") {
77
+ const cssName = cssBundleToName.get(normalizedPath);
78
+ if (cssName != null) {
79
+ fileInfo.name = cssName;
80
+ }
81
+ }
82
+
83
+ files.push(fileInfo);
84
+ }
85
+
86
+ return files;
87
+ }
88
+
89
+ /**
90
+ * esbuild 빌드 결과를 기반으로 index.html을 생성한다.
91
+ * IndexHtmlGenerator(@angular/build/private)를 활용하여 script/link 태그를 자동 주입한다.
92
+ */
93
+ export async function generateIndexHtml(
94
+ options: GenerateIndexHtmlOptions,
95
+ ): Promise<GenerateIndexHtmlResult> {
96
+ const files = extractFilesFromMetafile(options.metafile, options.outdir);
97
+
98
+ const entrypoints: [string, boolean][] = options.entryNames.map((name) => [name, true]);
99
+
100
+ const generator = new IndexHtmlGenerator({
101
+ indexPath: options.indexPath,
102
+ entrypoints,
103
+ sri: options.mode === "build",
104
+ postTransform: options.postTransform,
105
+ });
106
+
107
+ const result = await generator.process({
108
+ lang: undefined,
109
+ baseHref: options.baseHref,
110
+ outputPath: options.outdir,
111
+ files,
112
+ });
113
+
114
+ return {
115
+ content: result.csrContent,
116
+ warnings: result.warnings,
117
+ errors: result.errors,
118
+ };
119
+ }
@@ -0,0 +1,139 @@
1
+ import type { IndexHtmlTransform } from "@angular/build/private";
2
+ import type { SdPwaConfig } from "../sd-config.types.js";
3
+ import { augmentAppWithServiceWorker } from "@angular/build/private";
4
+ import { generatePwaIcons } from "../utils/generate-pwa-icons.js";
5
+ import fs from "node:fs";
6
+ import path from "path";
7
+
8
+ export interface ApplyPwaOptions {
9
+ /** 패키지 디렉토리 경로 */
10
+ pkgDir: string;
11
+ /** 패키지 표시명 */
12
+ pkgName: string;
13
+ /** 모노레포 루트 (workspaceRoot) */
14
+ cwd: string;
15
+ /** 빌드 출력 디렉토리 (dist/) */
16
+ outdir: string;
17
+ /** base href (기본: "/") */
18
+ baseHref: string;
19
+ /** 빌드 모드 */
20
+ mode: "dev" | "build";
21
+ /** PWA 설정. false이면 비활성화 */
22
+ pwa?: false | SdPwaConfig;
23
+ }
24
+
25
+ export function createPwaHtmlTransform(): IndexHtmlTransform {
26
+ return (content: string) => {
27
+ const manifestLink = '<link rel="manifest" href="manifest.webmanifest">';
28
+ const registrationScript = `<script>${generateRegistrationScript()}</script>`;
29
+
30
+ content = content.replace("</head>", `${manifestLink}\n</head>`);
31
+ content = content.replace("</body>", `${registrationScript}\n</body>`);
32
+
33
+ return Promise.resolve(content);
34
+ };
35
+ }
36
+
37
+ export async function applyPwa(options: ApplyPwaOptions): Promise<void> {
38
+ if (options.mode !== "build") return;
39
+ if (options.pwa === false) return;
40
+
41
+ const pwaConfig = options.pwa ?? {};
42
+
43
+ // 1. Icons
44
+ let iconsField: Record<string, unknown> = {};
45
+ if (pwaConfig.manifest?.icons != null) {
46
+ iconsField = { icons: pwaConfig.manifest.icons };
47
+ } else {
48
+ const generated = await generatePwaIcons(options.pkgDir);
49
+ if (generated.length > 0) {
50
+ // Copy generated icons from public/icons/ to dist/icons/
51
+ const srcIconsDir = path.join(options.pkgDir, "public", "icons");
52
+ const dstIconsDir = path.join(options.outdir, "icons");
53
+ fs.mkdirSync(dstIconsDir, { recursive: true });
54
+ for (const icon of generated) {
55
+ const srcPath = path.join(srcIconsDir, path.basename(icon.src));
56
+ const dstPath = path.join(dstIconsDir, path.basename(icon.src));
57
+ fs.copyFileSync(srcPath, dstPath);
58
+ }
59
+ iconsField = { icons: generated };
60
+ }
61
+ }
62
+
63
+ // 2. Manifest
64
+ const manifest = {
65
+ name: pwaConfig.manifest?.name ?? options.pkgName,
66
+ short_name: pwaConfig.manifest?.short_name ?? options.pkgName,
67
+ display: pwaConfig.manifest?.display ?? "standalone",
68
+ theme_color: pwaConfig.manifest?.theme_color ?? "#ffffff",
69
+ background_color: pwaConfig.manifest?.background_color ?? "#ffffff",
70
+ start_url: ".",
71
+ scope: ".",
72
+ ...iconsField,
73
+ };
74
+
75
+ fs.writeFileSync(
76
+ path.join(options.outdir, "manifest.webmanifest"),
77
+ JSON.stringify(manifest, null, 2),
78
+ );
79
+
80
+ // 3. Ensure ngsw-config.json exists
81
+ const ngswConfigPath = path.join(options.pkgDir, "ngsw-config.json");
82
+ if (!fs.existsSync(ngswConfigPath)) {
83
+ const defaultConfig = {
84
+ $schema: "./node_modules/@angular/service-worker/config/schema.json",
85
+ index: "/index.html",
86
+ assetGroups: [
87
+ {
88
+ name: "app",
89
+ installMode: "prefetch",
90
+ resources: {
91
+ files: ["/*.html", "/*.css", "/*.js"],
92
+ },
93
+ },
94
+ {
95
+ name: "assets",
96
+ installMode: "lazy",
97
+ updateMode: "prefetch",
98
+ resources: {
99
+ files: ["/**/*.{png,jpg,svg,ico,woff2,webmanifest}"],
100
+ },
101
+ },
102
+ ],
103
+ };
104
+ fs.writeFileSync(ngswConfigPath, JSON.stringify(defaultConfig, null, 2) + "\n");
105
+ }
106
+
107
+ // 4. augmentAppWithServiceWorker
108
+ await augmentAppWithServiceWorker(
109
+ options.pkgDir,
110
+ options.cwd,
111
+ options.outdir,
112
+ options.baseHref,
113
+ );
114
+ }
115
+
116
+ function generateRegistrationScript(): string {
117
+ return `(function(){
118
+ if(!("serviceWorker" in navigator))return;
119
+ navigator.serviceWorker.register("ngsw-worker.js").then(function(reg){
120
+ if(reg.waiting){d(reg.waiting);return}
121
+ reg.addEventListener("updatefound",function(){
122
+ var w=reg.installing;
123
+ if(!w)return;
124
+ w.addEventListener("statechange",function(){
125
+ if(w.state==="installed"&&navigator.serviceWorker.controller)d(w);
126
+ });
127
+ });
128
+ });
129
+ var r=false;
130
+ navigator.serviceWorker.addEventListener("controllerchange",function(){
131
+ if(!r){r=true;window.location.reload()}
132
+ });
133
+ function d(w){
134
+ window.dispatchEvent(new CustomEvent("sd-pwa-update-ready",{
135
+ detail:{update:function(){w.postMessage({type:"SKIP_WAITING"})}}
136
+ }));
137
+ }
138
+ })();`;
139
+ }
@@ -0,0 +1,48 @@
1
+ import type esbuild from "esbuild";
2
+ import { fileURLToPath } from "url";
3
+ import { compileScssFileAsync } from "../angular/scss-compiler";
4
+
5
+ export interface CreateScssPluginOptions {
6
+ loadPaths: string[];
7
+ }
8
+
9
+ export function createScssPlugin(options: CreateScssPluginOptions): esbuild.Plugin {
10
+ return {
11
+ name: "sd-scss",
12
+ setup(build) {
13
+ build.onLoad({ filter: /\.scss$/ }, async (args) => {
14
+ try {
15
+ const result = await compileScssFileAsync(args.path, options.loadPaths);
16
+ return {
17
+ contents: result.css,
18
+ loader: "css" as const,
19
+ watchFiles: result.dependencies,
20
+ };
21
+ } catch (e: unknown) {
22
+ // sass.Exception은 span 프로퍼티로 위치 정보를 제공한다
23
+ const sassSpan = (e as any)?.span;
24
+ const location: esbuild.PartialMessage["location"] =
25
+ sassSpan != null
26
+ ? {
27
+ file:
28
+ sassSpan.url != null
29
+ ? fileURLToPath(sassSpan.url)
30
+ : args.path,
31
+ line: sassSpan.start.line + 1, // sass: 0-based → esbuild: 1-based
32
+ column: sassSpan.start.column,
33
+ }
34
+ : undefined;
35
+
36
+ return {
37
+ errors: [
38
+ {
39
+ text: (e as any)?.sassMessage ?? (e instanceof Error ? e.message : String(e)),
40
+ location,
41
+ },
42
+ ],
43
+ };
44
+ }
45
+ });
46
+ },
47
+ };
48
+ }
@@ -0,0 +1,118 @@
1
+ import { consola, type ConsolaInstance } from "consola";
2
+ import type { SdConfig } from "../sd-config.types";
3
+ import { loadSdConfig } from "../utils/sd-config";
4
+ import { getVersion } from "../utils/build-env";
5
+ import { buildPathMapFromConfig, validateTargets } from "../utils/package-utils";
6
+ import { watchReplaceDeps, type WatchReplaceDepResult } from "../deps/replace-deps/replace-deps";
7
+ import { RebuildManager } from "../runtime/rebuild-manager";
8
+ import { ResultCollector } from "../runtime/ResultCollector";
9
+ import { SignalHandler } from "../runtime/SignalHandler";
10
+ /**
11
+ * Orchestrator 공통 기반 클래스
12
+ *
13
+ * sd.config.ts 로드, pathMap 구축, 대상 검증, replaceDeps 감시,
14
+ * 런타임(SignalHandler, ResultCollector, RebuildManager) 초기화를 수행한다.
15
+ *
16
+ * 서브클래스(WatchOrchestrator, DevOrchestrator)가 OrchestratorLifecycle을 implements한다.
17
+ * BaseOrchestrator.initialize()는 params를 받으므로 인터페이스와 직접 호환되지 않으며,
18
+ * 서브클래스가 parameterless override를 제공한다.
19
+ */
20
+ export abstract class BaseOrchestrator {
21
+ protected readonly _cwd: string;
22
+ protected readonly _logger: ConsolaInstance;
23
+
24
+ // 런타임
25
+ protected _resultCollector!: ResultCollector;
26
+ protected _signalHandler!: SignalHandler;
27
+ protected _rebuildManager!: RebuildManager;
28
+
29
+ // 공통 상태
30
+ protected _pathMap = new Map<string, string>();
31
+ protected _baseEnv!: { VER: string; DEV: string };
32
+ protected _replaceDeps: Record<string, string> | undefined;
33
+ protected _replaceDepWatcher: WatchReplaceDepResult | undefined;
34
+ protected _hasPackages = false;
35
+
36
+ constructor(logTag: string) {
37
+ this._cwd = process.cwd();
38
+ this._logger = consola.withTag(logTag);
39
+ }
40
+
41
+ async initialize(params: {
42
+ targets: string[];
43
+ options: string[];
44
+ dev: boolean;
45
+ }): Promise<void> {
46
+ this._logger.debug(`시작`, { targets: params.targets });
47
+
48
+ // 1. sd.config.ts 로드
49
+ let sdConfig: SdConfig;
50
+ try {
51
+ sdConfig = await loadSdConfig({
52
+ cwd: this._cwd,
53
+ dev: params.dev,
54
+ opt: params.options,
55
+ });
56
+ this._logger.debug("sd.config.ts 로드 완료");
57
+ } catch (err) {
58
+ this._logger.error(`sd.config.ts 로드 실패: ${err instanceof Error ? err.message : err}`);
59
+ process.exitCode = 1;
60
+ throw err;
61
+ }
62
+
63
+ // 2. pathMap 구축
64
+ this._pathMap = buildPathMapFromConfig(sdConfig.packages);
65
+
66
+ // 3. 대상 유효성 검사
67
+ validateTargets(params.targets, sdConfig.packages);
68
+
69
+ // 4. 환경변수 준비 (VER, DEV)
70
+ const version = await getVersion(this._cwd);
71
+ this._baseEnv = { VER: version, DEV: params.dev ? "true" : "false" };
72
+
73
+ // 5. replaceDeps 저장 + watch 시작
74
+ this._replaceDeps = sdConfig.replaceDeps;
75
+ if (sdConfig.replaceDeps != null) {
76
+ this._replaceDepWatcher = await watchReplaceDeps(this._cwd, sdConfig.replaceDeps);
77
+ }
78
+
79
+ // 6. 서브클래스 초기화 (패키지 분류, 엔진 생성 등)
80
+ await this._initializeMode(sdConfig, params.targets);
81
+
82
+ // 7. 패키지 유무 확인 후 런타임 초기화
83
+ if (!this._hasPackages) return;
84
+ this._signalHandler = new SignalHandler();
85
+ this._resultCollector = new ResultCollector();
86
+ this._rebuildManager = new RebuildManager(this._logger);
87
+
88
+ // 8. 런타임 의존 초기화 (엔진 생성 등)
89
+ await this._initializeEngines(sdConfig);
90
+ }
91
+
92
+ abstract start(): Promise<void>;
93
+
94
+ async awaitTermination(): Promise<void> {
95
+ if (!this._hasPackages) return;
96
+ await this._signalHandler.waitForTermination();
97
+ }
98
+
99
+ async shutdown(): Promise<void> {
100
+ // replaceDepWatcher는 항상 정리 (initialize 부분 실패 대응)
101
+ this._replaceDepWatcher?.dispose();
102
+ this._replaceDepWatcher = undefined;
103
+
104
+ if (!this._hasPackages) return;
105
+ process.stdout.write("⏳ 종료 중...\n");
106
+ await this._shutdownMode();
107
+ process.stdout.write("✔ 종료 완료\n");
108
+ }
109
+
110
+ protected abstract _initializeMode(
111
+ config: SdConfig,
112
+ targets: string[],
113
+ ): Promise<void> | void;
114
+
115
+ protected abstract _initializeEngines(config: SdConfig): Promise<void> | void;
116
+
117
+ protected abstract _shutdownMode(): Promise<void>;
118
+ }