@mandujs/core 0.9.20 → 0.9.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mandujs/core",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "description": "Mandu Framework Core - Spec, Generator, Guard, Runtime",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -358,7 +358,19 @@ async function handleRequest(req: Request, router: Router): Promise<Response> {
358
358
  if (loader) {
359
359
  try {
360
360
  const module = await loader();
361
- registerRouteComponent(route.id, module.default);
361
+ // module.default가 { component, filling } 객체인 경우 component 추출
362
+ const exported = module.default;
363
+ const component = typeof exported === 'function'
364
+ ? exported
365
+ : exported?.component ?? exported;
366
+ registerRouteComponent(route.id, component);
367
+
368
+ // filling이 있으면 loader 실행
369
+ const filling = typeof exported === 'object' ? exported?.filling : null;
370
+ if (filling?.hasLoader?.()) {
371
+ const ctx = new ManduContext(req, params);
372
+ loaderData = await filling.executeLoader(ctx);
373
+ }
362
374
  } catch (err) {
363
375
  const pageError = createPageLoadErrorResponse(
364
376
  route.id,