@fuzionx/framework 0.1.55 → 0.1.57
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/lib/core/Application.js
CHANGED
|
@@ -278,11 +278,6 @@ export default class Application {
|
|
|
278
278
|
this._propagateBridge();
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
// 1. .env 로드 (17-config.md)
|
|
282
|
-
this.config.loadEnv(this.baseDir);
|
|
283
|
-
// .env 로드 후 캐시 클리어 (새로운 환경변수 반영)
|
|
284
|
-
this.config._cache?.clear();
|
|
285
|
-
|
|
286
281
|
await this.emit('booting');
|
|
287
282
|
|
|
288
283
|
// 2. i18n 로드 (04-bootstrap-lifecycle.md)
|
package/lib/core/AutoLoader.js
CHANGED
|
@@ -13,16 +13,25 @@ import path from 'node:path';
|
|
|
13
13
|
import { pathToFileURL } from 'node:url';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* 디렉토리에서 .js 파일
|
|
16
|
+
* 디렉토리에서 .js 파일 목록을 재귀적으로 반환
|
|
17
17
|
* @param {string} dir
|
|
18
18
|
* @returns {Promise<string[]>}
|
|
19
19
|
*/
|
|
20
20
|
async function scanDir(dir) {
|
|
21
21
|
try {
|
|
22
22
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const results = [];
|
|
24
|
+
for (const e of entries) {
|
|
25
|
+
if (e.name.startsWith('.')) continue;
|
|
26
|
+
const fullPath = path.join(dir, e.name);
|
|
27
|
+
if (e.isFile() && e.name.endsWith('.js')) {
|
|
28
|
+
results.push(fullPath);
|
|
29
|
+
} else if (e.isDirectory()) {
|
|
30
|
+
const nested = await scanDir(fullPath);
|
|
31
|
+
results.push(...nested);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return results;
|
|
26
35
|
} catch {
|
|
27
36
|
return []; // 디렉토리 없으면 빈 배열
|
|
28
37
|
}
|
package/lib/core/Config.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* fuzionx.yaml의 3개 섹션(bridge, database, app)을 통합 관리.
|
|
5
5
|
* dot-notation으로 접근: config.get('app.auth.secret')
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* ${VAR:default} 시스템 환경변수 치환 지원.
|
|
8
8
|
* YAML 파일 직접 파싱 지원 (외부 의존 없이 내장 파서 사용).
|
|
9
9
|
*
|
|
10
10
|
* @see docs/framework/17-config.md
|
|
@@ -235,34 +235,6 @@ export default class Config {
|
|
|
235
235
|
return raw;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
/**
|
|
239
|
-
* .env 파일 로드 (17-config.md)
|
|
240
|
-
* 부트 시 자동 호출. 이미 설정된 환경변수는 덮어쓰지 않음.
|
|
241
|
-
* @param {string} [baseDir='.']
|
|
242
|
-
*/
|
|
243
|
-
loadEnv(baseDir = '.') {
|
|
244
|
-
const envPath = path.resolve(baseDir, '.env');
|
|
245
|
-
if (!existsSync(envPath)) return;
|
|
246
|
-
|
|
247
|
-
try {
|
|
248
|
-
const content = readFileSync(envPath, 'utf-8');
|
|
249
|
-
for (const line of content.split('\n')) {
|
|
250
|
-
const trimmed = line.trim();
|
|
251
|
-
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
252
|
-
const eqIdx = trimmed.indexOf('=');
|
|
253
|
-
if (eqIdx === -1) continue;
|
|
254
|
-
const key = trimmed.slice(0, eqIdx).trim();
|
|
255
|
-
let value = trimmed.slice(eqIdx + 1).trim();
|
|
256
|
-
// .env 인용부호 제거 ("value" → value, 'value' → value)
|
|
257
|
-
value = value.replace(/^(['"])(.*)\1$/, '$2');
|
|
258
|
-
// 시스템 환경변수 우선 (17-config.md)
|
|
259
|
-
if (!(key in process.env)) {
|
|
260
|
-
process.env[key] = value;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
} catch {} // .env 읽기 실패 시 무시
|
|
264
|
-
}
|
|
265
|
-
|
|
266
238
|
/**
|
|
267
239
|
* YAML 객체의 ${VAR} / ${VAR:default} 패턴 치환 (17-config.md)
|
|
268
240
|
* @param {object} obj
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzionx/framework",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Full-stack MVC framework built on @fuzionx/core — Controller, Service, Model, Middleware, DI, EventBus",
|
|
6
6
|
"main": "index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/saytohenry/fuzionx"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@fuzionx/core": "^0.1.
|
|
37
|
+
"@fuzionx/core": "^0.1.57",
|
|
38
38
|
"better-sqlite3": "^12.8.0",
|
|
39
39
|
"knex": "^3.2.5",
|
|
40
40
|
"mongoose": "^9.3.2",
|