@simplysm/sd-cli 14.0.10 → 14.0.12

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 (266) hide show
  1. package/README.md +58 -253
  2. package/dist/angular/client-transform-stylesheet.js +1 -1
  3. package/dist/angular/client-transform-stylesheet.js.map +1 -1
  4. package/dist/angular/vite-angular-plugin.d.ts +1 -1
  5. package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
  6. package/dist/angular/vite-angular-plugin.js +60 -34
  7. package/dist/angular/vite-angular-plugin.js.map +1 -1
  8. package/dist/angular/vite-postcss-inline-plugin.d.ts +1 -1
  9. package/dist/angular/vite-postcss-inline-plugin.js +1 -1
  10. package/dist/capacitor/capacitor.d.ts +14 -2
  11. package/dist/capacitor/capacitor.d.ts.map +1 -1
  12. package/dist/capacitor/capacitor.js +131 -17
  13. package/dist/capacitor/capacitor.js.map +1 -1
  14. package/dist/commands/build.d.ts +3 -10
  15. package/dist/commands/build.d.ts.map +1 -1
  16. package/dist/commands/build.js +3 -10
  17. package/dist/commands/build.js.map +1 -1
  18. package/dist/commands/check.js +3 -3
  19. package/dist/commands/check.js.map +1 -1
  20. package/dist/commands/dev.d.ts +3 -9
  21. package/dist/commands/dev.d.ts.map +1 -1
  22. package/dist/commands/dev.js +3 -9
  23. package/dist/commands/dev.js.map +1 -1
  24. package/dist/commands/device.d.ts +13 -0
  25. package/dist/commands/device.d.ts.map +1 -0
  26. package/dist/commands/device.js +53 -0
  27. package/dist/commands/device.js.map +1 -0
  28. package/dist/commands/publish.d.ts +1 -1
  29. package/dist/commands/publish.d.ts.map +1 -1
  30. package/dist/commands/publish.js +18 -26
  31. package/dist/commands/publish.js.map +1 -1
  32. package/dist/commands/replace-deps.d.ts +3 -3
  33. package/dist/commands/replace-deps.d.ts.map +1 -1
  34. package/dist/commands/replace-deps.js +1 -1
  35. package/dist/commands/typecheck.d.ts +4 -3
  36. package/dist/commands/typecheck.d.ts.map +1 -1
  37. package/dist/commands/typecheck.js +5 -11
  38. package/dist/commands/typecheck.js.map +1 -1
  39. package/dist/commands/watch.d.ts +9 -9
  40. package/dist/commands/watch.js +9 -9
  41. package/dist/electron/electron.d.ts.map +1 -1
  42. package/dist/electron/electron.js +42 -3
  43. package/dist/electron/electron.js.map +1 -1
  44. package/dist/engines/BaseEngine.d.ts +1 -1
  45. package/dist/engines/BaseEngine.d.ts.map +1 -1
  46. package/dist/engines/BaseEngine.js +3 -1
  47. package/dist/engines/BaseEngine.js.map +1 -1
  48. package/dist/engines/NgtscEngine.d.ts +7 -7
  49. package/dist/engines/NgtscEngine.d.ts.map +1 -1
  50. package/dist/engines/NgtscEngine.js +3 -3
  51. package/dist/engines/ServerEsbuildEngine.d.ts +7 -7
  52. package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
  53. package/dist/engines/ServerEsbuildEngine.js +3 -3
  54. package/dist/engines/TscEngine.d.ts +7 -7
  55. package/dist/engines/TscEngine.d.ts.map +1 -1
  56. package/dist/engines/TscEngine.js +3 -3
  57. package/dist/engines/ViteEngine.d.ts +1 -1
  58. package/dist/engines/ViteEngine.d.ts.map +1 -1
  59. package/dist/engines/ViteEngine.js +7 -12
  60. package/dist/engines/ViteEngine.js.map +1 -1
  61. package/dist/engines/index.d.ts +5 -5
  62. package/dist/engines/index.js +5 -5
  63. package/dist/engines/types.d.ts +20 -20
  64. package/dist/engines/types.d.ts.map +1 -1
  65. package/dist/infra/ResultCollector.d.ts +9 -9
  66. package/dist/infra/ResultCollector.js +8 -8
  67. package/dist/infra/SignalHandler.d.ts +7 -7
  68. package/dist/infra/SignalHandler.js +7 -7
  69. package/dist/infra/WorkerManager.d.ts +14 -14
  70. package/dist/infra/WorkerManager.js +14 -14
  71. package/dist/orchestrators/BuildOrchestrator.d.ts +25 -25
  72. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  73. package/dist/orchestrators/BuildOrchestrator.js +29 -29
  74. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  75. package/dist/orchestrators/DevWatchOrchestrator.d.ts +7 -7
  76. package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -1
  77. package/dist/orchestrators/DevWatchOrchestrator.js +35 -57
  78. package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -1
  79. package/dist/sd-cli-entry.d.ts +2 -2
  80. package/dist/sd-cli-entry.d.ts.map +1 -1
  81. package/dist/sd-cli-entry.js +45 -9
  82. package/dist/sd-cli-entry.js.map +1 -1
  83. package/dist/sd-cli.d.ts +3 -3
  84. package/dist/sd-cli.js +16 -16
  85. package/dist/sd-cli.js.map +1 -1
  86. package/dist/sd-config.types.d.ts +105 -105
  87. package/dist/sd-config.types.d.ts.map +1 -1
  88. package/dist/utils/angular-compiler.js +5 -5
  89. package/dist/utils/angular-compiler.js.map +1 -1
  90. package/dist/utils/build-env.d.ts +1 -1
  91. package/dist/utils/build-env.js +1 -1
  92. package/dist/utils/concurrency.d.ts +7 -7
  93. package/dist/utils/concurrency.js +7 -7
  94. package/dist/utils/copy-public.d.ts +9 -9
  95. package/dist/utils/copy-public.js +17 -17
  96. package/dist/utils/copy-public.js.map +1 -1
  97. package/dist/utils/copy-src.d.ts +9 -9
  98. package/dist/utils/copy-src.js +11 -11
  99. package/dist/utils/copy-src.js.map +1 -1
  100. package/dist/utils/engine-stop.d.ts +8 -9
  101. package/dist/utils/engine-stop.d.ts.map +1 -1
  102. package/dist/utils/engine-stop.js +9 -10
  103. package/dist/utils/engine-stop.js.map +1 -1
  104. package/dist/utils/esbuild-config.d.ts +23 -23
  105. package/dist/utils/esbuild-config.d.ts.map +1 -1
  106. package/dist/utils/esbuild-config.js +25 -25
  107. package/dist/utils/esbuild-config.js.map +1 -1
  108. package/dist/utils/lint-with-program.d.ts +15 -15
  109. package/dist/utils/lint-with-program.d.ts.map +1 -1
  110. package/dist/utils/lint-with-program.js +29 -29
  111. package/dist/utils/lint-with-program.js.map +1 -1
  112. package/dist/utils/ngtsc-build-core.d.ts +8 -8
  113. package/dist/utils/ngtsc-build-core.d.ts.map +1 -1
  114. package/dist/utils/ngtsc-build-core.js +14 -14
  115. package/dist/utils/ngtsc-build-core.js.map +1 -1
  116. package/dist/utils/output-path-rewriter.d.ts +14 -14
  117. package/dist/utils/output-path-rewriter.js +18 -18
  118. package/dist/utils/output-path-rewriter.js.map +1 -1
  119. package/dist/utils/output-utils.d.ts +6 -6
  120. package/dist/utils/output-utils.js +11 -11
  121. package/dist/utils/output-utils.js.map +1 -1
  122. package/dist/utils/package-utils.d.ts +21 -21
  123. package/dist/utils/package-utils.d.ts.map +1 -1
  124. package/dist/utils/package-utils.js +56 -45
  125. package/dist/utils/package-utils.js.map +1 -1
  126. package/dist/utils/replace-deps.d.ts +25 -25
  127. package/dist/utils/replace-deps.d.ts.map +1 -1
  128. package/dist/utils/replace-deps.js +84 -65
  129. package/dist/utils/replace-deps.js.map +1 -1
  130. package/dist/utils/sd-config.d.ts +3 -3
  131. package/dist/utils/sd-config.js +3 -3
  132. package/dist/utils/tsc-build.d.ts +13 -13
  133. package/dist/utils/tsc-build.d.ts.map +1 -1
  134. package/dist/utils/tsc-build.js +9 -9
  135. package/dist/utils/tsc-build.js.map +1 -1
  136. package/dist/utils/tsconfig.d.ts +11 -9
  137. package/dist/utils/tsconfig.d.ts.map +1 -1
  138. package/dist/utils/tsconfig.js +11 -9
  139. package/dist/utils/tsconfig.js.map +1 -1
  140. package/dist/utils/typecheck-non-package.d.ts +5 -6
  141. package/dist/utils/typecheck-non-package.d.ts.map +1 -1
  142. package/dist/utils/typecheck-non-package.js +7 -8
  143. package/dist/utils/typecheck-non-package.js.map +1 -1
  144. package/dist/utils/typecheck-serialization.d.ts +8 -8
  145. package/dist/utils/typecheck-serialization.d.ts.map +1 -1
  146. package/dist/utils/typecheck-serialization.js +12 -16
  147. package/dist/utils/typecheck-serialization.js.map +1 -1
  148. package/dist/utils/vite-config.d.ts +8 -5
  149. package/dist/utils/vite-config.d.ts.map +1 -1
  150. package/dist/utils/vite-config.js +36 -29
  151. package/dist/utils/vite-config.js.map +1 -1
  152. package/dist/utils/vite-scope-watch-plugin.d.ts.map +1 -1
  153. package/dist/utils/vite-scope-watch-plugin.js +1 -1
  154. package/dist/utils/vite-scope-watch-plugin.js.map +1 -1
  155. package/dist/utils/worker-events.d.ts +12 -12
  156. package/dist/utils/worker-events.d.ts.map +1 -1
  157. package/dist/utils/worker-events.js +10 -10
  158. package/dist/utils/worker-events.js.map +1 -1
  159. package/dist/utils/worker-utils.d.ts +12 -13
  160. package/dist/utils/worker-utils.d.ts.map +1 -1
  161. package/dist/utils/worker-utils.js +12 -13
  162. package/dist/utils/worker-utils.js.map +1 -1
  163. package/dist/vitest-plugin.d.ts.map +1 -1
  164. package/dist/vitest-plugin.js +5 -7
  165. package/dist/vitest-plugin.js.map +1 -1
  166. package/dist/workers/client.worker.d.ts +4 -2
  167. package/dist/workers/client.worker.d.ts.map +1 -1
  168. package/dist/workers/client.worker.js +209 -1
  169. package/dist/workers/client.worker.js.map +1 -1
  170. package/dist/workers/library-build.worker.d.ts +1 -1
  171. package/dist/workers/library-build.worker.d.ts.map +1 -1
  172. package/dist/workers/library-build.worker.js +7 -7
  173. package/dist/workers/library-build.worker.js.map +1 -1
  174. package/dist/workers/lint.worker.d.ts +2 -2
  175. package/dist/workers/lint.worker.js +2 -2
  176. package/dist/workers/ngtsc-build.worker.js +30 -30
  177. package/dist/workers/ngtsc-build.worker.js.map +1 -1
  178. package/dist/workers/server-build.worker.d.ts +17 -17
  179. package/dist/workers/server-build.worker.d.ts.map +1 -1
  180. package/dist/workers/server-build.worker.js +46 -46
  181. package/dist/workers/server-build.worker.js.map +1 -1
  182. package/dist/workers/server-runtime.worker.d.ts +7 -7
  183. package/dist/workers/server-runtime.worker.d.ts.map +1 -1
  184. package/dist/workers/server-runtime.worker.js +17 -17
  185. package/dist/workers/server-runtime.worker.js.map +1 -1
  186. package/docs/config.md +340 -0
  187. package/docs/publish-configuration-types.md +87 -0
  188. package/docs/pwa-configuration-types.md +55 -0
  189. package/docs/vitest-plugin.md +47 -0
  190. package/package.json +9 -7
  191. package/src/angular/client-transform-stylesheet.ts +1 -1
  192. package/src/angular/vite-angular-plugin.ts +70 -37
  193. package/src/angular/vite-postcss-inline-plugin.ts +1 -1
  194. package/src/capacitor/capacitor.ts +159 -23
  195. package/src/commands/build.ts +3 -10
  196. package/src/commands/check.ts +3 -3
  197. package/src/commands/dev.ts +3 -9
  198. package/src/commands/device.ts +65 -0
  199. package/src/commands/publish.ts +30 -26
  200. package/src/commands/replace-deps.ts +3 -3
  201. package/src/commands/typecheck.ts +7 -13
  202. package/src/commands/watch.ts +9 -9
  203. package/src/electron/electron.ts +49 -4
  204. package/src/engines/BaseEngine.ts +4 -1
  205. package/src/engines/NgtscEngine.ts +7 -7
  206. package/src/engines/ServerEsbuildEngine.ts +7 -7
  207. package/src/engines/TscEngine.ts +7 -7
  208. package/src/engines/ViteEngine.ts +8 -13
  209. package/src/engines/index.ts +5 -5
  210. package/src/engines/types.ts +20 -20
  211. package/src/infra/ResultCollector.ts +9 -9
  212. package/src/infra/SignalHandler.ts +7 -7
  213. package/src/infra/WorkerManager.ts +14 -14
  214. package/src/orchestrators/BuildOrchestrator.ts +37 -37
  215. package/src/orchestrators/DevWatchOrchestrator.ts +37 -61
  216. package/src/sd-cli-entry.ts +51 -9
  217. package/src/sd-cli.ts +16 -16
  218. package/src/sd-config.types.ts +107 -107
  219. package/src/utils/angular-compiler.ts +5 -5
  220. package/src/utils/build-env.ts +1 -1
  221. package/src/utils/concurrency.ts +7 -7
  222. package/src/utils/copy-public.ts +17 -17
  223. package/src/utils/copy-src.ts +11 -11
  224. package/src/utils/engine-stop.ts +9 -10
  225. package/src/utils/esbuild-config.ts +29 -29
  226. package/src/utils/lint-with-program.ts +34 -34
  227. package/src/utils/ngtsc-build-core.ts +17 -17
  228. package/src/utils/output-path-rewriter.ts +18 -18
  229. package/src/utils/output-utils.ts +11 -11
  230. package/src/utils/package-utils.ts +57 -45
  231. package/src/utils/replace-deps.ts +92 -67
  232. package/src/utils/sd-config.ts +3 -3
  233. package/src/utils/tsc-build.ts +18 -18
  234. package/src/utils/tsconfig.ts +11 -9
  235. package/src/utils/typecheck-non-package.ts +7 -8
  236. package/src/utils/typecheck-serialization.ts +13 -15
  237. package/src/utils/vite-config.ts +45 -35
  238. package/src/utils/vite-scope-watch-plugin.ts +6 -1
  239. package/src/utils/worker-events.ts +16 -16
  240. package/src/utils/worker-utils.ts +12 -13
  241. package/src/vitest-plugin.ts +5 -8
  242. package/src/workers/client.worker.ts +236 -2
  243. package/src/workers/library-build.worker.ts +8 -8
  244. package/src/workers/lint.worker.ts +2 -2
  245. package/src/workers/ngtsc-build.worker.ts +31 -31
  246. package/src/workers/server-build.worker.ts +60 -60
  247. package/src/workers/server-runtime.worker.ts +22 -22
  248. package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +1 -0
  249. package/tests/angular/vite-angular-plugin-hmr.spec.ts +78 -0
  250. package/tests/angular/vite-angular-plugin.spec.ts +67 -0
  251. package/tests/capacitor/capacitor-build.spec.ts +6 -4
  252. package/tests/capacitor/capacitor-icon.spec.ts +7 -5
  253. package/tests/capacitor/capacitor-init.spec.ts +120 -10
  254. package/tests/capacitor/capacitor-run.spec.ts +14 -17
  255. package/tests/capacitor/capacitor-workspace.spec.ts +5 -3
  256. package/tests/commands/check.spec.ts +2 -2
  257. package/tests/commands/device.spec.ts +147 -0
  258. package/tests/commands/publish.spec.ts +2 -2
  259. package/tests/commands/typecheck.spec.ts +8 -0
  260. package/tests/electron/electron.spec.ts +12 -10
  261. package/tests/engines/base-engine.spec.ts +37 -0
  262. package/tests/engines/vite-engine.spec.ts +115 -3
  263. package/tests/orchestrators/dev-watch-orchestrator.spec.ts +21 -93
  264. package/tests/utils/vite-config.spec.ts +144 -90
  265. package/tests/workers/client-worker.spec.ts +690 -0
  266. package/tests/workers/server-build-worker.spec.ts +3 -3
@@ -64,6 +64,7 @@ export class ViteEngine implements BuildEngine {
64
64
  configs: this._pkg.config.configs,
65
65
  browserSupport: this._pkg.config.browserSupport,
66
66
  enableLint: output.lint,
67
+ exclude: this._pkg.config.exclude,
67
68
  });
68
69
 
69
70
  logger.debug(`[${this._pkg.name}] ViteEngine.run 완료 (success: ${result.success})`);
@@ -81,7 +82,7 @@ export class ViteEngine implements BuildEngine {
81
82
 
82
83
  /**
83
84
  * 워치 모드 시작 (Vite 개발 서버)
84
- * 개발 서버가 준비되면 Promise가 resolve된다.
85
+ * worker의 startWatch()가 완료되면 Promise가 resolve된다.
85
86
  */
86
87
  async startWatch(output: BuildOutput): Promise<void> {
87
88
  logger.debug(`[${this._pkg.name}] ViteEngine.startWatch 시작`);
@@ -94,7 +95,7 @@ export class ViteEngine implements BuildEngine {
94
95
  this.port = event.port;
95
96
  });
96
97
 
97
- // 리빌드 이벤트 처리 (Feature 3.3 HMR)
98
+ // 리빌드 이벤트 처리 (HMR)
98
99
  let resolver: (() => void) | undefined;
99
100
  const workerKey = `vite:${this._pkg.name}`;
100
101
 
@@ -152,6 +153,9 @@ export class ViteEngine implements BuildEngine {
152
153
  message: event.message,
153
154
  };
154
155
  this._resultCollector?.add(buildResult);
156
+
157
+ resolver?.();
158
+ resolver = undefined;
155
159
  });
156
160
 
157
161
  const port =
@@ -159,7 +163,7 @@ export class ViteEngine implements BuildEngine {
159
163
  ? this._pkg.config.server
160
164
  : undefined;
161
165
 
162
- const result = await this._worker!.startWatch({
166
+ await this._worker!.startWatch({
163
167
  name: this._pkg.name,
164
168
  cwd: this._cwd,
165
169
  pkgDir: this._pkg.dir,
@@ -169,17 +173,8 @@ export class ViteEngine implements BuildEngine {
169
173
  replaceDeps: this._replaceDeps,
170
174
  browserSupport: this._pkg.config.browserSupport,
171
175
  enableLint: output.lint,
176
+ exclude: this._pkg.config.exclude,
172
177
  });
173
-
174
- // 초기 빌드 결과 보고
175
- const buildResult: BuildResult = {
176
- name: this._pkg.name,
177
- target: "client",
178
- type: "build",
179
- status: result.success ? "success" : "error",
180
- message: result.errors?.join("\n"),
181
- };
182
- this._resultCollector?.add(buildResult);
183
178
  }
184
179
 
185
180
  /**
@@ -23,12 +23,12 @@ export type { ViteEngineOptions } from "./ViteEngine";
23
23
  export type { BuildEngine, BuildOutput, BuildPackageInfo, ClientPackageInfo, EngineResult, PackageInfo, ServerPackageInfo } from "./types";
24
24
 
25
25
  /**
26
- * Create a BuildEngine for the given package.
26
+ * 주어진 패키지에 맞는 BuildEngine 생성한다.
27
27
  *
28
- * Client packages use ViteEngine (Angular buildApplicationInternal / serveWithVite).
29
- * Server packages use ServerEsbuildEngine.
30
- * Angular Library packages (detected by @angular/core in package.json) use NgtscEngine.
31
- * Other Library packages (node/browser/neutral) use TscEngine.
28
+ * 클라이언트 패키지는 ViteEngine 사용한다.
29
+ * 서버 패키지는 ServerEsbuildEngine을 사용한다.
30
+ * Angular 라이브러리 패키지(package.json에 @angular/core 의존성 감지) NgtscEngine을 사용한다.
31
+ * 기타 라이브러리 패키지(node/browser/neutral) TscEngine을 사용한다.
32
32
  */
33
33
  export function createBuildEngine(
34
34
  pkg: BuildPackageInfo | ServerPackageInfo | ClientPackageInfo,
@@ -4,7 +4,7 @@ import type { TypecheckEnv } from "../utils/tsconfig";
4
4
  import type { LintWithProgramResult } from "../utils/lint-with-program";
5
5
 
6
6
  /**
7
- * Package information
7
+ * 패키지 정보
8
8
  */
9
9
  export interface PackageInfo {
10
10
  name: string;
@@ -13,36 +13,36 @@ export interface PackageInfo {
13
13
  }
14
14
 
15
15
  /**
16
- * PackageInfo narrowed for build packages (node/browser/neutral)
16
+ * 빌드 패키지(node/browser/neutral)로 좁혀진 PackageInfo
17
17
  */
18
18
  export type BuildPackageInfo = PackageInfo & { config: SdBuildPackageConfig };
19
19
 
20
20
  /**
21
- * PackageInfo narrowed for server packages
21
+ * 서버 패키지로 좁혀진 PackageInfo
22
22
  */
23
23
  export type ServerPackageInfo = PackageInfo & { config: SdServerPackageConfig };
24
24
 
25
25
  /**
26
- * PackageInfo narrowed for client packages
26
+ * 클라이언트 패키지로 좁혀진 PackageInfo
27
27
  */
28
28
  export type ClientPackageInfo = PackageInfo & { config: SdClientPackageConfig };
29
29
 
30
30
  /**
31
- * Build output control flags
31
+ * 빌드 출력 제어 플래그
32
32
  */
33
33
  export interface BuildOutput {
34
34
  js: boolean;
35
35
  dts: boolean;
36
- /** When true, run ESLint using the ts.Program created during typecheck. */
36
+ /** true 때, 타입체크 생성된 ts.Program으로 ESLint를 실행한다. */
37
37
  lint?: boolean;
38
- /** Typecheck environment. When set, adjusts compilerOptions via getCompilerOptionsForEnv(). */
38
+ /** 타입체크 환경. 설정 getCompilerOptionsForEnv()를 통해 compilerOptions 조정한다. */
39
39
  env?: TypecheckEnv;
40
- /** Include tests/ files in typecheck scope. Only used by check command. */
40
+ /** 타입체크 범위에 tests/ 파일을 포함한다. check 커맨드에서만 사용된다. */
41
41
  includeTests?: boolean;
42
42
  }
43
43
 
44
44
  /**
45
- * BuildEngine.run() return value
45
+ * BuildEngine.run() 반환값
46
46
  */
47
47
  export interface EngineResult {
48
48
  success: boolean;
@@ -52,33 +52,33 @@ export interface EngineResult {
52
52
  warnings: string[];
53
53
  diagnostics: SerializedDiagnostic[];
54
54
  };
55
- /** Lint result (present when BuildOutput.lint is true) */
55
+ /** 린트 결과 (BuildOutput.lint true일 때 존재) */
56
56
  lint?: LintWithProgramResult;
57
57
  }
58
58
 
59
59
  /**
60
- * Build engine interface
60
+ * 빌드 엔진 인터페이스
61
61
  *
62
- * Common contract for all build engines.
63
- * typecheck (diagnostics) is always included — not optional.
62
+ * 모든 빌드 엔진의 공통 계약.
63
+ * 타입체크(diagnostics) 항상 포함되며 선택사항이 아니다.
64
64
  */
65
65
  export interface BuildEngine {
66
66
  /**
67
- * One-time build (for production builds)
68
- * Creates workers, runs build, returns combined result.
69
- * Call stop() after to clean up resources.
67
+ * 일회성 빌드 (프로덕션)
68
+ * Worker를 생성하고, 빌드를 실행하고, 결합된 결과를 반환한다.
69
+ * 호출 stop()으로 리소스를 정리한다.
70
70
  */
71
71
  run(output: BuildOutput): Promise<EngineResult>;
72
72
 
73
73
  /**
74
- * Start watch mode
75
- * Promise resolves when initial build is complete.
76
- * Subsequent rebuilds are reported via injected ResultCollector.
74
+ * 워치 모드 시작
75
+ * 초기 빌드가 완료되면 Promise가 resolve된다.
76
+ * 이후 리빌드는 주입된 ResultCollector를 통해 보고된다.
77
77
  */
78
78
  startWatch(output: BuildOutput): Promise<void>;
79
79
 
80
80
  /**
81
- * Stop engine and clean up resources (workers, esbuild contexts)
81
+ * 엔진을 중지하고 리소스(Worker, esbuild context 등)를 정리한다
82
82
  */
83
83
  stop(): Promise<void>;
84
84
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Build result status
2
+ * 빌드 결과 상태
3
3
  */
4
4
  export interface BuildResult {
5
5
  name: string;
@@ -11,17 +11,17 @@ export interface BuildResult {
11
11
  }
12
12
 
13
13
  /**
14
- * Class that collects and manages build results
14
+ * 빌드 결과를 수집·관리하는 클래스
15
15
  *
16
- * Manages build results from multiple Builders at a central location and
17
- * provides filtering and output functionality by status.
16
+ * 여러 Builder의 빌드 결과를 중앙에서 관리하며,
17
+ * 상태별 필터링 출력 기능을 제공한다.
18
18
  */
19
19
  export class ResultCollector {
20
20
  private readonly _results = new Map<string, BuildResult>();
21
21
 
22
22
  /**
23
- * Add result
24
- * @param result build result
23
+ * 결과를 추가한다
24
+ * @param result 빌드 결과
25
25
  */
26
26
  add(result: BuildResult): void {
27
27
  const key = `${result.name}:${result.type}`;
@@ -29,15 +29,15 @@ export class ResultCollector {
29
29
  }
30
30
 
31
31
  /**
32
- * Get result by key
33
- * @param key result key (e.g., "core-common:build")
32
+ * 키로 결과를 조회한다
33
+ * @param key 결과 (예: "core-common:build")
34
34
  */
35
35
  get(key: string): BuildResult | undefined {
36
36
  return this._results.get(key);
37
37
  }
38
38
 
39
39
  /**
40
- * Return internal Map (for backward compatibility)
40
+ * 내부 Map 반환한다 (외부 접근용)
41
41
  */
42
42
  toMap(): Map<string, BuildResult> {
43
43
  return this._results;
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Class that handles process termination signals
2
+ * 프로세스 종료 시그널을 처리하는 클래스
3
3
  *
4
- * Detects SIGINT (Ctrl+C) and SIGTERM signals and
5
- * provides a Promise that waits until termination.
4
+ * SIGINT(Ctrl+C) SIGTERM 시그널을 감지하고,
5
+ * 종료까지 대기하는 Promise 제공한다.
6
6
  */
7
7
  export class SignalHandler {
8
8
  private _terminateResolver: (() => void) | null = null;
@@ -26,22 +26,22 @@ export class SignalHandler {
26
26
  }
27
27
 
28
28
  /**
29
- * Wait until termination signal is received
29
+ * 종료 시그널이 수신될 때까지 대기한다
30
30
  */
31
31
  waitForTermination(): Promise<void> {
32
32
  return this._terminatePromise;
33
33
  }
34
34
 
35
35
  /**
36
- * Check if terminated
36
+ * 종료 여부를 확인한다
37
37
  */
38
38
  isTerminated(): boolean {
39
39
  return this._terminated;
40
40
  }
41
41
 
42
42
  /**
43
- * Request termination programmatically
44
- * (used when triggering termination from tests or externally)
43
+ * 프로그래밍 방식으로 종료를 요청한다
44
+ * (테스트나 외부에서 종료를 트리거할 사용)
45
45
  */
46
46
  requestTermination(): void {
47
47
  if (!this._terminated) {
@@ -1,19 +1,19 @@
1
1
  import { Worker, type WorkerProxy, type WorkerModule } from "@simplysm/core-node";
2
2
 
3
3
  /**
4
- * Class that manages Worker lifecycle
4
+ * Worker 생명주기를 관리하는 클래스
5
5
  *
6
- * Centrally manages Worker creation, lookup, and termination
7
- * to prevent resource leaks and provide consistent Worker management.
6
+ * Worker 생성, 조회, 종료를 중앙에서 관리하여
7
+ * 리소스 누수를 방지하고 일관된 Worker 관리를 제공한다.
8
8
  */
9
9
  export class WorkerManager {
10
10
  private readonly _workers = new Map<string, WorkerProxy<WorkerModule>>();
11
11
 
12
12
  /**
13
- * Create a new Worker
14
- * @param id Worker identifier (e.g., "core-common:build")
15
- * @param workerPath Worker file path
16
- * @returns Created WorkerProxy
13
+ * Worker를 생성한다
14
+ * @param id Worker 식별자 (예: "core-common:build")
15
+ * @param workerPath Worker 파일 경로
16
+ * @returns 생성된 WorkerProxy
17
17
  */
18
18
  create<TModule extends WorkerModule>(id: string, workerPath: string): WorkerProxy<TModule> {
19
19
  const worker = Worker.create<TModule>(workerPath);
@@ -22,16 +22,16 @@ export class WorkerManager {
22
22
  }
23
23
 
24
24
  /**
25
- * Lookup Worker by ID
26
- * @param id Worker identifier
25
+ * ID로 Worker 조회한다
26
+ * @param id Worker 식별자
27
27
  */
28
28
  get<TModule extends WorkerModule>(id: string): WorkerProxy<TModule> | undefined {
29
29
  return this._workers.get(id) as WorkerProxy<TModule> | undefined;
30
30
  }
31
31
 
32
32
  /**
33
- * Terminate and remove a specific Worker
34
- * @param id Worker identifier
33
+ * 특정 Worker를 종료하고 제거한다
34
+ * @param id Worker 식별자
35
35
  */
36
36
  async terminate(id: string): Promise<void> {
37
37
  const worker = this._workers.get(id);
@@ -42,7 +42,7 @@ export class WorkerManager {
42
42
  }
43
43
 
44
44
  /**
45
- * Terminate all Workers
45
+ * 모든 Worker를 종료한다
46
46
  */
47
47
  async terminateAll(): Promise<void> {
48
48
  await Promise.all([...this._workers.values()].map((w) => w.terminate()));
@@ -50,14 +50,14 @@ export class WorkerManager {
50
50
  }
51
51
 
52
52
  /**
53
- * Number of managed Workers
53
+ * 관리 중인 Worker
54
54
  */
55
55
  get size(): number {
56
56
  return this._workers.size;
57
57
  }
58
58
 
59
59
  /**
60
- * List of all Worker IDs
60
+ * 모든 Worker ID 목록
61
61
  */
62
62
  get ids(): string[] {
63
63
  return [...this._workers.keys()];
@@ -21,17 +21,17 @@ import { Electron } from "../electron/electron";
21
21
  //#region Types
22
22
 
23
23
  /**
24
- * Build Orchestrator options
24
+ * BuildOrchestrator 옵션
25
25
  */
26
26
  export interface BuildOrchestratorOptions {
27
- /** Package filter for build (empty array includes all packages) */
27
+ /** 빌드 대상 패키지 필터 ( 배열이면 전체) */
28
28
  targets: string[];
29
- /** Additional options to pass to sd.config.ts */
29
+ /** sd.config.ts 전달할 추가 옵션 */
30
30
  options: string[];
31
31
  }
32
32
 
33
33
  /**
34
- * Build result
34
+ * 빌드 결과
35
35
  */
36
36
  interface BuildStepResult {
37
37
  name: string;
@@ -44,14 +44,14 @@ interface BuildStepResult {
44
44
  }
45
45
 
46
46
  /**
47
- * Package classification result
47
+ * 패키지 분류 결과
48
48
  */
49
49
  interface ClassifiedPackages {
50
- /** node/browser/neutral target (JS + dts) */
50
+ /** node/browser/neutral 대상 (JS + DTS) */
51
51
  buildPackages: Array<{ name: string; config: SdBuildPackageConfig }>;
52
- /** server target (JS build, no dts) */
52
+ /** server 대상 (JS 빌드, DTS 없음) */
53
53
  serverPackages: Array<{ name: string; config: SdServerPackageConfig }>;
54
- /** client target (Vite production build, no dts) */
54
+ /** client 대상 (Vite 프로덕션 빌드, DTS 없음) */
55
55
  clientPackages: Array<{ name: string; config: SdClientPackageConfig }>;
56
56
  }
57
57
 
@@ -60,11 +60,11 @@ interface ClassifiedPackages {
60
60
  //#region Utilities
61
61
 
62
62
  /**
63
- * Classify packages by target
64
- * - node/browser/neutral: buildPackages (JS + dts)
65
- * - server: serverPackages (JS build, no dts)
66
- * - client: clientPackages (Vite production build, no dts)
67
- * - scripts: excluded
63
+ * 패키지를 target별로 분류
64
+ * - node/browser/neutral: buildPackages (JS + DTS)
65
+ * - server: serverPackages (JS 빌드, DTS 없음)
66
+ * - client: clientPackages (Vite 프로덕션 빌드, DTS 없음)
67
+ * - scripts: 제외
68
68
  */
69
69
  export function classifyPackages(
70
70
  packages: Record<
@@ -97,7 +97,7 @@ export function classifyPackages(
97
97
  }
98
98
 
99
99
  /**
100
- * Delete dist folders
100
+ * dist 폴더 삭제
101
101
  */
102
102
  async function cleanDistFolders(cwd: string, packageNames: string[]): Promise<void> {
103
103
  await Promise.all(packageNames.map((name) => fsx.rm(pathx.posixResolve(cwd, "packages", name, "dist"))));
@@ -108,14 +108,14 @@ async function cleanDistFolders(cwd: string, packageNames: string[]): Promise<vo
108
108
  //#region BuildOrchestrator
109
109
 
110
110
  /**
111
- * Orchestrator for coordinating production builds
111
+ * 프로덕션 빌드를 조율하는 Orchestrator
112
112
  *
113
- * Classifies packages based on sd.config.ts and executes builds.
114
- * - Clean dist folders (clean build)
115
- * - Run lint + build concurrently
116
- * - node/browser/neutral targets: esbuild JS build + dts generation
117
- * - server targets: esbuild JS build
118
- * - client targets: Vite production build
113
+ * sd.config.ts 기반으로 패키지를 분류하고 빌드를 실행한다.
114
+ * - dist 폴더 정리 (클린 빌드)
115
+ * - lint + 빌드 동시 실행
116
+ * - 라이브러리 패키지: TscEngine/NgtscEngine으로 JS + DTS 빌드
117
+ * - 서버 패키지: BuildEngine으로 JS 빌드
118
+ * - 클라이언트 패키지: ViteEngine으로 Vite 프로덕션 빌드
119
119
  */
120
120
  export class BuildOrchestrator {
121
121
  private readonly _cwd: string;
@@ -183,12 +183,12 @@ export class BuildOrchestrator {
183
183
  }
184
184
 
185
185
  /**
186
- * Execute build
187
- * - Clean
188
- * - Lint + Build (concurrent)
189
- * - Output results
186
+ * 빌드 실행
187
+ * - 클린
188
+ * - lint + 빌드 (동시 실행)
189
+ * - 결과 출력
190
190
  *
191
- * @returns whether errors occurred (true: errors present)
191
+ * @returns 에러 발생 여부 (true: 에러 있음)
192
192
  */
193
193
  async start(): Promise<boolean> {
194
194
  if (this._allPackageNames.length === 0) {
@@ -198,15 +198,15 @@ export class BuildOrchestrator {
198
198
  const classified = this._classified!;
199
199
  const baseEnv = this._baseEnv!;
200
200
 
201
- // Collect results
201
+ // 결과 수집
202
202
  const results: BuildStepResult[] = [];
203
- // Track errors (wrapped in object to allow mutation tracking in callbacks)
203
+ // 에러 추적 (콜백에서 변경 추적을 위해 객체로 래핑)
204
204
  const state = { hasError: false };
205
205
 
206
- // File cache (for diagnostics output)
206
+ // 파일 캐시 (진단 출력용)
207
207
  const fileCache = new Map<string, string>();
208
208
 
209
- // formatHost (for diagnostics output)
209
+ // formatHost (진단 출력용)
210
210
  const formatHost: ts.FormatDiagnosticsHost = {
211
211
  getCanonicalFileName: (f) => f,
212
212
  getCurrentDirectory: () => this._cwd,
@@ -221,10 +221,10 @@ export class BuildOrchestrator {
221
221
  // Phase 2: 빌드
222
222
  const concurrency = getMaxConcurrency();
223
223
 
224
- // Create list of build tasks
224
+ // 빌드 태스크 목록 생성
225
225
  const buildTasks: Array<() => Promise<void>> = [];
226
226
 
227
- // buildPackages: JS build + dts generation via BuildEngine
227
+ // 라이브러리 패키지: BuildEngine으로 JS + DTS 빌드
228
228
  for (const { name, config } of classified.buildPackages) {
229
229
  const pkgDir = pathx.posixResolve(this._cwd, "packages", name);
230
230
 
@@ -276,7 +276,7 @@ export class BuildOrchestrator {
276
276
  });
277
277
  }
278
278
 
279
- // serverPackages: JS build + typecheck via BuildEngine
279
+ // 서버 패키지: BuildEngine으로 JS 빌드 + 타입체크
280
280
  for (const { name, config } of classified.serverPackages) {
281
281
  const pkgDir = pathx.posixResolve(this._cwd, "packages", name);
282
282
 
@@ -322,7 +322,7 @@ export class BuildOrchestrator {
322
322
  });
323
323
  }
324
324
 
325
- // clientPackages: Vite production build via ViteEngine (no dts)
325
+ // 클라이언트 패키지: ViteEngine으로 Vite 프로덕션 빌드 (DTS 없음)
326
326
  for (const { name, config } of classified.clientPackages) {
327
327
  const pkgDir = pathx.posixResolve(this._cwd, "packages", name);
328
328
 
@@ -471,11 +471,11 @@ export class BuildOrchestrator {
471
471
  }
472
472
 
473
473
  /**
474
- * Shutdown Orchestrator (no resources to clean up currently)
474
+ * Orchestrator 종료 (현재 정리할 리소스 없음)
475
475
  */
476
476
  async shutdown(): Promise<void> {
477
- // Production builds are one-time operations, so there are no resources to clean up at shutdown
478
- // Workers are cleaned up with terminate() within each build task
477
+ // 프로덕션 빌드는 일회성 작업이므로 종료 정리할 리소스가 없음
478
+ // Worker는 빌드 태스크 내에서 terminate() 정리됨
479
479
  await Promise.resolve();
480
480
  }
481
481
  }