@mandujs/core 0.9.30 → 0.9.31
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/package.json +1 -1
- package/src/bundler/dev.ts +26 -20
package/package.json
CHANGED
package/src/bundler/dev.ts
CHANGED
|
@@ -18,12 +18,12 @@ export interface DevBundlerOptions {
|
|
|
18
18
|
onRebuild?: (result: RebuildResult) => void;
|
|
19
19
|
/** 에러 콜백 */
|
|
20
20
|
onError?: (error: Error, routeId?: string) => void;
|
|
21
|
-
/**
|
|
22
|
-
* 추가 watch 디렉토리 (공통 컴포넌트 등)
|
|
23
|
-
* 상대 경로 또는 절대 경로 모두 지원
|
|
24
|
-
* 기본값: ["src/components", "components", "src/shared", "shared", "lib"]
|
|
25
|
-
*/
|
|
26
|
-
watchDirs?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* 추가 watch 디렉토리 (공통 컴포넌트 등)
|
|
23
|
+
* 상대 경로 또는 절대 경로 모두 지원
|
|
24
|
+
* 기본값: ["src/components", "components", "src/shared", "shared", "src/lib", "lib", "src/hooks", "hooks", "src/utils", "utils"]
|
|
25
|
+
*/
|
|
26
|
+
watchDirs?: string[];
|
|
27
27
|
/**
|
|
28
28
|
* 기본 watch 디렉토리 비활성화
|
|
29
29
|
* true로 설정하면 watchDirs만 감시
|
|
@@ -113,20 +113,26 @@ export async function startDevBundler(options: DevBundlerOptions): Promise<DevBu
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// 공통 컴포넌트 디렉토리 추가 (기본 + 커스텀)
|
|
116
|
-
const commonDirsToCheck = disableDefaultWatchDirs
|
|
117
|
-
? customWatchDirs
|
|
118
|
-
: [...DEFAULT_COMMON_DIRS, ...customWatchDirs];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
try {
|
|
123
|
-
await fs.promises.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
116
|
+
const commonDirsToCheck = disableDefaultWatchDirs
|
|
117
|
+
? customWatchDirs
|
|
118
|
+
: [...DEFAULT_COMMON_DIRS, ...customWatchDirs];
|
|
119
|
+
|
|
120
|
+
const addCommonDir = async (dir: string): Promise<void> => {
|
|
121
|
+
const absPath = path.isAbsolute(dir) ? dir : path.join(rootDir, dir);
|
|
122
|
+
try {
|
|
123
|
+
const stat = await fs.promises.stat(absPath);
|
|
124
|
+
const watchPath = stat.isDirectory() ? absPath : path.dirname(absPath);
|
|
125
|
+
await fs.promises.access(watchPath);
|
|
126
|
+
commonWatchDirs.add(watchPath);
|
|
127
|
+
watchDirs.add(watchPath);
|
|
128
|
+
} catch {
|
|
129
|
+
// 디렉토리 없으면 무시
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
for (const dir of commonDirsToCheck) {
|
|
134
|
+
await addCommonDir(dir);
|
|
135
|
+
}
|
|
130
136
|
|
|
131
137
|
// 파일 감시 설정
|
|
132
138
|
const watchers: fs.FSWatcher[] = [];
|