@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bundler/dev.ts +26 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mandujs/core",
3
- "version": "0.9.30",
3
+ "version": "0.9.31",
4
4
  "description": "Mandu Framework Core - Spec, Generator, Guard, Runtime",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -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
- for (const dir of commonDirsToCheck) {
121
- const absDir = path.isAbsolute(dir) ? dir : path.join(rootDir, dir);
122
- try {
123
- await fs.promises.access(absDir);
124
- commonWatchDirs.add(absDir);
125
- watchDirs.add(absDir);
126
- } catch {
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[] = [];