@simplysm/sd-cli 14.0.11 → 14.0.13
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.
- package/README.md +58 -253
- package/dist/angular/client-transform-stylesheet.js +1 -1
- package/dist/angular/client-transform-stylesheet.js.map +1 -1
- package/dist/angular/vite-angular-plugin.d.ts +4 -2
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +73 -36
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/angular/vite-postcss-inline-plugin.d.ts +1 -1
- package/dist/angular/vite-postcss-inline-plugin.js +1 -1
- package/dist/capacitor/capacitor.d.ts +20 -2
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +155 -28
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/build.d.ts +3 -10
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +3 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.js +3 -3
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts +3 -9
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +3 -9
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/device.d.ts +3 -3
- package/dist/commands/device.js +5 -5
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/publish.d.ts +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +24 -26
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/replace-deps.d.ts +3 -3
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js +1 -1
- package/dist/commands/typecheck.d.ts +4 -3
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +5 -11
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/watch.d.ts +9 -9
- package/dist/commands/watch.js +9 -9
- package/dist/electron/electron.d.ts.map +1 -1
- package/dist/electron/electron.js +42 -3
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts +1 -1
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +3 -1
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/NgtscEngine.d.ts +7 -7
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +3 -3
- package/dist/engines/ServerEsbuildEngine.d.ts +7 -7
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
- package/dist/engines/ServerEsbuildEngine.js +3 -3
- package/dist/engines/TscEngine.d.ts +7 -7
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +3 -3
- package/dist/engines/ViteEngine.d.ts +7 -1
- package/dist/engines/ViteEngine.d.ts.map +1 -1
- package/dist/engines/ViteEngine.js +13 -12
- package/dist/engines/ViteEngine.js.map +1 -1
- package/dist/engines/index.d.ts +9 -5
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js +7 -5
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/types.d.ts +20 -20
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/infra/ResultCollector.d.ts +9 -9
- package/dist/infra/ResultCollector.js +8 -8
- package/dist/infra/SignalHandler.d.ts +7 -7
- package/dist/infra/SignalHandler.js +7 -7
- package/dist/infra/WorkerManager.d.ts +14 -14
- package/dist/infra/WorkerManager.js +14 -14
- package/dist/orchestrators/BuildOrchestrator.d.ts +25 -25
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +34 -30
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.d.ts +7 -7
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.js +34 -34
- package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -1
- package/dist/sd-cli-entry.d.ts +2 -2
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +15 -8
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.d.ts +3 -3
- package/dist/sd-cli.js +16 -16
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts +105 -105
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/utils/angular-compiler.js +5 -5
- package/dist/utils/angular-compiler.js.map +1 -1
- package/dist/utils/build-env.d.ts +1 -1
- package/dist/utils/build-env.js +1 -1
- package/dist/utils/concurrency.d.ts +7 -7
- package/dist/utils/concurrency.js +7 -7
- package/dist/utils/copy-public.d.ts +9 -9
- package/dist/utils/copy-public.js +17 -17
- package/dist/utils/copy-public.js.map +1 -1
- package/dist/utils/copy-src.d.ts +9 -9
- package/dist/utils/copy-src.js +11 -11
- package/dist/utils/copy-src.js.map +1 -1
- package/dist/utils/engine-stop.d.ts +8 -9
- package/dist/utils/engine-stop.d.ts.map +1 -1
- package/dist/utils/engine-stop.js +9 -10
- package/dist/utils/engine-stop.js.map +1 -1
- package/dist/utils/esbuild-config.d.ts +23 -23
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +25 -25
- package/dist/utils/esbuild-config.js.map +1 -1
- package/dist/utils/lint-with-program.d.ts +15 -15
- package/dist/utils/lint-with-program.d.ts.map +1 -1
- package/dist/utils/lint-with-program.js +29 -29
- package/dist/utils/lint-with-program.js.map +1 -1
- package/dist/utils/ngtsc-build-core.d.ts +8 -8
- package/dist/utils/ngtsc-build-core.d.ts.map +1 -1
- package/dist/utils/ngtsc-build-core.js +14 -14
- package/dist/utils/ngtsc-build-core.js.map +1 -1
- package/dist/utils/output-path-rewriter.d.ts +14 -14
- package/dist/utils/output-path-rewriter.js +18 -18
- package/dist/utils/output-path-rewriter.js.map +1 -1
- package/dist/utils/output-utils.d.ts +6 -6
- package/dist/utils/output-utils.js +11 -11
- package/dist/utils/output-utils.js.map +1 -1
- package/dist/utils/package-utils.d.ts +21 -21
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +56 -45
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/replace-deps.d.ts +25 -25
- package/dist/utils/replace-deps.d.ts.map +1 -1
- package/dist/utils/replace-deps.js +84 -65
- package/dist/utils/replace-deps.js.map +1 -1
- package/dist/utils/sd-config.d.ts +3 -3
- package/dist/utils/sd-config.js +3 -3
- package/dist/utils/tsc-build.d.ts +13 -13
- package/dist/utils/tsc-build.d.ts.map +1 -1
- package/dist/utils/tsc-build.js +9 -9
- package/dist/utils/tsc-build.js.map +1 -1
- package/dist/utils/tsconfig.d.ts +11 -9
- package/dist/utils/tsconfig.d.ts.map +1 -1
- package/dist/utils/tsconfig.js +11 -9
- package/dist/utils/tsconfig.js.map +1 -1
- package/dist/utils/typecheck-non-package.d.ts +5 -6
- package/dist/utils/typecheck-non-package.d.ts.map +1 -1
- package/dist/utils/typecheck-non-package.js +7 -8
- package/dist/utils/typecheck-non-package.js.map +1 -1
- package/dist/utils/typecheck-serialization.d.ts +8 -8
- package/dist/utils/typecheck-serialization.d.ts.map +1 -1
- package/dist/utils/typecheck-serialization.js +12 -16
- package/dist/utils/typecheck-serialization.js.map +1 -1
- package/dist/utils/vite-config.d.ts +12 -5
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +95 -41
- package/dist/utils/vite-config.js.map +1 -1
- package/dist/utils/vite-scope-watch-plugin.d.ts.map +1 -1
- package/dist/utils/vite-scope-watch-plugin.js +1 -1
- package/dist/utils/vite-scope-watch-plugin.js.map +1 -1
- package/dist/utils/worker-events.d.ts +12 -12
- package/dist/utils/worker-events.d.ts.map +1 -1
- package/dist/utils/worker-events.js +10 -10
- package/dist/utils/worker-events.js.map +1 -1
- package/dist/utils/worker-utils.d.ts +12 -13
- package/dist/utils/worker-utils.d.ts.map +1 -1
- package/dist/utils/worker-utils.js +12 -13
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +5 -7
- package/dist/vitest-plugin.js.map +1 -1
- package/dist/workers/client.worker.d.ts +8 -2
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +215 -6
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts +1 -1
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +7 -7
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts +2 -2
- package/dist/workers/lint.worker.js +2 -2
- package/dist/workers/ngtsc-build.worker.js +30 -30
- package/dist/workers/ngtsc-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts +17 -17
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +46 -46
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-runtime.worker.d.ts +7 -7
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js +17 -17
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/docs/config.md +340 -0
- package/docs/publish-configuration-types.md +87 -0
- package/docs/pwa-configuration-types.md +55 -0
- package/docs/vitest-plugin.md +47 -0
- package/package.json +9 -7
- package/src/angular/client-transform-stylesheet.ts +1 -1
- package/src/angular/vite-angular-plugin.ts +89 -39
- package/src/angular/vite-postcss-inline-plugin.ts +1 -1
- package/src/capacitor/capacitor.ts +185 -38
- package/src/commands/build.ts +3 -10
- package/src/commands/check.ts +3 -3
- package/src/commands/dev.ts +3 -9
- package/src/commands/device.ts +5 -5
- package/src/commands/publish.ts +30 -26
- package/src/commands/replace-deps.ts +3 -3
- package/src/commands/typecheck.ts +7 -13
- package/src/commands/watch.ts +9 -9
- package/src/electron/electron.ts +49 -4
- package/src/engines/BaseEngine.ts +4 -1
- package/src/engines/NgtscEngine.ts +7 -7
- package/src/engines/ServerEsbuildEngine.ts +7 -7
- package/src/engines/TscEngine.ts +7 -7
- package/src/engines/ViteEngine.ts +18 -13
- package/src/engines/index.ts +11 -5
- package/src/engines/types.ts +20 -20
- package/src/infra/ResultCollector.ts +9 -9
- package/src/infra/SignalHandler.ts +7 -7
- package/src/infra/WorkerManager.ts +14 -14
- package/src/orchestrators/BuildOrchestrator.ts +42 -38
- package/src/orchestrators/DevWatchOrchestrator.ts +36 -36
- package/src/sd-cli-entry.ts +15 -8
- package/src/sd-cli.ts +16 -16
- package/src/sd-config.types.ts +107 -107
- package/src/utils/angular-compiler.ts +5 -5
- package/src/utils/build-env.ts +1 -1
- package/src/utils/concurrency.ts +7 -7
- package/src/utils/copy-public.ts +17 -17
- package/src/utils/copy-src.ts +11 -11
- package/src/utils/engine-stop.ts +9 -10
- package/src/utils/esbuild-config.ts +29 -29
- package/src/utils/lint-with-program.ts +34 -34
- package/src/utils/ngtsc-build-core.ts +17 -17
- package/src/utils/output-path-rewriter.ts +18 -18
- package/src/utils/output-utils.ts +11 -11
- package/src/utils/package-utils.ts +57 -45
- package/src/utils/replace-deps.ts +92 -67
- package/src/utils/sd-config.ts +3 -3
- package/src/utils/tsc-build.ts +18 -18
- package/src/utils/tsconfig.ts +11 -9
- package/src/utils/typecheck-non-package.ts +7 -8
- package/src/utils/typecheck-serialization.ts +13 -15
- package/src/utils/vite-config.ts +108 -46
- package/src/utils/vite-scope-watch-plugin.ts +6 -1
- package/src/utils/worker-events.ts +16 -16
- package/src/utils/worker-utils.ts +12 -13
- package/src/vitest-plugin.ts +5 -8
- package/src/workers/client.worker.ts +246 -7
- package/src/workers/library-build.worker.ts +8 -8
- package/src/workers/lint.worker.ts +2 -2
- package/src/workers/ngtsc-build.worker.ts +31 -31
- package/src/workers/server-build.worker.ts +60 -60
- package/src/workers/server-runtime.worker.ts +22 -22
- package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +1 -0
- package/tests/angular/vite-angular-plugin-hmr.spec.ts +78 -0
- package/tests/angular/vite-angular-plugin.spec.ts +67 -0
- package/tests/capacitor/capacitor-build.spec.ts +93 -11
- package/tests/capacitor/capacitor-icon.spec.ts +7 -5
- package/tests/capacitor/capacitor-init.spec.ts +124 -10
- package/tests/capacitor/capacitor-run.spec.ts +14 -17
- package/tests/capacitor/capacitor-workspace.spec.ts +5 -3
- package/tests/commands/check.spec.ts +2 -2
- package/tests/commands/publish.spec.ts +2 -2
- package/tests/commands/typecheck.spec.ts +8 -0
- package/tests/electron/electron.spec.ts +12 -10
- package/tests/engines/base-engine.spec.ts +37 -0
- package/tests/engines/vite-engine.spec.ts +115 -3
- package/tests/utils/vite-config.spec.ts +162 -90
- package/tests/workers/client-worker.spec.ts +690 -0
- package/tests/workers/server-build-worker.spec.ts +3 -3
|
@@ -3,15 +3,15 @@ import { loadSdConfig } from "../utils/sd-config";
|
|
|
3
3
|
import { setupReplaceDeps } from "../utils/replace-deps";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* replace-deps
|
|
6
|
+
* replace-deps 명령어 옵션
|
|
7
7
|
*/
|
|
8
8
|
export interface ReplaceDepsOptions {
|
|
9
|
-
/**
|
|
9
|
+
/** sd.config.ts에 전달할 추가 옵션 */
|
|
10
10
|
options: string[];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* sd.config.ts의 replaceDeps 설정에 따라 node_modules 패키지를 로컬 소스 심볼릭 링크로 교체한다.
|
|
15
15
|
*/
|
|
16
16
|
export async function runReplaceDeps(opts: ReplaceDepsOptions): Promise<void> {
|
|
17
17
|
const cwd = process.cwd();
|
|
@@ -2,7 +2,6 @@ import ts from "typescript";
|
|
|
2
2
|
import { err as errNs } from "@simplysm/core-common";
|
|
3
3
|
import { pathx } from "@simplysm/core-node";
|
|
4
4
|
import { consola } from "consola";
|
|
5
|
-
import type { SdConfig } from "../sd-config.types";
|
|
6
5
|
import { loadSdConfig } from "../utils/sd-config";
|
|
7
6
|
import { deserializeDiagnostic } from "../utils/typecheck-serialization";
|
|
8
7
|
import { createBuildEngine } from "../engines/index";
|
|
@@ -35,14 +34,14 @@ export interface TypecheckResult {
|
|
|
35
34
|
errorCount: number;
|
|
36
35
|
warningCount: number;
|
|
37
36
|
formattedOutput: string;
|
|
38
|
-
/**
|
|
37
|
+
/** lint 결과 (TypecheckOptions.lint가 true일 때 존재) */
|
|
39
38
|
lint?: {
|
|
40
39
|
success: boolean;
|
|
41
40
|
errorCount: number;
|
|
42
41
|
warningCount: number;
|
|
43
42
|
formattedOutput: string;
|
|
44
43
|
};
|
|
45
|
-
/**
|
|
44
|
+
/** 건너뛴 scripts 패키지 경로 (별도 lint용) */
|
|
46
45
|
scriptsPackagePaths?: string[];
|
|
47
46
|
}
|
|
48
47
|
|
|
@@ -75,7 +74,8 @@ function extractTargetPackageNames(targets: string[]): Set<string> {
|
|
|
75
74
|
*
|
|
76
75
|
* sd.config.ts의 각 패키지에 대해:
|
|
77
76
|
* - 라이브러리/서버 패키지 → BuildEngine.run({js:false, dts:false})
|
|
78
|
-
* -
|
|
77
|
+
* - client 패키지 → browser target으로 변환하여 포함
|
|
78
|
+
* - scripts 패키지 → 타입체크 제외 (별도 lint만 수행)
|
|
79
79
|
* 비패키지 파일 → typecheckNonPackageFiles 유틸리티
|
|
80
80
|
*
|
|
81
81
|
* @param options - 타입체크 실행 옵션
|
|
@@ -97,14 +97,8 @@ export async function executeTypecheck(options: TypecheckOptions): Promise<Typec
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
// sd.config.ts 로드
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
sdConfig = await loadSdConfig({ cwd, dev: false, options: options.options });
|
|
103
|
-
logger.debug("sd.config.ts 로드 완료");
|
|
104
|
-
} catch {
|
|
105
|
-
sdConfig = { packages: {} };
|
|
106
|
-
logger.debug("sd.config.ts 로드 실패, 기본값 사용");
|
|
107
|
-
}
|
|
100
|
+
const sdConfig = await loadSdConfig({ cwd, dev: false, options: options.options });
|
|
101
|
+
logger.debug("sd.config.ts 로드 완료");
|
|
108
102
|
|
|
109
103
|
// 워크스페이스 패키지 탐색 및 tests/를 설정에 병합
|
|
110
104
|
const workspacePackages = discoverWorkspacePackages(cwd);
|
|
@@ -278,7 +272,7 @@ export async function executeTypecheck(options: TypecheckOptions): Promise<Typec
|
|
|
278
272
|
formattedOutput = ts.formatDiagnosticsWithColorAndContext(uniqueDiagnostics, formatHost);
|
|
279
273
|
}
|
|
280
274
|
|
|
281
|
-
//
|
|
275
|
+
// lint가 요청된 경우 lint 결과 생성
|
|
282
276
|
const lintResult = options.lint === true
|
|
283
277
|
? {
|
|
284
278
|
success: lintSuccess,
|
package/src/commands/watch.ts
CHANGED
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "../orchestrators/DevWatchOrchestrator";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* DevWatchOrchestrator를 통해 모든 패키지를 watch 모드로 빌드한다.
|
|
8
8
|
*
|
|
9
|
-
* -
|
|
10
|
-
* - `node`/`browser`/`neutral` target:
|
|
11
|
-
* - `server` target:
|
|
12
|
-
* - `scripts` target
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
9
|
+
* - `sd.config.ts`를 로드하여 패키지별 빌드 대상 정보를 확인한다
|
|
10
|
+
* - `node`/`browser`/`neutral` target: esbuild watch 모드 빌드 + .d.ts 생성
|
|
11
|
+
* - `server` target: esbuild watch 모드 빌드 (런타임 없음)
|
|
12
|
+
* - `scripts` target (watch 설정 있을 때): 파일 변경 시 hook 실행
|
|
13
|
+
* - 파일 변경 시 자동 재빌드
|
|
14
|
+
* - SIGINT/SIGTERM 시그널로 종료
|
|
15
15
|
*
|
|
16
|
-
* @param options - watch
|
|
17
|
-
* @returns
|
|
16
|
+
* @param options - watch 실행 옵션 (targets, options)
|
|
17
|
+
* @returns 종료 시그널 수신 시 resolve
|
|
18
18
|
*/
|
|
19
19
|
export async function runWatch(options: Omit<DevWatchOrchestratorOptions, "mode">): Promise<void> {
|
|
20
20
|
const orchestrator = new DevWatchOrchestrator({ mode: "watch", ...options });
|
package/src/electron/electron.ts
CHANGED
|
@@ -2,7 +2,7 @@ import os from "os";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import module from "module";
|
|
4
4
|
import { cpx, fsx, pathx } from "@simplysm/core-node";
|
|
5
|
-
import { consola } from "consola";
|
|
5
|
+
import { consola, LogLevels } from "consola";
|
|
6
6
|
import type { SdElectronConfig } from "../sd-config.types.js";
|
|
7
7
|
import { createEnvBanner } from "../utils/esbuild-config.js";
|
|
8
8
|
|
|
@@ -55,7 +55,13 @@ export class Electron {
|
|
|
55
55
|
env?: Record<string, string>,
|
|
56
56
|
): Promise<string> {
|
|
57
57
|
Electron._logger.debug(`실행: ${cmd} ${args.join(" ")}`);
|
|
58
|
-
const
|
|
58
|
+
const isDebug = consola.level >= LogLevels.debug;
|
|
59
|
+
const { stdout: result } = await cpx.spawn(cmd, args, {
|
|
60
|
+
cwd,
|
|
61
|
+
env,
|
|
62
|
+
shell: true,
|
|
63
|
+
...(isDebug ? { stdio: "inherit" } : {}),
|
|
64
|
+
});
|
|
59
65
|
Electron._logger.debug(`결과: ${result}`);
|
|
60
66
|
return result;
|
|
61
67
|
}
|
|
@@ -63,18 +69,28 @@ export class Electron {
|
|
|
63
69
|
//#region Public Methods
|
|
64
70
|
|
|
65
71
|
async initialize(): Promise<void> {
|
|
72
|
+
Electron._logger.debug("initialize 시작");
|
|
66
73
|
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
67
74
|
|
|
75
|
+
Electron._logger.debug("package.json 설정 시작");
|
|
68
76
|
await this._setupPackageJson(srcPath);
|
|
77
|
+
Electron._logger.debug("package.json 설정 완료");
|
|
78
|
+
|
|
79
|
+
Electron._logger.debug("npm install 시작");
|
|
69
80
|
await this._exec("npm", ["install"], srcPath);
|
|
81
|
+
Electron._logger.debug("npm install 완료");
|
|
70
82
|
|
|
71
83
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
72
84
|
if (reinstallDeps.length > 0) {
|
|
85
|
+
Electron._logger.debug(`electron-rebuild 시작 (${reinstallDeps.join(", ")})`);
|
|
73
86
|
await this._exec(this._localBin("electron-rebuild"), [], srcPath);
|
|
87
|
+
Electron._logger.debug("electron-rebuild 완료");
|
|
74
88
|
}
|
|
89
|
+
Electron._logger.debug("initialize 완료");
|
|
75
90
|
}
|
|
76
91
|
|
|
77
92
|
async run(url: string): Promise<void> {
|
|
93
|
+
Electron._logger.debug(`run 시작 (url: ${url})`);
|
|
78
94
|
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
79
95
|
|
|
80
96
|
await this.initialize();
|
|
@@ -90,12 +106,13 @@ export class Electron {
|
|
|
90
106
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
91
107
|
await fsx.mkdir(srcPath);
|
|
92
108
|
|
|
93
|
-
let currentElectron: cpx.
|
|
109
|
+
let currentElectron: cpx.SpawnProcess | null = null;
|
|
94
110
|
let isRestarting = false;
|
|
95
111
|
let resolveTermination: (() => void) | null = null;
|
|
96
112
|
|
|
97
113
|
const spawnElectron = () => {
|
|
98
|
-
|
|
114
|
+
Electron._logger.debug("Electron 프로세스 시작");
|
|
115
|
+
currentElectron = cpx.spawn(this._localBin("electron"), ["."], {
|
|
99
116
|
cwd: srcPath,
|
|
100
117
|
stdio: "inherit",
|
|
101
118
|
reject: false,
|
|
@@ -112,6 +129,7 @@ export class Electron {
|
|
|
112
129
|
|
|
113
130
|
const envBanner = createEnvBanner({ ELECTRON_DEV_URL: url, ...this._config.env });
|
|
114
131
|
|
|
132
|
+
Electron._logger.debug("esbuild context 생성 시작");
|
|
115
133
|
const ctx = await esbuild.context({
|
|
116
134
|
entryPoints: [entryPoint],
|
|
117
135
|
outfile: pathx.posixResolve(srcPath, "electron-main.js"),
|
|
@@ -131,8 +149,11 @@ export class Electron {
|
|
|
131
149
|
return;
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
Electron._logger.debug("esbuild 번들링 완료");
|
|
153
|
+
|
|
134
154
|
if (currentElectron != null) {
|
|
135
155
|
isRestarting = true;
|
|
156
|
+
Electron._logger.debug("기존 Electron 프로세스 종료 시작");
|
|
136
157
|
currentElectron.kill();
|
|
137
158
|
try {
|
|
138
159
|
await currentElectron;
|
|
@@ -149,8 +170,11 @@ export class Electron {
|
|
|
149
170
|
},
|
|
150
171
|
],
|
|
151
172
|
});
|
|
173
|
+
Electron._logger.debug("esbuild context 생성 완료");
|
|
152
174
|
|
|
175
|
+
Electron._logger.debug("esbuild watch 시작");
|
|
153
176
|
await ctx.watch();
|
|
177
|
+
Electron._logger.debug("esbuild watch 시작 완료, 종료 대기 중");
|
|
154
178
|
|
|
155
179
|
await new Promise<void>((resolve) => {
|
|
156
180
|
let disposed = false;
|
|
@@ -158,6 +182,7 @@ export class Electron {
|
|
|
158
182
|
const cleanup = () => {
|
|
159
183
|
if (disposed) return;
|
|
160
184
|
disposed = true;
|
|
185
|
+
Electron._logger.debug("cleanup 시작");
|
|
161
186
|
process.removeListener("SIGINT", signalHandler);
|
|
162
187
|
process.removeListener("SIGTERM", signalHandler);
|
|
163
188
|
void ctx.dispose();
|
|
@@ -167,6 +192,7 @@ export class Electron {
|
|
|
167
192
|
resolveTermination = cleanup;
|
|
168
193
|
|
|
169
194
|
const signalHandler = () => {
|
|
195
|
+
Electron._logger.debug("시그널 수신, Electron 종료 중");
|
|
170
196
|
if (currentElectron != null) currentElectron.kill();
|
|
171
197
|
cleanup();
|
|
172
198
|
};
|
|
@@ -174,15 +200,30 @@ export class Electron {
|
|
|
174
200
|
process.once("SIGINT", signalHandler);
|
|
175
201
|
process.once("SIGTERM", signalHandler);
|
|
176
202
|
});
|
|
203
|
+
Electron._logger.debug("run 완료");
|
|
177
204
|
}
|
|
178
205
|
|
|
179
206
|
async build(outPath: string): Promise<void> {
|
|
207
|
+
Electron._logger.debug("build 시작");
|
|
180
208
|
const srcPath = pathx.posixResolve(this._electronPath, "src");
|
|
181
209
|
|
|
210
|
+
Electron._logger.debug("메인 프로세스 번들링 시작");
|
|
182
211
|
await this._bundleMainProcess(srcPath);
|
|
212
|
+
Electron._logger.debug("메인 프로세스 번들링 완료");
|
|
213
|
+
|
|
214
|
+
Electron._logger.debug("웹 에셋 복사 시작");
|
|
183
215
|
await this._copyWebAssets(outPath, srcPath);
|
|
216
|
+
Electron._logger.debug("웹 에셋 복사 완료");
|
|
217
|
+
|
|
218
|
+
Electron._logger.debug("electron-builder 실행 시작");
|
|
184
219
|
await this._runElectronBuilder(srcPath);
|
|
220
|
+
Electron._logger.debug("electron-builder 실행 완료");
|
|
221
|
+
|
|
222
|
+
Electron._logger.debug("빌드 산출물 복사 시작");
|
|
185
223
|
await this._copyBuildOutput(outPath);
|
|
224
|
+
Electron._logger.debug("빌드 산출물 복사 완료");
|
|
225
|
+
|
|
226
|
+
Electron._logger.debug("build 완료");
|
|
186
227
|
}
|
|
187
228
|
|
|
188
229
|
//#endregion
|
|
@@ -245,6 +286,7 @@ export class Electron {
|
|
|
245
286
|
|
|
246
287
|
const envBanner = createEnvBanner(this._config.env);
|
|
247
288
|
|
|
289
|
+
Electron._logger.debug(`esbuild 번들링: ${entryPoint}`);
|
|
248
290
|
await esbuild.build({
|
|
249
291
|
entryPoints: [entryPoint],
|
|
250
292
|
outfile: pathx.posixResolve(outDir, "electron-main.js"),
|
|
@@ -322,6 +364,7 @@ export class Electron {
|
|
|
322
364
|
const configFilePath = pathx.posixResolve(this._electronPath, "builder-config.json");
|
|
323
365
|
await fsx.writeJson(configFilePath, builderConfig, { space: 2 });
|
|
324
366
|
|
|
367
|
+
Electron._logger.debug(`electron-builder 설정: ${configFilePath}`);
|
|
325
368
|
await this._exec(
|
|
326
369
|
this._localBin("electron-builder"),
|
|
327
370
|
["--win", "--config", configFilePath],
|
|
@@ -340,6 +383,7 @@ export class Electron {
|
|
|
340
383
|
const isPortable = this._config.portable === true;
|
|
341
384
|
|
|
342
385
|
// exe 파일 동적 탐색 — Setup 또는 portable exe를 우선 선택
|
|
386
|
+
Electron._logger.debug(`빌드 산출물 탐색: ${distPath}`);
|
|
343
387
|
const allExeFiles = await fsx.glob(pathx.posixResolve(distPath, "*.exe"));
|
|
344
388
|
if (allExeFiles.length === 0) {
|
|
345
389
|
Electron._logger.warn(`빌드 산출물(.exe)을 찾을 수 없습니다: ${distPath}`);
|
|
@@ -348,6 +392,7 @@ export class Electron {
|
|
|
348
392
|
const keyword = isPortable ? "portable" : "Setup";
|
|
349
393
|
const sourcePath =
|
|
350
394
|
allExeFiles.find((f) => f.toLowerCase().includes(keyword.toLowerCase())) ?? allExeFiles[0];
|
|
395
|
+
Electron._logger.debug(`빌드 산출물: ${sourcePath}`);
|
|
351
396
|
|
|
352
397
|
const latestFileName = `${safeName}${isPortable ? "-portable" : ""}-latest.exe`;
|
|
353
398
|
await fsx.copy(sourcePath, pathx.posixResolve(electronOutPath, latestFileName));
|
|
@@ -53,7 +53,7 @@ export interface BaseEngineOptions<TPkg extends PackageInfo> {
|
|
|
53
53
|
* 이벤트 처리)이 여기에 위치하며, 서브클래스는 추상 메서드를 통해
|
|
54
54
|
* 워커 경로, 빌드/워치 호출 파라미터, 타겟 결정을 제공한다.
|
|
55
55
|
*
|
|
56
|
-
* ViteEngine은 이 계층에 포함되지 않음 —
|
|
56
|
+
* ViteEngine은 이 계층에 포함되지 않음 — serverReady 이벤트, port 관리 등 생명주기가 다름.
|
|
57
57
|
*/
|
|
58
58
|
export abstract class BaseEngine<
|
|
59
59
|
TPkg extends PackageInfo,
|
|
@@ -189,6 +189,9 @@ export abstract class BaseEngine<
|
|
|
189
189
|
};
|
|
190
190
|
this._resultCollector?.add(result);
|
|
191
191
|
|
|
192
|
+
resolver?.();
|
|
193
|
+
resolver = undefined;
|
|
194
|
+
|
|
192
195
|
// 에러 경로: 항상 resolve (reject하지 않음) — 호출자가 ResultCollector에서 상태를 확인
|
|
193
196
|
if (isInitialBuild) {
|
|
194
197
|
isInitialBuild = false;
|
|
@@ -8,24 +8,24 @@ import { consola } from "consola";
|
|
|
8
8
|
const logger = consola.withTag("sd:cli:engine:ngtsc");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* NgtscEngine
|
|
11
|
+
* NgtscEngine 옵션
|
|
12
12
|
*/
|
|
13
13
|
export interface NgtscEngineOptions {
|
|
14
14
|
cwd: string;
|
|
15
15
|
pkg: BuildPackageInfo;
|
|
16
|
-
/**
|
|
16
|
+
/** sd.config.ts의 replaceDeps 설정 */
|
|
17
17
|
replaceDeps?: Record<string, string>;
|
|
18
|
-
/**
|
|
18
|
+
/** 워치 모드 리빌드 보고용 ResultCollector */
|
|
19
19
|
resultCollector?: ResultCollector;
|
|
20
|
-
/**
|
|
20
|
+
/** 워치 모드 배치 조정용 RebuildManager */
|
|
21
21
|
rebuildManager?: RebuildManager;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* NgtscProgram
|
|
25
|
+
* NgtscProgram 기반 Angular 라이브러리 패키지용 빌드 엔진
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* NgtscProgram을 사용하여 AOT 컴파일을 수행하는 ngtsc-build.worker를 래핑한다.
|
|
28
|
+
* package.json에 @angular/core 의존성이 있는 Angular 패키지용.
|
|
29
29
|
*/
|
|
30
30
|
export class NgtscEngine extends BaseEngine<
|
|
31
31
|
BuildPackageInfo,
|
|
@@ -8,24 +8,24 @@ import { consola } from "consola";
|
|
|
8
8
|
const logger = consola.withTag("sd:cli:engine:server");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* ServerEsbuildEngine
|
|
11
|
+
* ServerEsbuildEngine 옵션
|
|
12
12
|
*/
|
|
13
13
|
export interface ServerEsbuildEngineOptions {
|
|
14
14
|
cwd: string;
|
|
15
15
|
pkg: ServerPackageInfo;
|
|
16
|
-
/**
|
|
16
|
+
/** sd.config.ts의 replaceDeps 설정 */
|
|
17
17
|
replaceDeps?: Record<string, string>;
|
|
18
|
-
/**
|
|
18
|
+
/** 워치 모드 리빌드 보고용 ResultCollector */
|
|
19
19
|
resultCollector?: ResultCollector;
|
|
20
|
-
/**
|
|
20
|
+
/** 워치 모드 배치 조정용 RebuildManager */
|
|
21
21
|
rebuildManager?: RebuildManager;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* esbuild 기반 서버 패키지용 빌드 엔진
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* esbuild(JS 번들) + tsc(타입체크)를 하나의 Worker 스레드에서 결합하는
|
|
28
|
+
* server-build.worker를 래핑한다.
|
|
29
29
|
*/
|
|
30
30
|
export class ServerEsbuildEngine extends BaseEngine<
|
|
31
31
|
ServerPackageInfo,
|
package/src/engines/TscEngine.ts
CHANGED
|
@@ -8,24 +8,24 @@ import { consola } from "consola";
|
|
|
8
8
|
const logger = consola.withTag("sd:cli:engine:tsc");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* TscEngine
|
|
11
|
+
* TscEngine 옵션
|
|
12
12
|
*/
|
|
13
13
|
export interface TscEngineOptions {
|
|
14
14
|
cwd: string;
|
|
15
15
|
pkg: BuildPackageInfo;
|
|
16
|
-
/**
|
|
16
|
+
/** sd.config.ts의 replaceDeps 설정 */
|
|
17
17
|
replaceDeps?: Record<string, string>;
|
|
18
|
-
/**
|
|
18
|
+
/** 워치 모드 리빌드 보고용 ResultCollector */
|
|
19
19
|
resultCollector?: ResultCollector;
|
|
20
|
-
/**
|
|
20
|
+
/** 워치 모드 배치 조정용 RebuildManager */
|
|
21
21
|
rebuildManager?: RebuildManager;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* tsc
|
|
25
|
+
* tsc 기반 라이브러리 패키지(node/browser/neutral)용 빌드 엔진
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* tsc를 사용하여 JS + DTS를 emit하는 library-build.worker를
|
|
28
|
+
* 하나의 Worker 스레드에서 래핑한다.
|
|
29
29
|
*/
|
|
30
30
|
export class TscEngine extends BaseEngine<
|
|
31
31
|
BuildPackageInfo,
|
|
@@ -20,6 +20,10 @@ export interface ViteEngineOptions {
|
|
|
20
20
|
rebuildManager?: RebuildManager;
|
|
21
21
|
/** sdScopeWatchPlugin용 replaceDeps 항목 */
|
|
22
22
|
replaceDeps?: Array<{ packageName: string; sourcePath: string }>;
|
|
23
|
+
/** 빌드 출력 경로 (미설정 시 pkgDir/dist) */
|
|
24
|
+
outDir?: string;
|
|
25
|
+
/** Vite base 경로 (미설정 시 /{pkgName}/) */
|
|
26
|
+
base?: string;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
@@ -34,6 +38,8 @@ export class ViteEngine implements BuildEngine {
|
|
|
34
38
|
private readonly _resultCollector: ResultCollector | undefined;
|
|
35
39
|
private readonly _rebuildManager: RebuildManager | undefined;
|
|
36
40
|
private readonly _replaceDeps: Array<{ packageName: string; sourcePath: string }> | undefined;
|
|
41
|
+
private readonly _outDir: string | undefined;
|
|
42
|
+
private readonly _base: string | undefined;
|
|
37
43
|
|
|
38
44
|
private _worker: WorkerProxy<typeof ClientWorkerModule> | undefined;
|
|
39
45
|
private _isWatchMode = false;
|
|
@@ -47,6 +53,8 @@ export class ViteEngine implements BuildEngine {
|
|
|
47
53
|
this._resultCollector = options.resultCollector;
|
|
48
54
|
this._rebuildManager = options.rebuildManager;
|
|
49
55
|
this._replaceDeps = options.replaceDeps;
|
|
56
|
+
this._outDir = options.outDir;
|
|
57
|
+
this._base = options.base;
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
/**
|
|
@@ -64,6 +72,9 @@ export class ViteEngine implements BuildEngine {
|
|
|
64
72
|
configs: this._pkg.config.configs,
|
|
65
73
|
browserSupport: this._pkg.config.browserSupport,
|
|
66
74
|
enableLint: output.lint,
|
|
75
|
+
exclude: this._pkg.config.exclude,
|
|
76
|
+
outDir: this._outDir,
|
|
77
|
+
base: this._base,
|
|
67
78
|
});
|
|
68
79
|
|
|
69
80
|
logger.debug(`[${this._pkg.name}] ViteEngine.run 완료 (success: ${result.success})`);
|
|
@@ -81,7 +92,7 @@ export class ViteEngine implements BuildEngine {
|
|
|
81
92
|
|
|
82
93
|
/**
|
|
83
94
|
* 워치 모드 시작 (Vite 개발 서버)
|
|
84
|
-
*
|
|
95
|
+
* worker의 startWatch()가 완료되면 Promise가 resolve된다.
|
|
85
96
|
*/
|
|
86
97
|
async startWatch(output: BuildOutput): Promise<void> {
|
|
87
98
|
logger.debug(`[${this._pkg.name}] ViteEngine.startWatch 시작`);
|
|
@@ -94,7 +105,7 @@ export class ViteEngine implements BuildEngine {
|
|
|
94
105
|
this.port = event.port;
|
|
95
106
|
});
|
|
96
107
|
|
|
97
|
-
// 리빌드 이벤트 처리 (
|
|
108
|
+
// 리빌드 이벤트 처리 (HMR)
|
|
98
109
|
let resolver: (() => void) | undefined;
|
|
99
110
|
const workerKey = `vite:${this._pkg.name}`;
|
|
100
111
|
|
|
@@ -152,6 +163,9 @@ export class ViteEngine implements BuildEngine {
|
|
|
152
163
|
message: event.message,
|
|
153
164
|
};
|
|
154
165
|
this._resultCollector?.add(buildResult);
|
|
166
|
+
|
|
167
|
+
resolver?.();
|
|
168
|
+
resolver = undefined;
|
|
155
169
|
});
|
|
156
170
|
|
|
157
171
|
const port =
|
|
@@ -159,7 +173,7 @@ export class ViteEngine implements BuildEngine {
|
|
|
159
173
|
? this._pkg.config.server
|
|
160
174
|
: undefined;
|
|
161
175
|
|
|
162
|
-
|
|
176
|
+
await this._worker!.startWatch({
|
|
163
177
|
name: this._pkg.name,
|
|
164
178
|
cwd: this._cwd,
|
|
165
179
|
pkgDir: this._pkg.dir,
|
|
@@ -169,17 +183,8 @@ export class ViteEngine implements BuildEngine {
|
|
|
169
183
|
replaceDeps: this._replaceDeps,
|
|
170
184
|
browserSupport: this._pkg.config.browserSupport,
|
|
171
185
|
enableLint: output.lint,
|
|
186
|
+
exclude: this._pkg.config.exclude,
|
|
172
187
|
});
|
|
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
188
|
}
|
|
184
189
|
|
|
185
190
|
/**
|
package/src/engines/index.ts
CHANGED
|
@@ -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
|
-
*
|
|
26
|
+
* 주어진 패키지에 맞는 BuildEngine을 생성한다.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Angular
|
|
31
|
-
*
|
|
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,
|
|
@@ -38,6 +38,10 @@ export function createBuildEngine(
|
|
|
38
38
|
resolvedReplaceDeps?: Array<{ packageName: string; sourcePath: string }>;
|
|
39
39
|
resultCollector?: ResultCollector;
|
|
40
40
|
rebuildManager?: RebuildManager;
|
|
41
|
+
/** 클라이언트 빌드 출력 경로 (ViteEngine에만 적용) */
|
|
42
|
+
outDir?: string;
|
|
43
|
+
/** Vite base 경로 (ViteEngine에만 적용, 미설정 시 /{pkgName}/) */
|
|
44
|
+
base?: string;
|
|
41
45
|
},
|
|
42
46
|
): BuildEngine {
|
|
43
47
|
if (pkg.config.target === "client") {
|
|
@@ -48,6 +52,8 @@ export function createBuildEngine(
|
|
|
48
52
|
resultCollector: options.resultCollector,
|
|
49
53
|
rebuildManager: options.rebuildManager,
|
|
50
54
|
replaceDeps: options.resolvedReplaceDeps,
|
|
55
|
+
outDir: options.outDir,
|
|
56
|
+
base: options.base,
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
|
package/src/engines/types.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
16
|
+
* 빌드 패키지(node/browser/neutral)로 좁혀진 PackageInfo
|
|
17
17
|
*/
|
|
18
18
|
export type BuildPackageInfo = PackageInfo & { config: SdBuildPackageConfig };
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 서버 패키지로 좁혀진 PackageInfo
|
|
22
22
|
*/
|
|
23
23
|
export type ServerPackageInfo = PackageInfo & { config: SdServerPackageConfig };
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* 클라이언트 패키지로 좁혀진 PackageInfo
|
|
27
27
|
*/
|
|
28
28
|
export type ClientPackageInfo = PackageInfo & { config: SdClientPackageConfig };
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* 빌드 출력 제어 플래그
|
|
32
32
|
*/
|
|
33
33
|
export interface BuildOutput {
|
|
34
34
|
js: boolean;
|
|
35
35
|
dts: boolean;
|
|
36
|
-
/**
|
|
36
|
+
/** true일 때, 타입체크 중 생성된 ts.Program으로 ESLint를 실행한다. */
|
|
37
37
|
lint?: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/** 타입체크 환경. 설정 시 getCompilerOptionsForEnv()를 통해 compilerOptions를 조정한다. */
|
|
39
39
|
env?: TypecheckEnv;
|
|
40
|
-
/**
|
|
40
|
+
/** 타입체크 범위에 tests/ 파일을 포함한다. check 커맨드에서만 사용된다. */
|
|
41
41
|
includeTests?: boolean;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* BuildEngine.run()
|
|
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
|
-
/**
|
|
55
|
+
/** 린트 결과 (BuildOutput.lint가 true일 때 존재) */
|
|
56
56
|
lint?: LintWithProgramResult;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 빌드 엔진 인터페이스
|
|
61
61
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* 모든 빌드 엔진의 공통 계약.
|
|
63
|
+
* 타입체크(diagnostics)는 항상 포함되며 선택사항이 아니다.
|
|
64
64
|
*/
|
|
65
65
|
export interface BuildEngine {
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* 일회성 빌드 (프로덕션)
|
|
68
|
+
* Worker를 생성하고, 빌드를 실행하고, 결합된 결과를 반환한다.
|
|
69
|
+
* 호출 후 stop()으로 리소스를 정리한다.
|
|
70
70
|
*/
|
|
71
71
|
run(output: BuildOutput): Promise<EngineResult>;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* 워치 모드 시작
|
|
75
|
+
* 초기 빌드가 완료되면 Promise가 resolve된다.
|
|
76
|
+
* 이후 리빌드는 주입된 ResultCollector를 통해 보고된다.
|
|
77
77
|
*/
|
|
78
78
|
startWatch(output: BuildOutput): Promise<void>;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* 엔진을 중지하고 리소스(Worker, esbuild context 등)를 정리한다
|
|
82
82
|
*/
|
|
83
83
|
stop(): Promise<void>;
|
|
84
84
|
}
|