@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.
- 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 +1 -1
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +60 -34
- 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 +14 -2
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +131 -17
- 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 +13 -0
- package/dist/commands/device.d.ts.map +1 -0
- package/dist/commands/device.js +53 -0
- package/dist/commands/device.js.map +1 -0
- package/dist/commands/publish.d.ts +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +18 -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 +1 -1
- package/dist/engines/ViteEngine.d.ts.map +1 -1
- package/dist/engines/ViteEngine.js +7 -12
- package/dist/engines/ViteEngine.js.map +1 -1
- package/dist/engines/index.d.ts +5 -5
- package/dist/engines/index.js +5 -5
- 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 +29 -29
- 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 +35 -57
- 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 +45 -9
- 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 +8 -5
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +36 -29
- 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 +4 -2
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +209 -1
- 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 +70 -37
- package/src/angular/vite-postcss-inline-plugin.ts +1 -1
- package/src/capacitor/capacitor.ts +159 -23
- 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 +65 -0
- 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 +8 -13
- package/src/engines/index.ts +5 -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 +37 -37
- package/src/orchestrators/DevWatchOrchestrator.ts +37 -61
- package/src/sd-cli-entry.ts +51 -9
- 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 +45 -35
- 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 +236 -2
- 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 +6 -4
- package/tests/capacitor/capacitor-icon.spec.ts +7 -5
- package/tests/capacitor/capacitor-init.spec.ts +120 -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/device.spec.ts +147 -0
- 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/orchestrators/dev-watch-orchestrator.spec.ts +21 -93
- package/tests/utils/vite-config.spec.ts +144 -90
- package/tests/workers/client-worker.spec.ts +690 -0
- package/tests/workers/server-build-worker.spec.ts +3 -3
|
@@ -2,7 +2,7 @@ import { consola } from "consola";
|
|
|
2
2
|
import type { BuildResult } from "../infra/ResultCollector";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 빌드 경고/에러 메시지를 포맷팅한다.
|
|
6
6
|
*/
|
|
7
7
|
export function formatBuildMessages(name: string, label: string, messages: string[]): string {
|
|
8
8
|
const lines: string[] = [`${name} (${label})`];
|
|
@@ -15,8 +15,8 @@ export function formatBuildMessages(name: string, label: string, messages: strin
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param results
|
|
18
|
+
* 에러만 출력한다.
|
|
19
|
+
* @param results 패키지별 빌드 결과 상태
|
|
20
20
|
*/
|
|
21
21
|
export function printErrors(results: Map<string, BuildResult>): void {
|
|
22
22
|
for (const result of results.values()) {
|
|
@@ -32,34 +32,34 @@ export function printErrors(results: Map<string, BuildResult>): void {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param results
|
|
37
|
-
* @param serverClientsMap
|
|
35
|
+
* 서버 URL만 출력한다.
|
|
36
|
+
* @param results 패키지별 빌드 결과 상태
|
|
37
|
+
* @param serverClientsMap 서버별 연결된 클라이언트 목록
|
|
38
38
|
*/
|
|
39
39
|
export function printServers(
|
|
40
40
|
results: Map<string, BuildResult>,
|
|
41
41
|
serverClientsMap?: Map<string, string[]>,
|
|
42
42
|
): void {
|
|
43
|
-
//
|
|
43
|
+
// 서버 정보 수집
|
|
44
44
|
const servers = [...results.values()].filter((r) => r.status === "running" && r.port != null);
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// 서버 정보 출력 (있으면 앞에 빈 줄 추가)
|
|
47
47
|
if (servers.length > 0) {
|
|
48
48
|
process.stdout.write("\n");
|
|
49
49
|
for (const server of servers) {
|
|
50
50
|
if (server.target === "server") {
|
|
51
|
-
//
|
|
51
|
+
// 서버에 연결된 클라이언트가 있으면 클라이언트 URL만 출력
|
|
52
52
|
const clients = serverClientsMap?.get(server.name) ?? [];
|
|
53
53
|
if (clients.length > 0) {
|
|
54
54
|
for (const clientName of clients) {
|
|
55
55
|
consola.info(`[server] http://localhost:${server.port}/${clientName}/`);
|
|
56
56
|
}
|
|
57
57
|
} else {
|
|
58
|
-
//
|
|
58
|
+
// 연결된 클라이언트가 없으면 서버 루트 URL 출력
|
|
59
59
|
consola.info(`[server] http://localhost:${server.port}/`);
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
62
|
-
//
|
|
62
|
+
// 독립형 클라이언트: 이름 포함하여 출력
|
|
63
63
|
consola.info(`[server] http://localhost:${server.port}/${server.name}/`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -33,7 +33,7 @@ export function iteratePackages(
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* import.meta.dirname에서 위로 탐색하여 package.json을 찾고 패키지 루트를 반환한다.
|
|
37
37
|
*/
|
|
38
38
|
export function findPackageRoot(startDir: string): string {
|
|
39
39
|
let dir = startDir;
|
|
@@ -46,8 +46,8 @@ export function findPackageRoot(startDir: string): string {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
49
|
+
* packages/ 및 tests/ 디렉토리에서 모든 워크스페이스 패키지를 탐색한다.
|
|
50
|
+
* 디렉토리명 → 상대 경로의 맵을 반환한다 (예: "orm" → "tests/orm").
|
|
51
51
|
*/
|
|
52
52
|
export function discoverWorkspacePackages(cwd: string): Map<string, string> {
|
|
53
53
|
logger.debug("워크스페이스 패키지 탐색 시작");
|
|
@@ -71,13 +71,7 @@ export function discoverWorkspacePackages(cwd: string): Map<string, string> {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
* Tests packages are assigned `{ target: "node" }` by default.
|
|
76
|
-
* Also builds a pathMap (name → relative path) for all packages.
|
|
77
|
-
* Throws SdError if a tests package name collides with an sd.config.ts package name.
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Build pathMap from sd.config.ts packages only (without tests packages).
|
|
74
|
+
* sd.config.ts 패키지만으로 pathMap을 구성한다 (tests 패키지 제외).
|
|
81
75
|
*/
|
|
82
76
|
export function buildPathMapFromConfig(
|
|
83
77
|
configPackages: Record<string, SdPackageConfig | undefined>,
|
|
@@ -89,6 +83,12 @@ export function buildPathMapFromConfig(
|
|
|
89
83
|
return pathMap;
|
|
90
84
|
}
|
|
91
85
|
|
|
86
|
+
/**
|
|
87
|
+
* workspace에서 발견된 tests/ 패키지를 sd.config.ts 패키지에 병합한다.
|
|
88
|
+
* tests 패키지는 기본적으로 `{ target: "node" }`가 할당된다.
|
|
89
|
+
* 모든 패키지의 pathMap(name → 상대 경로)도 함께 구성한다.
|
|
90
|
+
* tests 패키지명이 sd.config.ts 패키지명과 충돌하면 SdError를 던진다.
|
|
91
|
+
*/
|
|
92
92
|
export function mergeTestsPackagesIntoConfig(
|
|
93
93
|
configPackages: Record<string, SdPackageConfig | undefined>,
|
|
94
94
|
workspacePackages: Map<string, string>,
|
|
@@ -97,12 +97,12 @@ export function mergeTestsPackagesIntoConfig(
|
|
|
97
97
|
const pathMap = new Map<string, string>();
|
|
98
98
|
const merged: Record<string, SdPackageConfig | undefined> = { ...configPackages };
|
|
99
99
|
|
|
100
|
-
//
|
|
100
|
+
// config 패키지의 기본 경로 설정
|
|
101
101
|
for (const name of Object.keys(configPackages)) {
|
|
102
102
|
pathMap.set(name, `packages/${name}`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
//
|
|
105
|
+
// tests 패키지 추가
|
|
106
106
|
for (const [name, relPath] of workspacePackages) {
|
|
107
107
|
if (!relPath.startsWith("tests/")) continue;
|
|
108
108
|
|
|
@@ -125,6 +125,22 @@ export interface DepsResult {
|
|
|
125
125
|
replaceDeps: string[];
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* pnpm-workspace.yaml 기반으로 workspace 패키지의 name → 상대 디렉토리 맵을 구성한다.
|
|
130
|
+
* 예: "@simplysm/core-node" → "packages/core-node"
|
|
131
|
+
*/
|
|
132
|
+
function buildWorkspacePkgMap(cwd: string): Map<string, string> {
|
|
133
|
+
const map = new Map<string, string>();
|
|
134
|
+
const wsPkgs = discoverWorkspacePackages(cwd);
|
|
135
|
+
for (const [, relDir] of wsPkgs) {
|
|
136
|
+
const pkgJsonPath = pathx.posix(path.join(cwd, relDir, "package.json"));
|
|
137
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
138
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8")) as { name: string };
|
|
139
|
+
map.set(pkgJson.name, relDir);
|
|
140
|
+
}
|
|
141
|
+
return map;
|
|
142
|
+
}
|
|
143
|
+
|
|
128
144
|
export function collectDeps(
|
|
129
145
|
pkgDir: string,
|
|
130
146
|
cwd: string,
|
|
@@ -132,10 +148,9 @@ export function collectDeps(
|
|
|
132
148
|
): DepsResult {
|
|
133
149
|
const startTime = performance.now();
|
|
134
150
|
logger.debug("의존성 수집 시작");
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
const workspaceScope = scopeMatch != null ? scopeMatch[1] : undefined;
|
|
151
|
+
|
|
152
|
+
// pnpm-workspace.yaml에서 workspace 패키지 디렉토리 패턴을 읽어 실제 패키지 맵 구성
|
|
153
|
+
const workspacePkgMap = buildWorkspacePkgMap(cwd);
|
|
139
154
|
|
|
140
155
|
const replaceDepsPatterns: Array<{ regex: RegExp }> = [];
|
|
141
156
|
if (replaceDepsConfig != null) {
|
|
@@ -162,18 +177,15 @@ export function collectDeps(
|
|
|
162
177
|
if (visited.has(dep)) continue;
|
|
163
178
|
visited.add(dep);
|
|
164
179
|
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
traverse(depDir);
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
180
|
+
// 워크스페이스 패키지 확인
|
|
181
|
+
const wsDir = workspacePkgMap.get(dep);
|
|
182
|
+
if (wsDir != null) {
|
|
183
|
+
workspaceDeps.push(path.basename(wsDir));
|
|
184
|
+
traverse(pathx.posix(path.join(cwd, wsDir)));
|
|
185
|
+
continue;
|
|
174
186
|
}
|
|
175
187
|
|
|
176
|
-
//
|
|
188
|
+
// replaceDeps 패턴 확인
|
|
177
189
|
const matched = replaceDepsPatterns.find((p) => p.regex.test(dep));
|
|
178
190
|
if (matched != null) {
|
|
179
191
|
replaceDeps.push(dep);
|
|
@@ -194,8 +206,8 @@ export function collectDeps(
|
|
|
194
206
|
}
|
|
195
207
|
|
|
196
208
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
209
|
+
* 지정된 디렉토리의 package.json에 @angular/core가
|
|
210
|
+
* dependencies 또는 peerDependencies에 있는지 확인한다.
|
|
199
211
|
*/
|
|
200
212
|
export function hasAngularCoreDependency(pkgDir: string): boolean {
|
|
201
213
|
const pkgJsonPath = pathx.posix(path.join(pkgDir, "package.json"));
|
|
@@ -215,11 +227,11 @@ export function hasAngularCoreDependency(pkgDir: string): boolean {
|
|
|
215
227
|
}
|
|
216
228
|
|
|
217
229
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* @param targets -
|
|
222
|
-
* @param packages - sdConfig.packages
|
|
230
|
+
* 모든 target 이름이 sdConfig 패키지에 존재하는지 검증한다.
|
|
231
|
+
* 알 수 없는 target이 발견되면 SdError를 던진다.
|
|
232
|
+
* targets가 비어있으면 아무 동작도 하지 않는다.
|
|
233
|
+
* @param targets - 검증할 패키지명 목록
|
|
234
|
+
* @param packages - sdConfig.packages 객체
|
|
223
235
|
*/
|
|
224
236
|
export function validateTargets(
|
|
225
237
|
targets: string[],
|
|
@@ -234,11 +246,11 @@ export function validateTargets(
|
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @param packages
|
|
239
|
-
* @param targets
|
|
240
|
-
* @returns
|
|
241
|
-
* @internal
|
|
249
|
+
* targets로 패키지 설정을 필터링한다 (scripts target 제외)
|
|
250
|
+
* @param packages 패키지 설정 맵
|
|
251
|
+
* @param targets 필터링할 패키지명 목록. 빈 배열이면 scripts를 제외한 모든 패키지 반환
|
|
252
|
+
* @returns 필터링된 패키지 설정 맵
|
|
253
|
+
* @internal 테스트용으로 export
|
|
242
254
|
*/
|
|
243
255
|
export function filterPackagesByTargets(
|
|
244
256
|
packages: Record<string, SdPackageConfig | undefined>,
|
|
@@ -250,16 +262,16 @@ export function filterPackagesByTargets(
|
|
|
250
262
|
for (const [name, config] of Object.entries(packages)) {
|
|
251
263
|
if (config == null) continue;
|
|
252
264
|
|
|
253
|
-
//
|
|
265
|
+
// watch hook이 설정되지 않은 scripts target 제외
|
|
254
266
|
if (config.target === "scripts" && config.watch == null) continue;
|
|
255
267
|
|
|
256
|
-
//
|
|
268
|
+
// targets가 비어있으면 모든 패키지 포함
|
|
257
269
|
if (targets.length === 0) {
|
|
258
270
|
result[name] = config;
|
|
259
271
|
continue;
|
|
260
272
|
}
|
|
261
273
|
|
|
262
|
-
//
|
|
274
|
+
// targets에 포함된 패키지만 필터링
|
|
263
275
|
if (targets.includes(name)) {
|
|
264
276
|
result[name] = config;
|
|
265
277
|
}
|
|
@@ -336,7 +348,7 @@ export function classifyDevPackages(
|
|
|
336
348
|
|
|
337
349
|
const entries = iteratePackages(allPackages, []);
|
|
338
350
|
|
|
339
|
-
//
|
|
351
|
+
// 1차 패스: 서버 이름 수집
|
|
340
352
|
const serverNames = new Set<string>();
|
|
341
353
|
for (const { name, config } of entries) {
|
|
342
354
|
if (config.target === "server") {
|
|
@@ -344,7 +356,7 @@ export function classifyDevPackages(
|
|
|
344
356
|
}
|
|
345
357
|
}
|
|
346
358
|
|
|
347
|
-
//
|
|
359
|
+
// 2차 패스: 모든 패키지 분류
|
|
348
360
|
for (const { name, config } of entries) {
|
|
349
361
|
const relPath = pathMap.get(name) ?? `packages/${name}`;
|
|
350
362
|
const pkgDir = pathx.posix(path.join(cwd, relPath));
|
|
@@ -361,7 +373,7 @@ export function classifyDevPackages(
|
|
|
361
373
|
config: config,
|
|
362
374
|
});
|
|
363
375
|
|
|
364
|
-
//
|
|
376
|
+
// 서버-클라이언트 매핑 구성
|
|
365
377
|
const clientConfig = config;
|
|
366
378
|
if (typeof clientConfig.server === "string") {
|
|
367
379
|
if (serverNames.has(clientConfig.server)) {
|
|
@@ -375,7 +387,7 @@ export function classifyDevPackages(
|
|
|
375
387
|
}
|
|
376
388
|
}
|
|
377
389
|
}
|
|
378
|
-
//
|
|
390
|
+
// 라이브러리 및 scripts 패키지는 dev 모드에서 제외
|
|
379
391
|
}
|
|
380
392
|
|
|
381
393
|
logger.debug(`dev 패키지 분류 완료 (server: ${serverPackages.length}, client: ${clientPackages.length})`);
|