@fuzionx/framework 0.1.41 → 0.1.42

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/cli/db-sync.js CHANGED
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { promises as fs } from 'node:fs';
13
13
  import path from 'node:path';
14
+ import { pathToFileURL } from 'node:url';
14
15
 
15
16
  /**
16
17
  * 모델 클래스에서 CREATE TABLE SQL 생성
@@ -59,7 +60,7 @@ export async function generateSchema(modelsDir) {
59
60
  .map(e => path.join(modelsDir, e.name));
60
61
 
61
62
  for (const file of files) {
62
- const mod = await import(file);
63
+ const mod = await import(pathToFileURL(file).href);
63
64
  const ModelClass = mod.default;
64
65
  if (ModelClass?.table) {
65
66
  sqls.push(generateCreateTable(ModelClass));
package/cli/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
  import { promises as fs } from 'node:fs';
21
21
  import path from 'node:path';
22
22
  import { fileURLToPath } from 'node:url';
23
+ import { pathToFileURL } from 'node:url';
23
24
 
24
25
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
25
26
  const TPL_DIR = path.join(__dirname, 'templates');
@@ -335,7 +336,7 @@ export async function run(args) {
335
336
  // ── fx routes — 라우트 테이블 출력 ──
336
337
  if (command === 'routes') {
337
338
  try {
338
- const appMod = await import(path.resolve('app.js'));
339
+ const appMod = await import(pathToFileURL(path.resolve('app.js')).href);
339
340
  const app = appMod.default || appMod.app;
340
341
  if (!app?._appRegistry) { console.error('Cannot load app routes'); return; }
341
342
  console.log('');
@@ -390,7 +391,7 @@ export async function run(args) {
390
391
  const models = [];
391
392
 
392
393
  for (const file of jsFiles) {
393
- const mod = await import(path.join(modelsDir, file));
394
+ const mod = await import(pathToFileURL(path.join(modelsDir, file)).href);
394
395
  const Model = mod.default;
395
396
  if (!Model) continue;
396
397
  const name = path.basename(file, '.js');
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import { promises as fs } from 'node:fs';
12
12
  import path from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
13
14
 
14
15
  /**
15
16
  * 디렉토리에서 .js 파일 목록 반환
@@ -74,7 +75,7 @@ export default class AutoLoader {
74
75
  async loadModels(subDir = 'models') {
75
76
  const files = await scanDir(path.join(this.baseDir, subDir));
76
77
  for (const file of files) {
77
- const mod = await import(file);
78
+ const mod = await import(pathToFileURL(file).href);
78
79
  const ModelClass = mod.default;
79
80
  if (!ModelClass) continue;
80
81
  const name = extractName(file);
@@ -98,7 +99,7 @@ export default class AutoLoader {
98
99
  if (!registry) return;
99
100
 
100
101
  for (const file of files) {
101
- const mod = await import(file);
102
+ const mod = await import(pathToFileURL(file).href);
102
103
  const ControllerClass = mod.default;
103
104
  if (!ControllerClass) continue;
104
105
 
@@ -138,7 +139,7 @@ export default class AutoLoader {
138
139
  async loadServices() {
139
140
  const files = await scanDir(path.join(this.baseDir, 'services'));
140
141
  for (const file of files) {
141
- const mod = await import(file);
142
+ const mod = await import(pathToFileURL(file).href);
142
143
  const ServiceClass = mod.default;
143
144
  if (!ServiceClass) continue;
144
145
  const name = extractName(file, 'Service');
@@ -153,7 +154,7 @@ export default class AutoLoader {
153
154
 
154
155
  const files = await scanDir(path.join(this.baseDir, 'middleware'));
155
156
  for (const file of files) {
156
- const mod = await import(file);
157
+ const mod = await import(pathToFileURL(file).href);
157
158
  const MwClass = mod.default;
158
159
  if (!MwClass) continue;
159
160
  const mwName = MwClass.alias || extractName(file, 'Middleware').toLowerCase();
@@ -165,7 +166,7 @@ export default class AutoLoader {
165
166
  async loadEvents(subDir = 'events') {
166
167
  const files = await scanDir(path.join(this.baseDir, subDir));
167
168
  for (const file of files) {
168
- const mod = await import(file);
169
+ const mod = await import(pathToFileURL(file).href);
169
170
  // events/*.js 는 export default (app) => { app.on('...', handler) }
170
171
  if (typeof mod.default === 'function') {
171
172
  mod.default(this.app);
@@ -177,7 +178,7 @@ export default class AutoLoader {
177
178
  async loadJobs(subDir = 'jobs') {
178
179
  const files = await scanDir(path.join(this.baseDir, subDir));
179
180
  for (const file of files) {
180
- const mod = await import(file);
181
+ const mod = await import(pathToFileURL(file).href);
181
182
  const JobClass = mod.default;
182
183
  if (!JobClass) continue;
183
184
 
@@ -200,7 +201,7 @@ export default class AutoLoader {
200
201
 
201
202
  const files = await scanDir(path.join(this.baseDir, 'ws'));
202
203
  for (const file of files) {
203
- const mod = await import(file);
204
+ const mod = await import(pathToFileURL(file).href);
204
205
  const HandlerClass = mod.default;
205
206
  if (!HandlerClass) continue;
206
207
  const ns = HandlerClass.namespace || '/';
@@ -215,7 +216,7 @@ export default class AutoLoader {
215
216
 
216
217
  const files = await scanDir(path.join(this.baseDir, 'routes'));
217
218
  for (const file of files) {
218
- const mod = await import(file);
219
+ const mod = await import(pathToFileURL(file).href);
219
220
  if (typeof mod.default === 'function') {
220
221
  router.load(mod.default);
221
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzionx/framework",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
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.41",
37
+ "@fuzionx/core": "^0.1.42",
38
38
  "better-sqlite3": "^12.8.0",
39
39
  "knex": "^3.2.5",
40
40
  "mongoose": "^9.3.2",