@simplysm/sd-cli 14.1.9 → 14.1.10
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/dist/capacitor/capacitor-icon.js +2 -2
- package/dist/capacitor/capacitor-icon.js.map +1 -1
- package/dist/capacitor/capacitor-npm-config.d.ts +1 -1
- package/dist/capacitor/capacitor-npm-config.d.ts.map +1 -1
- package/dist/capacitor/capacitor-npm-config.js +11 -18
- package/dist/capacitor/capacitor-npm-config.js.map +1 -1
- package/dist/capacitor/capacitor.d.ts +1 -1
- package/dist/capacitor/capacitor.js +2 -2
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1 -0
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/device.js +2 -2
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/init/generators/root.d.ts.map +1 -1
- package/dist/commands/init/generators/root.js +0 -1
- package/dist/commands/init/generators/root.js.map +1 -1
- package/dist/commands/init/init-client.js +1 -1
- package/dist/commands/init/init-client.js.map +1 -1
- package/dist/commands/init/init.js +2 -2
- package/dist/commands/init/init.js.map +1 -1
- package/dist/commands/publish/deployment-phase.d.ts.map +1 -1
- package/dist/commands/publish/deployment-phase.js +1 -0
- package/dist/commands/publish/deployment-phase.js.map +1 -1
- package/dist/commands/publish/npm-publisher.js +3 -3
- package/dist/commands/publish/npm-publisher.js.map +1 -1
- package/dist/commands/publish/post-publish-phase.d.ts.map +1 -1
- package/dist/commands/publish/post-publish-phase.js +1 -0
- package/dist/commands/publish/post-publish-phase.js.map +1 -1
- package/dist/commands/publish/publish-command.d.ts.map +1 -1
- package/dist/commands/publish/publish-command.js +7 -12
- package/dist/commands/publish/publish-command.js.map +1 -1
- package/dist/deps/replace-deps/collect-deps.js +4 -4
- package/dist/deps/replace-deps/collect-deps.js.map +1 -1
- package/dist/deps/replace-deps/replace-deps-resolve.d.ts +4 -12
- package/dist/deps/replace-deps/replace-deps-resolve.d.ts.map +1 -1
- package/dist/deps/replace-deps/replace-deps-resolve.js +13 -49
- package/dist/deps/replace-deps/replace-deps-resolve.js.map +1 -1
- package/dist/deps/replace-deps/replace-deps.d.ts +2 -2
- package/dist/deps/replace-deps/replace-deps.js +3 -3
- package/dist/deps/server-externals/server-production-files.d.ts +3 -3
- package/dist/deps/server-externals/server-production-files.d.ts.map +1 -1
- package/dist/deps/server-externals/server-production-files.js +24 -17
- package/dist/deps/server-externals/server-production-files.js.map +1 -1
- package/dist/electron/electron.d.ts.map +1 -1
- package/dist/electron/electron.js +6 -11
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts +1 -0
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +2 -1
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/esbuild/esbuild-config.d.ts +6 -2
- package/dist/esbuild/esbuild-config.d.ts.map +1 -1
- package/dist/esbuild/esbuild-config.js +4 -3
- package/dist/esbuild/esbuild-config.js.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.d.ts.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.js +3 -1
- package/dist/esbuild/esbuild-tsc-plugin.js.map +1 -1
- package/dist/orchestrators/BaseOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BaseOrchestrator.js +1 -0
- package/dist/orchestrators/BaseOrchestrator.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +3 -5
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +1 -0
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/ServerRuntimeManager.d.ts.map +1 -1
- package/dist/orchestrators/ServerRuntimeManager.js +4 -0
- package/dist/orchestrators/ServerRuntimeManager.js.map +1 -1
- package/dist/orchestrators/TypecheckOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/TypecheckOrchestrator.js +4 -6
- package/dist/orchestrators/TypecheckOrchestrator.js.map +1 -1
- package/dist/runtime/engine-watch-events.d.ts.map +1 -1
- package/dist/runtime/engine-watch-events.js +5 -0
- package/dist/runtime/engine-watch-events.js.map +1 -1
- package/dist/runtime/worker-events.d.ts +1 -0
- package/dist/runtime/worker-events.d.ts.map +1 -1
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +0 -4
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +2 -0
- package/dist/sd-cli.js.map +1 -1
- package/dist/typecheck/typecheck-non-package.d.ts.map +1 -1
- package/dist/typecheck/typecheck-non-package.js +10 -0
- package/dist/typecheck/typecheck-non-package.js.map +1 -1
- package/dist/utils/package-utils.d.ts +8 -6
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +26 -24
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/workspace-utils.d.ts +17 -0
- package/dist/utils/workspace-utils.d.ts.map +1 -0
- package/dist/utils/workspace-utils.js +95 -0
- package/dist/utils/workspace-utils.js.map +1 -0
- package/dist/workers/client.worker.d.ts +1 -0
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +8 -3
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts +1 -0
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +3 -2
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts +1 -0
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +12 -12
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-esbuild-context.d.ts.map +1 -1
- package/dist/workers/server-esbuild-context.js +4 -2
- package/dist/workers/server-esbuild-context.js.map +1 -1
- package/dist/workers/server-runtime.worker.d.ts +1 -0
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js +9 -3
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/dist/workers/server-watch-manager.d.ts +1 -1
- package/dist/workers/server-watch-manager.d.ts.map +1 -1
- package/dist/workers/server-watch-manager.js +2 -2
- package/dist/workers/server-watch-manager.js.map +1 -1
- package/package.json +11 -11
- package/src/capacitor/capacitor-icon.ts +2 -2
- package/src/capacitor/capacitor-npm-config.ts +10 -19
- package/src/capacitor/capacitor.ts +2 -2
- package/src/commands/check.ts +1 -0
- package/src/commands/device.ts +2 -2
- package/src/commands/init/generators/root.ts +0 -1
- package/src/commands/init/init-client.ts +1 -1
- package/src/commands/init/init.ts +2 -2
- package/src/commands/init/templates/workspace-root/mise.toml.hbs +1 -1
- package/src/commands/publish/deployment-phase.ts +1 -0
- package/src/commands/publish/npm-publisher.ts +3 -3
- package/src/commands/publish/post-publish-phase.ts +1 -0
- package/src/commands/publish/publish-command.ts +7 -15
- package/src/deps/replace-deps/collect-deps.ts +4 -4
- package/src/deps/replace-deps/replace-deps-resolve.ts +13 -56
- package/src/deps/replace-deps/replace-deps.ts +3 -3
- package/src/deps/server-externals/server-production-files.ts +31 -18
- package/src/electron/electron.ts +7 -13
- package/src/engines/BaseEngine.ts +3 -2
- package/src/esbuild/esbuild-config.ts +12 -3
- package/src/esbuild/esbuild-tsc-plugin.ts +4 -1
- package/src/orchestrators/BaseOrchestrator.ts +1 -0
- package/src/orchestrators/BuildOrchestrator.ts +3 -5
- package/src/orchestrators/DevOrchestrator.ts +1 -0
- package/src/orchestrators/ServerRuntimeManager.ts +4 -0
- package/src/orchestrators/TypecheckOrchestrator.ts +4 -6
- package/src/runtime/engine-watch-events.ts +7 -1
- package/src/runtime/worker-events.ts +1 -0
- package/src/sd-cli-entry.ts +0 -9
- package/src/sd-cli.ts +2 -0
- package/src/typecheck/typecheck-non-package.ts +11 -0
- package/src/utils/package-utils.ts +30 -23
- package/src/utils/workspace-utils.ts +117 -0
- package/src/workers/client.worker.ts +9 -4
- package/src/workers/library-build.worker.ts +4 -3
- package/src/workers/server-build.worker.ts +13 -13
- package/src/workers/server-esbuild-context.ts +5 -2
- package/src/workers/server-runtime.worker.ts +10 -3
- package/src/workers/server-watch-manager.ts +3 -3
- package/tests/capacitor/capacitor-build.spec.ts +142 -142
- package/tests/capacitor/capacitor-init.spec.ts +181 -181
- package/tests/capacitor/capacitor-npm-config.acc.spec.ts +114 -114
- package/tests/capacitor/capacitor-npm-config.spec.ts +94 -94
- package/tests/commands/publish-manifest.acc.spec.ts +67 -0
- package/tests/deps/replace-deps/collect-deps.acc.spec.ts +16 -1
- package/tests/deps/replace-deps/replace-deps-resolve.acc.spec.ts +9 -5
- package/tests/deps/replace-deps/replace-deps-setup.acc.spec.ts +3 -3
- package/tests/deps/server-externals/server-production-files.spec.ts +68 -0
- package/tests/electron/electron.spec.ts +608 -608
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-browser.tsbuildinfo +1 -1
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-node.tsbuildinfo +1 -1
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck.tsbuildinfo +1 -1
- package/tests/utils/engine-watch-events.spec.ts +17 -0
- package/tests/utils/esbuild-config.spec.ts +15 -0
- package/tests/utils/package-utils.spec.ts +36 -4
- package/tests/utils/replace-deps-watch.acc.spec.ts +4 -4
- package/tests/utils/replace-deps-watch.spec.ts +3 -3
- package/tests/utils/replace-deps.spec.ts +1 -35
- package/tests/utils/workspace-utils.spec.ts +87 -0
- package/tests/workers/library-build-worker.spec.ts +1 -1
- package/tests/workers/server-esbuild-context.spec.ts +4 -3
- package/dist/commands/reinstall.d.ts +0 -13
- package/dist/commands/reinstall.d.ts.map +0 -1
- package/dist/commands/reinstall.js +0 -56
- package/dist/commands/reinstall.js.map +0 -1
- package/src/commands/init/templates/workspace-root/pnpm-workspace.yaml +0 -5
- package/src/commands/reinstall.ts +0 -63
- package/tests/angular/angular-compiler-hmr-removal.verify.md +0 -16
- package/tests/angular/onbuild-lint-removal.verify.md +0 -8
- package/tests/angular/vite-angular-plugin-sdtscompiler.verify.md +0 -13
- package/tests/angular/vite-angular-plugin-vitest.verify.md +0 -20
- package/tests/capacitor/capacitor-android-exports.verify.md +0 -11
- package/tests/commands/publish-npm-local-split.verify.md +0 -9
- package/tests/commands/publish-responsibility-split.verify.md +0 -13
- package/tests/commands/publish-set.verify.md +0 -7
- package/tests/commands/publish-storage-split.verify.md +0 -8
- package/tests/commands/slice3-severity-cleanup.verify.md +0 -12
- package/tests/deps/deps-directory-separation.verify.md +0 -15
- package/tests/deps/replace-deps/replace-deps-perf.verify.md +0 -15
- package/tests/deps/server-externals/mise-toml-parse-intent.verify.md +0 -16
- package/tests/electron/electron-symlink-cleanup.verify.md +0 -8
- package/tests/engines/engine-duplicate-output-removal.verify.md +0 -10
- package/tests/engines/engine-typecheck-selection.verify.md +0 -8
- package/tests/engines/esbuild-client-engine.verify.md +0 -15
- package/tests/engines/normalize-result.verify.md +0 -9
- package/tests/engines/vite-dependency-cleanup.verify.md +0 -24
- package/tests/esbuild/esbuild-angular-compiler-plugin-hmr.verify.md +0 -23
- package/tests/esbuild/esbuild-angular-compiler-plugin-onload.verify.md +0 -21
- package/tests/esbuild/esbuild-angular-compiler-plugin-onstart-extraction.verify.md +0 -16
- package/tests/esbuild/esbuild-angular-compiler-plugin-sdtscompiler.verify.md +0 -15
- package/tests/esbuild/esbuild-angular-compiler-plugin-stylesheet.verify.md +0 -31
- package/tests/esbuild/esbuild-angular-compiler-plugin-worker.verify.md +0 -59
- package/tests/esbuild/esbuild-angular-compiler-plugin.verify.md +0 -21
- package/tests/esbuild/esbuild-postcss-plugin-chunking.verify.md +0 -17
- package/tests/esbuild/esbuild-tsc-plugin-imports.verify.md +0 -13
- package/tests/esbuild/esbuild-worker-plugin-node.verify.md +0 -12
- package/tests/esbuild/esbuild-worker-plugin.verify.md +0 -7
- package/tests/orchestrators/dist-delete-watcher.verify.md +0 -10
- package/tests/orchestrators/orchestrator-baseenv.verify.md +0 -10
- package/tests/orchestrators/orchestrator-diagnostic-formatting.verify.md +0 -10
- package/tests/orchestrators/orchestrator-initializemode-signature.verify.md +0 -9
- package/tests/orchestrators/slice1-stdout-to-consola.verify.md +0 -10
- package/tests/sd-cli-catch-all.verify.md +0 -7
- package/tests/sd-cli-log-tag.verify.md +0 -11
- package/tests/ts-compiler/SdTsCompiler-affected-files.verify.md +0 -8
- package/tests/ts-compiler/SdTsCompiler-crash-handling.verify.md +0 -24
- package/tests/ts-compiler/SdTsCompiler-diagnostics.verify.md +0 -12
- package/tests/ts-compiler/SdTsCompiler-emit.verify.md +0 -9
- package/tests/ts-compiler/SdTsCompiler.verify.md +0 -41
- package/tests/ts-compiler/scss-lint-integration.verify.md +0 -14
- package/tests/utils/copy-public-outdir.verify.md +0 -8
- package/tests/utils/dev-http-server.verify.md +0 -8
- package/tests/utils/engine-watch-events.verify.md +0 -17
- package/tests/utils/esbuild-client-config-integration.verify.md +0 -9
- package/tests/utils/esbuild-client-config-postcss.verify.md +0 -6
- package/tests/utils/esbuild-client-config.verify.md +0 -26
- package/tests/utils/esbuild-index-html.verify.md +0 -10
- package/tests/utils/esbuild-pwa.verify.md +0 -9
- package/tests/utils/esbuild-scss-plugin.verify.md +0 -8
- package/tests/utils/hmr-service.verify.md +0 -17
- package/tests/utils/lint-core-import-paths.verify.md +0 -10
- package/tests/utils/replace-deps-split.verify.md +0 -15
- package/tests/utils/replace-deps-watch.verify.md +0 -9
- package/tests/utils/server-production-files-import-paths.verify.md +0 -14
- package/tests/utils/vite-config-cleanup.verify.md +0 -7
- package/tests/workers/build-watch-paths-library.verify.md +0 -10
- package/tests/workers/build-watch-paths-ngtsc-server.verify.md +0 -12
- package/tests/workers/client-worker-browser-support.verify.md +0 -7
- package/tests/workers/client-worker-cleanup.verify.md +0 -8
- package/tests/workers/client-worker-initial-build-error.verify.md +0 -7
- package/tests/workers/client-worker-initial-build-warnings.verify.md +0 -7
- package/tests/workers/client-worker-mtime-incremental.verify.md +0 -10
- package/tests/workers/client-worker-onend-sync.verify.md +0 -7
- package/tests/workers/client-worker-refactor.verify.md +0 -22
- package/tests/workers/client-worker-ts-cache-invalidation.verify.md +0 -12
- package/tests/workers/dev-port-file.verify.md +0 -6
- package/tests/workers/ngtsc-build-rootnames-refresh.verify.md +0 -8
- package/tests/workers/server-build-context-dispose.verify.md +0 -8
- package/tests/workers/server-build-worker-plugin.verify.md +0 -9
- package/tests/workers/server-build-worker-refactoring.verify.md +0 -14
- package/tests/workers/server-esbuild-context-integration.verify.md +0 -10
- package/tests/workers/server-esbuild-context-tsc.verify.md +0 -7
|
@@ -3,6 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { glob } from "glob";
|
|
4
4
|
import type { ConsolaInstance } from "consola";
|
|
5
5
|
import { fsx, pathx } from "@simplysm/core-node";
|
|
6
|
+
import { collectWorkspacePackages } from "../../utils/workspace-utils";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* replaceDeps 설정의 glob 패턴을 대상 패키지 목록과 매칭하여
|
|
@@ -44,45 +45,6 @@ export function resolveReplaceDepEntries(
|
|
|
44
45
|
return results;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
/**
|
|
48
|
-
* pnpm-workspace.yaml 내용을 파싱하여 워크스페이스 패키지 glob 배열을 반환한다.
|
|
49
|
-
* 별도 YAML 라이브러리 없이 간단한 줄 파싱으로 처리한다.
|
|
50
|
-
*
|
|
51
|
-
* @param content - pnpm-workspace.yaml 파일 내용
|
|
52
|
-
* @returns glob 패턴 배열 (예: ["packages/*", "tools/*"])
|
|
53
|
-
*/
|
|
54
|
-
export function parseWorkspaceGlobs(content: string): string[] {
|
|
55
|
-
const lines = content.split("\n");
|
|
56
|
-
const globs: string[] = [];
|
|
57
|
-
let inPackages = false;
|
|
58
|
-
|
|
59
|
-
for (const line of lines) {
|
|
60
|
-
const trimmed = line.trim();
|
|
61
|
-
|
|
62
|
-
if (trimmed === "packages:") {
|
|
63
|
-
inPackages = true;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// packages 섹션의 목록 항목
|
|
68
|
-
if (inPackages && trimmed.startsWith("- ")) {
|
|
69
|
-
const value = trimmed
|
|
70
|
-
.slice(2)
|
|
71
|
-
.trim()
|
|
72
|
-
.replace(/^["']|["']$/g, "");
|
|
73
|
-
globs.push(value);
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 다른 섹션이 시작되면 종료
|
|
78
|
-
if (inPackages && trimmed !== "" && !trimmed.startsWith("#")) {
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return globs;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
48
|
/**
|
|
87
49
|
* replaceDeps 복사/교체 항목
|
|
88
50
|
*/
|
|
@@ -97,26 +59,21 @@ export interface ReplaceDepEntry {
|
|
|
97
59
|
/**
|
|
98
60
|
* 프로젝트 루트 및 워크스페이스 패키지 경로를 수집한다.
|
|
99
61
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
62
|
+
* package.json#workspaces를 기준으로 워크스페이스 패키지의 절대 경로를 수집한다.
|
|
63
|
+
* 설정이 없거나 파싱 실패 시 루트 경로만 반환한다.
|
|
102
64
|
*
|
|
103
65
|
* @param projectRoot - 프로젝트 루트 경로
|
|
104
66
|
* @returns [루트, ...워크스페이스 패키지 경로] 배열
|
|
105
67
|
*/
|
|
106
|
-
export
|
|
107
|
-
const
|
|
68
|
+
export function collectSearchRoots(projectRoot: string): string[] {
|
|
69
|
+
const root = pathx.posix(projectRoot);
|
|
70
|
+
const searchRoots: string[] = [root];
|
|
108
71
|
|
|
109
|
-
const workspaceYamlPath = pathx.posix(path.join(projectRoot, "pnpm-workspace.yaml"));
|
|
110
72
|
try {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
for (const pattern of workspaceGlobs) {
|
|
115
|
-
const dirs = await fsx.glob(pattern, { cwd: projectRoot });
|
|
116
|
-
searchRoots.push(...dirs);
|
|
117
|
-
}
|
|
73
|
+
const workspacePackages = collectWorkspacePackages(root);
|
|
74
|
+
searchRoots.push(...workspacePackages.map((item) => item.absPath));
|
|
118
75
|
} catch {
|
|
119
|
-
//
|
|
76
|
+
// workspace 설정이 없거나 파싱할 수 없으면 루트만 처리
|
|
120
77
|
}
|
|
121
78
|
|
|
122
79
|
return searchRoots;
|
|
@@ -125,7 +82,7 @@ export async function collectSearchRoots(projectRoot: string): Promise<string[]>
|
|
|
125
82
|
/**
|
|
126
83
|
* replaceDeps 설정에서 모든 교체 대상 항목을 해결한다.
|
|
127
84
|
*
|
|
128
|
-
* 1.
|
|
85
|
+
* 1. package.json#workspaces 파싱 → 워크스페이스 패키지 경로
|
|
129
86
|
* 2. [루트, ...워크스페이스 패키지] node_modules에서 매칭 패키지 탐색
|
|
130
87
|
* 3. 패턴 매칭 + 소스 경로 존재 확인 + symlink 해결
|
|
131
88
|
*
|
|
@@ -144,7 +101,7 @@ export async function resolveAllReplaceDepEntries(
|
|
|
144
101
|
const searchedDirs = new Set<string>();
|
|
145
102
|
|
|
146
103
|
// 초기 탐색 대상: 프로젝트 루트 + workspace 패키지들의 node_modules
|
|
147
|
-
const searchRoots =
|
|
104
|
+
const searchRoots = collectSearchRoots(projectRoot);
|
|
148
105
|
const pendingDirs: string[] = searchRoots.map((root) =>
|
|
149
106
|
pathx.posix(path.join(root, "node_modules")),
|
|
150
107
|
);
|
|
@@ -188,7 +145,7 @@ export async function resolveAllReplaceDepEntries(
|
|
|
188
145
|
continue;
|
|
189
146
|
}
|
|
190
147
|
|
|
191
|
-
// targetPath가 symlink이면 실제
|
|
148
|
+
// targetPath가 symlink이면 실제 패키지 저장소 경로로 해결
|
|
192
149
|
let actualTargetPath = targetPath;
|
|
193
150
|
try {
|
|
194
151
|
const stat = await fs.promises.lstat(targetPath);
|
|
@@ -199,7 +156,7 @@ export async function resolveAllReplaceDepEntries(
|
|
|
199
156
|
// targetPath가 존재하지 않으면 그대로 사용
|
|
200
157
|
}
|
|
201
158
|
|
|
202
|
-
// 동일 actualTargetPath가 이미 등록된 경우 건너뜀
|
|
159
|
+
// 동일 actualTargetPath가 이미 등록된 경우 건너뜀
|
|
203
160
|
if (seenTargetPaths.has(actualTargetPath)) continue;
|
|
204
161
|
seenTargetPaths.add(actualTargetPath);
|
|
205
162
|
|
|
@@ -32,7 +32,7 @@ async function isFileContentSame(pathA: string, pathB: string): Promise<boolean>
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* package manager hard link를 끊으면서 파일/디렉토리를 복사한다.
|
|
36
36
|
* 대상 파일을 먼저 unlink하여 글로벌 store의 hard link를 끊고 새 파일을 생성한다.
|
|
37
37
|
* 다른 프로젝트의 node_modules에 영향을 주지 않기 위함이다.
|
|
38
38
|
*/
|
|
@@ -160,7 +160,7 @@ export interface WatchReplaceDepResult {
|
|
|
160
160
|
/**
|
|
161
161
|
* replaceDeps 설정에 따라 node_modules의 패키지를 소스 디렉토리로 교체한다.
|
|
162
162
|
*
|
|
163
|
-
* 1.
|
|
163
|
+
* 1. package.json#workspaces 파싱 → 워크스페이스 패키지 경로
|
|
164
164
|
* 2. [루트, ...워크스페이스 패키지] node_modules에서 매칭 패키지 탐색
|
|
165
165
|
* 3. 소스 package.json의 files 필드 + npm 기본 파일만 대상 경로에 복사 (package.json 제외)
|
|
166
166
|
*
|
|
@@ -207,7 +207,7 @@ export async function setupReplaceDeps(
|
|
|
207
207
|
/**
|
|
208
208
|
* replaceDeps 설정에 따라 소스 디렉토리를 감시하고 변경사항을 대상 경로에 복사한다.
|
|
209
209
|
*
|
|
210
|
-
* 1.
|
|
210
|
+
* 1. package.json#workspaces 파싱 → 워크스페이스 패키지 경로
|
|
211
211
|
* 2. [루트, ...워크스페이스 패키지] node_modules에서 매칭 패키지 탐색
|
|
212
212
|
* 3. FsWatcher로 files 항목 경로만 감시 (300ms 딜레이)
|
|
213
213
|
* 4. 변경사항을 대상 경로에 복사
|
|
@@ -29,30 +29,43 @@ export function collectAllExternals(
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
interface BunLockFile {
|
|
33
|
+
packages?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parsePackageReferenceVersion(reference: string): string | undefined {
|
|
37
|
+
const normalized = reference.split("(")[0];
|
|
38
|
+
const match = /^(.+?)@(\d[^@]*)$/.exec(normalized);
|
|
39
|
+
return match?.[2];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function parsePackageKeyName(key: string): string {
|
|
43
|
+
const match = /^(.+?)@(\d.+)$/.exec(key);
|
|
44
|
+
return match?.[1] ?? key;
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
/**
|
|
33
|
-
*
|
|
34
|
-
* 키
|
|
48
|
+
* bun.lock의 packages 섹션을 파싱하여 name→version 맵을 생성한다.
|
|
49
|
+
* 키 형태는 일반 패키지명 또는 alias이고, 실제 버전은 package entry의 resolution에서 확인한다.
|
|
35
50
|
*/
|
|
36
51
|
export function parseLockfileVersions(cwd: string): Map<string, string> {
|
|
37
|
-
const lockfilePath = path.join(cwd, "
|
|
52
|
+
const lockfilePath = path.join(cwd, "bun.lock");
|
|
38
53
|
if (!fsx.existsSync(lockfilePath)) {
|
|
39
|
-
throw new Error(`
|
|
54
|
+
throw new Error(`bun.lock not found in ${cwd}. Run "bun install" first.`);
|
|
40
55
|
}
|
|
41
56
|
|
|
42
57
|
const content = fsx.readSync(lockfilePath);
|
|
43
|
-
const parsed = YAML.parse(content) as
|
|
58
|
+
const parsed = YAML.parse(content) as BunLockFile;
|
|
44
59
|
const map = new Map<string, string>();
|
|
45
60
|
|
|
46
|
-
for (const key of Object.
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!map.has(name)) {
|
|
55
|
-
map.set(name, version);
|
|
61
|
+
for (const [key, entry] of Object.entries(parsed.packages ?? {})) {
|
|
62
|
+
if (!Array.isArray(entry) || typeof entry[0] !== "string") continue;
|
|
63
|
+
const version = parsePackageReferenceVersion(entry[0]);
|
|
64
|
+
if (version == null) continue;
|
|
65
|
+
|
|
66
|
+
const keyName = parsePackageKeyName(key);
|
|
67
|
+
if (!map.has(keyName)) {
|
|
68
|
+
map.set(keyName, version);
|
|
56
69
|
}
|
|
57
70
|
}
|
|
58
71
|
|
|
@@ -60,7 +73,7 @@ export function parseLockfileVersions(cwd: string): Map<string, string> {
|
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
|
-
*
|
|
76
|
+
* bun.lock에서 주어진 모든 패키지의 잠긴 버전을 확인한다.
|
|
64
77
|
* lockfile에서 패키지를 찾을 수 없으면 에러를 던진다.
|
|
65
78
|
*/
|
|
66
79
|
export function resolveLockedVersions(cwd: string, pkgNames: string[]): Record<string, string> {
|
|
@@ -70,8 +83,8 @@ export function resolveLockedVersions(cwd: string, pkgNames: string[]): Record<s
|
|
|
70
83
|
const version = versionMap.get(name);
|
|
71
84
|
if (version == null) {
|
|
72
85
|
throw new Error(
|
|
73
|
-
`External dependency "${name}" not found in
|
|
74
|
-
`Run "
|
|
86
|
+
`External dependency "${name}" not found in bun.lock. ` +
|
|
87
|
+
`Run "bun install" and try again.`,
|
|
75
88
|
);
|
|
76
89
|
}
|
|
77
90
|
result[name] = version;
|
package/src/electron/electron.ts
CHANGED
|
@@ -68,20 +68,14 @@ export class Electron {
|
|
|
68
68
|
await this._setupNpmConf();
|
|
69
69
|
Electron._logger.debug("package.json 설정 완료");
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
await fsx.write(workspaceYamlPath, "");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
Electron._logger.debug("pnpm install 시작");
|
|
78
|
-
await this._exec("pnpm", ["install", "--config.dangerously-allow-all-builds=true"], this._srcPath);
|
|
79
|
-
Electron._logger.debug("pnpm install 완료");
|
|
71
|
+
Electron._logger.debug("bun install 시작");
|
|
72
|
+
await this._exec("bun", ["install"], this._srcPath);
|
|
73
|
+
Electron._logger.debug("bun install 완료");
|
|
80
74
|
|
|
81
75
|
const reinstallDeps = this._config.reinstallDependencies ?? [];
|
|
82
76
|
if (reinstallDeps.length > 0) {
|
|
83
77
|
Electron._logger.debug(`electron-rebuild 시작 (${reinstallDeps.join(", ")})`);
|
|
84
|
-
await this._exec("
|
|
78
|
+
await this._exec("bun", ["run", "electron-rebuild"], this._srcPath);
|
|
85
79
|
Electron._logger.debug("electron-rebuild 완료");
|
|
86
80
|
}
|
|
87
81
|
Electron._logger.success("initialize 완료");
|
|
@@ -102,7 +96,7 @@ export class Electron {
|
|
|
102
96
|
|
|
103
97
|
const spawnElectron = () => {
|
|
104
98
|
Electron._logger.debug("Electron 프로세스 시작");
|
|
105
|
-
currentElectron = shellSpawn("
|
|
99
|
+
currentElectron = shellSpawn("bun", ["run", "electron", "."], {
|
|
106
100
|
cwd: this._srcPath,
|
|
107
101
|
stdio: "inherit",
|
|
108
102
|
reject: false,
|
|
@@ -385,8 +379,8 @@ export class Electron {
|
|
|
385
379
|
|
|
386
380
|
Electron._logger.debug(`electron-builder 설정: ${configFilePath}`);
|
|
387
381
|
await this._exec(
|
|
388
|
-
"
|
|
389
|
-
["
|
|
382
|
+
"bun",
|
|
383
|
+
["run", "electron-builder", "--win", "--config", configFilePath],
|
|
390
384
|
this._srcPath,
|
|
391
385
|
);
|
|
392
386
|
}
|
|
@@ -21,7 +21,7 @@ export interface CommonBuildWorkerEvents extends Record<string, unknown> {
|
|
|
21
21
|
build: { success: boolean; errors?: string[]; warnings?: string[] };
|
|
22
22
|
lint?: LintWithProgramResult;
|
|
23
23
|
};
|
|
24
|
-
error: { message: string };
|
|
24
|
+
error: { message: string; stack?: string };
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -180,7 +180,8 @@ export abstract class BaseEngine<
|
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
this._callStartWatch(output).catch((err: unknown) => {
|
|
183
|
-
logger.debug(`[${this._pkg.name}] startWatch
|
|
183
|
+
logger.debug(`[${this._pkg.name}] startWatch 실패: ${errNs.message(err)}`);
|
|
184
|
+
logger.debug(`[${this._pkg.name}] startWatch 실패 스택:\n${errNs.stack(err)}`);
|
|
184
185
|
this._resultCollector?.add({
|
|
185
186
|
name: this._pkg.name,
|
|
186
187
|
target: this._getTarget(),
|
|
@@ -7,18 +7,27 @@ import { addJsExtensionToImports } from "../utils/output-path-rewriter";
|
|
|
7
7
|
|
|
8
8
|
const logger = createLogger("sd:cli:esbuild-config");
|
|
9
9
|
|
|
10
|
+
export interface WriteChangedOutputFilesOptions {
|
|
11
|
+
/** .js 파일의 확장자 없는 상대 import/export 경로에 .js를 붙일지 여부 */
|
|
12
|
+
rewriteJsExtensions?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
/**
|
|
11
16
|
* esbuild outputFiles에서 변경된 파일만 디스크에 쓴다.
|
|
12
17
|
*
|
|
13
|
-
* - .js 파일: 비교 전 ESM 상대 import 경로에 .js 확장자를 추가한다
|
|
18
|
+
* - .js 파일: 기본적으로 비교 전 ESM 상대 import 경로에 .js 확장자를 추가한다
|
|
14
19
|
* - 기타 파일(.js.map 등): 원본 내용을 그대로 비교한다
|
|
15
20
|
* - 기존 파일과 내용이 동일하면 타임스탬프 보존을 위해 쓰기를 스킵한다
|
|
16
21
|
*/
|
|
17
|
-
export async function writeChangedOutputFiles(
|
|
22
|
+
export async function writeChangedOutputFiles(
|
|
23
|
+
outputFiles: esbuild.OutputFile[],
|
|
24
|
+
options?: WriteChangedOutputFilesOptions,
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
const rewriteJsExtensions = options?.rewriteJsExtensions ?? true;
|
|
18
27
|
logger.debug(`변경된 출력 파일 쓰기 시작 (${outputFiles.length}개)`);
|
|
19
28
|
await Promise.all(
|
|
20
29
|
outputFiles.map(async (file) => {
|
|
21
|
-
const finalText = file.path.endsWith(".js")
|
|
30
|
+
const finalText = file.path.endsWith(".js") && rewriteJsExtensions
|
|
22
31
|
? addJsExtensionToImports(file.text)
|
|
23
32
|
: file.text;
|
|
24
33
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type esbuild from "esbuild";
|
|
2
2
|
import type ts from "typescript";
|
|
3
|
-
import { err as errNs } from "@simplysm/core-common";
|
|
3
|
+
import { createLogger, err as errNs } from "@simplysm/core-common";
|
|
4
4
|
import { SdTsCompiler } from "../ts-compiler/SdTsCompiler";
|
|
5
5
|
import type { ISdTsCompilerResult } from "../ts-compiler/sd-ts-compiler-result";
|
|
6
6
|
import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization";
|
|
7
7
|
import type { LintWithProgramResult } from "../lint/lint-with-program";
|
|
8
8
|
import type { TypecheckEnv } from "../utils/tsconfig";
|
|
9
9
|
|
|
10
|
+
const logger = createLogger("sd:cli:esbuild-tsc-plugin");
|
|
11
|
+
|
|
10
12
|
export interface TscPluginOptions {
|
|
11
13
|
pkgDir: string;
|
|
12
14
|
cwd: string;
|
|
@@ -69,6 +71,7 @@ export function createTscPlugin(options: TscPluginOptions): TscPluginResult {
|
|
|
69
71
|
lastErrors = result.errors;
|
|
70
72
|
lastLintResult = result.lint;
|
|
71
73
|
} catch (err) {
|
|
74
|
+
logger.debug(`tsc plugin 예외 스택:\n${errNs.stack(err)}`);
|
|
72
75
|
lastProgram = undefined;
|
|
73
76
|
lastAffectedFiles = undefined;
|
|
74
77
|
lastDiagnostics = [];
|
|
@@ -57,6 +57,7 @@ export abstract class BaseOrchestrator {
|
|
|
57
57
|
this._logger.debug("sd.config.ts 로드 완료");
|
|
58
58
|
} catch (err) {
|
|
59
59
|
this._logger.error(`sd.config.ts 로드 실패: ${errNs.message(err)}`);
|
|
60
|
+
this._logger.debug(`sd.config.ts 로드 실패 스택:\n${errNs.stack(err)}`);
|
|
60
61
|
process.exitCode = 1;
|
|
61
62
|
throw err;
|
|
62
63
|
}
|
|
@@ -152,6 +152,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
152
152
|
this._logger.debug("sd.config.ts 로드 완료");
|
|
153
153
|
} catch (err) {
|
|
154
154
|
this._logger.error(`sd.config.ts 로드 실패: ${errNs.message(err)}`);
|
|
155
|
+
this._logger.debug(`sd.config.ts 로드 실패 스택:\n${errNs.stack(err)}`);
|
|
155
156
|
process.exitCode = 1;
|
|
156
157
|
throw err;
|
|
157
158
|
}
|
|
@@ -238,13 +239,10 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
238
239
|
for (const settledResult of buildResults) {
|
|
239
240
|
if (settledResult.status === "rejected") {
|
|
240
241
|
const err = settledResult.reason;
|
|
241
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
242
242
|
this._logger.error("빌드 중 예기치 않은 에러", {
|
|
243
|
-
error:
|
|
243
|
+
error: errNs.message(err),
|
|
244
244
|
});
|
|
245
|
-
|
|
246
|
-
this._logger.debug(`빌드 예외 스택:\n${stack}`);
|
|
247
|
-
}
|
|
245
|
+
this._logger.debug(`빌드 예외 스택:\n${errNs.stack(err)}`);
|
|
248
246
|
hasUntrackedError.value = true;
|
|
249
247
|
}
|
|
250
248
|
}
|
|
@@ -246,6 +246,7 @@ export class DevOrchestrator extends BaseOrchestrator implements OrchestratorLif
|
|
|
246
246
|
onServerReady: () => this._schedulePrintServers(),
|
|
247
247
|
}).catch((err: unknown) => {
|
|
248
248
|
this._logger.error(`[${name}] 서버 런타임 시작 실패:`, errNs.message(err));
|
|
249
|
+
this._logger.debug(`[${name}] 서버 런타임 시작 실패 스택:\n${errNs.stack(err)}`);
|
|
249
250
|
this._resultCollector.add({
|
|
250
251
|
name,
|
|
251
252
|
target: "server",
|
|
@@ -52,6 +52,9 @@ export class ServerRuntimeManager {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
runtimeWorker.on("error", (errorData) => {
|
|
55
|
+
if (errorData.stack != null) {
|
|
56
|
+
this._logger.debug(`[${params.serverName}] 서버 런타임 에러 스택:\n${errorData.stack}`);
|
|
57
|
+
}
|
|
55
58
|
params.resultCollector.add({
|
|
56
59
|
name: params.serverName,
|
|
57
60
|
target: "server",
|
|
@@ -65,6 +68,7 @@ export class ServerRuntimeManager {
|
|
|
65
68
|
.start({ mainJsPath: params.mainJsPath, clientPorts: params.clientPorts, env: params.env })
|
|
66
69
|
.catch((err: unknown) => {
|
|
67
70
|
this._logger.error(`[${params.serverName}] 서버 런타임 워커 비정상 종료:`, errNs.message(err));
|
|
71
|
+
this._logger.debug(`[${params.serverName}] 서버 런타임 워커 비정상 종료 스택:\n${errNs.stack(err)}`);
|
|
68
72
|
params.resultCollector.add({
|
|
69
73
|
name: params.serverName,
|
|
70
74
|
target: "server",
|
|
@@ -51,12 +51,13 @@ export interface TypecheckResult {
|
|
|
51
51
|
|
|
52
52
|
//#region Utilities
|
|
53
53
|
|
|
54
|
-
const TARGET_PATH_PATTERN = /^(
|
|
54
|
+
const TARGET_PATH_PATTERN = /^[^/]+\/([^/]+)/;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* 대상 경로에서 패키지명을 추출한다.
|
|
57
|
+
* 대상 경로에서 패키지명을 추출한다. 워크스페이스 종류(packages/·tests/·plugins/ 등)를 가리지 않는다.
|
|
58
58
|
* "packages/core-common" → "core-common"
|
|
59
59
|
* "tests/orm" → "orm"
|
|
60
|
+
* "plugins/sd" → "sd"
|
|
60
61
|
*/
|
|
61
62
|
function extractTargetPackageNames(targets: string[]): Set<string> {
|
|
62
63
|
const names = new Set<string>();
|
|
@@ -229,11 +230,8 @@ export class TypecheckOrchestrator implements OrchestratorLifecycle<TypecheckRes
|
|
|
229
230
|
return result;
|
|
230
231
|
} catch (err) {
|
|
231
232
|
const message = errNs.message(err);
|
|
232
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
233
233
|
this._logger.error(`[${label}] 엔진 작업 실패: ${message}`);
|
|
234
|
-
|
|
235
|
-
this._logger.debug(`[${label}] 스택 트레이스:\n${stack}`);
|
|
236
|
-
}
|
|
234
|
+
this._logger.debug(`[${label}] 스택 트레이스:\n${errNs.stack(err)}`);
|
|
237
235
|
return {
|
|
238
236
|
build: {
|
|
239
237
|
success: false,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { createLogger } from "@simplysm/core-common";
|
|
1
2
|
import type { BuildResult, ResultCollector } from "../runtime/ResultCollector";
|
|
2
3
|
import type { RebuildManager } from "./rebuild-manager";
|
|
3
4
|
|
|
5
|
+
const logger = createLogger("sd:cli:watch-events");
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* worker.on()으로 이벤트를 구독할 수 있는 최소 인터페이스
|
|
6
9
|
*/
|
|
@@ -84,7 +87,10 @@ export function setupWatchEvents(
|
|
|
84
87
|
});
|
|
85
88
|
|
|
86
89
|
worker.on("error", (data: unknown) => {
|
|
87
|
-
const event = data as { message: string };
|
|
90
|
+
const event = data as { message: string; stack?: string };
|
|
91
|
+
if (event.stack != null) {
|
|
92
|
+
logger.debug(`[${name}] 워커 에러 스택:\n${event.stack}`);
|
|
93
|
+
}
|
|
88
94
|
|
|
89
95
|
const buildResult: BuildResult = {
|
|
90
96
|
name,
|
package/src/sd-cli-entry.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { runInit } from "./commands/init/init";
|
|
|
12
12
|
import { runInitClient } from "./commands/init/init-client";
|
|
13
13
|
import { runPublish } from "./commands/publish/publish-command";
|
|
14
14
|
import { runReplaceDeps } from "./commands/replace-deps";
|
|
15
|
-
import { runReinstall } from "./commands/reinstall";
|
|
16
15
|
import path from "path";
|
|
17
16
|
import fs from "fs";
|
|
18
17
|
import { fileURLToPath } from "url";
|
|
@@ -286,14 +285,6 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
286
285
|
});
|
|
287
286
|
},
|
|
288
287
|
)
|
|
289
|
-
.command(
|
|
290
|
-
"reinstall",
|
|
291
|
-
"Clean reinstall: delete node_modules/lock/dist/.cache then reinstall with build approval",
|
|
292
|
-
(cmd) => cmd.version(false).hide("help"),
|
|
293
|
-
async () => {
|
|
294
|
-
await runReinstall();
|
|
295
|
-
},
|
|
296
|
-
)
|
|
297
288
|
.command(
|
|
298
289
|
"init [kind]",
|
|
299
290
|
"Bootstrap a new SI workspace via interactive prompts (kind=client: add a client package to an existing workspace)",
|
package/src/sd-cli.ts
CHANGED
|
@@ -44,6 +44,7 @@ if (isDev) {
|
|
|
44
44
|
const code = err instanceof Error && "code" in err ? (err as NodeJS.ErrnoException).code : undefined;
|
|
45
45
|
if (code !== "MODULE_NOT_FOUND" && code !== "ERR_MODULE_NOT_FOUND") {
|
|
46
46
|
logger.warn("replaceDeps 사전 설정 실패:", errNs.message(err));
|
|
47
|
+
logger.debug(`replaceDeps 사전 설정 실패 스택:\n${errNs.stack(err)}`);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -109,5 +110,6 @@ function configureAffinityAndPriority(pid: number): void {
|
|
|
109
110
|
"CPU affinity/priority 설정 실패:",
|
|
110
111
|
errNs.message(err),
|
|
111
112
|
);
|
|
113
|
+
logger.debug(`CPU affinity/priority 설정 실패 스택:\n${errNs.stack(err)}`);
|
|
112
114
|
});
|
|
113
115
|
}
|
|
@@ -3,6 +3,7 @@ import ts from "typescript";
|
|
|
3
3
|
import { pathx } from "@simplysm/core-node";
|
|
4
4
|
import { createLogger } from "@simplysm/core-common";
|
|
5
5
|
import { parseTsconfig } from "../utils/tsconfig";
|
|
6
|
+
import { collectWorkspacePackages } from "../utils/workspace-utils";
|
|
6
7
|
import { serializeDiagnostic, type SerializedDiagnostic } from "./typecheck-serialization";
|
|
7
8
|
|
|
8
9
|
const logger = createLogger("sd:cli:typecheck-non-pkg");
|
|
@@ -27,10 +28,20 @@ export function typecheckNonPackageFiles(cwd: string): NonPackageTypecheckResult
|
|
|
27
28
|
const parsedConfig = parseTsconfig(cwd);
|
|
28
29
|
const packagesDir = path.join(cwd, "packages");
|
|
29
30
|
|
|
31
|
+
// packages/(배포 대상)가 아닌 워크스페이스(tests/·plugins/·향후 추가분)는 각자 엔진 타입체크가
|
|
32
|
+
// 자기 tsconfig로 담당하므로 루트 sweep에서 제외한다. 루트 tsconfig로 검사하면 그 워크스페이스
|
|
33
|
+
// 고유 옵션(allowImportingTsExtensions 등)이 무시돼 거짓 에러가 난다. 디렉터리명에 의존하지 않는다.
|
|
34
|
+
const nonDeployWorkspaceDirs = collectWorkspacePackages(cwd)
|
|
35
|
+
.filter((ws) => !ws.relPath.startsWith("packages/"))
|
|
36
|
+
.map((ws) => pathx.posixResolve(ws.absPath) + "/");
|
|
37
|
+
|
|
30
38
|
const isNonPackageFile = (fileName: string): boolean => {
|
|
31
39
|
const normalized = pathx.posixResolve(fileName);
|
|
32
40
|
const normalizedPkgDir = pathx.posixResolve(packagesDir);
|
|
33
41
|
|
|
42
|
+
// packages/ 가 아닌 워크스페이스 파일 → 엔진이 자기 tsconfig로 담당, sweep 제외
|
|
43
|
+
if (nonDeployWorkspaceDirs.some((dir) => normalized.startsWith(dir))) return false;
|
|
44
|
+
|
|
34
45
|
// packages/ 디렉토리 외부 파일
|
|
35
46
|
if (!normalized.startsWith(normalizedPkgDir + "/")) return true;
|
|
36
47
|
|
|
@@ -3,6 +3,7 @@ import fs from "fs";
|
|
|
3
3
|
import { SdError } from "@simplysm/core-common";
|
|
4
4
|
import { fsx, pathx } from "@simplysm/core-node";
|
|
5
5
|
import { createLogger } from "@simplysm/core-common";
|
|
6
|
+
import { collectWorkspacePackages } from "./workspace-utils";
|
|
6
7
|
import type {
|
|
7
8
|
SdPackageConfig,
|
|
8
9
|
} from "../sd-config.types";
|
|
@@ -19,26 +20,31 @@ export function findPackageRoot(startDir: string): string {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
* 디렉토리명 → 상대 경로의 맵을 반환한다 (예: "orm" → "tests/orm").
|
|
23
|
+
* package.json#workspaces의 모든 워크스페이스 패키지를 탐색한다.
|
|
24
|
+
* 디렉토리명 → 상대 경로의 맵을 반환한다 (예: "orm" → "tests/orm", "sd" → "plugins/sd").
|
|
25
|
+
* packages/·tests/·plugins/ 등 종류를 가리지 않고 포함하며, 배포/검사 대상 구분은 소비자가 relPath로 판단한다.
|
|
24
26
|
*/
|
|
25
27
|
export function discoverWorkspacePackages(cwd: string): Map<string, string> {
|
|
26
28
|
logger.debug("워크스페이스 패키지 탐색 시작");
|
|
27
29
|
const map = new Map<string, string>();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
|
|
31
|
+
const workspacePackages = (() => {
|
|
32
|
+
try {
|
|
33
|
+
return collectWorkspacePackages(cwd);
|
|
34
|
+
} catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
})();
|
|
38
|
+
|
|
39
|
+
for (const item of workspacePackages) {
|
|
40
|
+
if (map.has(item.dirName)) {
|
|
41
|
+
throw new SdError(
|
|
42
|
+
`Duplicate workspace package name: ${item.dirName} (${map.get(item.dirName)} and ${item.relPath})`,
|
|
43
|
+
);
|
|
40
44
|
}
|
|
45
|
+
map.set(item.dirName, item.relPath);
|
|
41
46
|
}
|
|
47
|
+
|
|
42
48
|
logger.debug(`워크스페이스 패키지 탐색 완료 (${map.size}개)`);
|
|
43
49
|
return map;
|
|
44
50
|
}
|
|
@@ -57,27 +63,28 @@ export function buildPathMapFromConfig(
|
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
|
-
* workspace에서 발견된 tests/
|
|
61
|
-
*
|
|
62
|
-
* 모든 패키지의 pathMap(name → 상대 경로)도 함께 구성한다.
|
|
63
|
-
*
|
|
66
|
+
* workspace에서 발견된 비배포 워크스페이스(packages/ 가 아닌 tests/·plugins/ 등)를 sd.config.ts
|
|
67
|
+
* 패키지에 병합한다. 이들은 빌드 대상이 아니지만 각자 자기 tsconfig로 타입체크하기 위해
|
|
68
|
+
* `{ target: "node" }`가 할당된다. 모든 패키지의 pathMap(name → 상대 경로)도 함께 구성한다.
|
|
69
|
+
* 디렉터리명이 sd.config.ts 패키지명과 충돌하면 SdError를 던진다.
|
|
70
|
+
* 특정 디렉터리명이 아니라 "packages/ 인가"로만 갈라 새 워크스페이스 종류도 자동 포함된다.
|
|
64
71
|
*/
|
|
65
72
|
export function mergeTestsPackagesIntoConfig(
|
|
66
73
|
configPackages: Record<string, SdPackageConfig | undefined>,
|
|
67
74
|
workspacePackages: Map<string, string>,
|
|
68
75
|
): { merged: Record<string, SdPackageConfig | undefined>; pathMap: Map<string, string> } {
|
|
69
|
-
logger.debug("
|
|
76
|
+
logger.debug("비배포 워크스페이스 병합 시작");
|
|
70
77
|
const pathMap = new Map<string, string>();
|
|
71
78
|
const merged: Record<string, SdPackageConfig | undefined> = { ...configPackages };
|
|
72
79
|
|
|
73
|
-
// config
|
|
80
|
+
// config 패키지(배포 대상)의 기본 경로 설정
|
|
74
81
|
for (const name of Object.keys(configPackages)) {
|
|
75
82
|
pathMap.set(name, `packages/${name}`);
|
|
76
83
|
}
|
|
77
84
|
|
|
78
|
-
//
|
|
85
|
+
// packages/(배포 대상)가 아닌 워크스페이스 추가
|
|
79
86
|
for (const [name, relPath] of workspacePackages) {
|
|
80
|
-
if (
|
|
87
|
+
if (relPath.startsWith("packages/")) continue;
|
|
81
88
|
|
|
82
89
|
if (name in configPackages) {
|
|
83
90
|
throw new SdError(
|
|
@@ -89,7 +96,7 @@ export function mergeTestsPackagesIntoConfig(
|
|
|
89
96
|
pathMap.set(name, relPath);
|
|
90
97
|
}
|
|
91
98
|
|
|
92
|
-
logger.debug(
|
|
99
|
+
logger.debug(`비배포 워크스페이스 병합 완료 (총 ${Object.keys(merged).length}개)`);
|
|
93
100
|
return { merged, pathMap };
|
|
94
101
|
}
|
|
95
102
|
|