@mandujs/core 0.4.1 → 0.4.3

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.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Mandu Framework Core - Spec, Generator, Guard, Runtime",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -220,12 +220,14 @@ export * as ReactDOMClient from 'react-dom/client';
220
220
  * Island 엔트리 래퍼 생성
221
221
  */
222
222
  function generateIslandEntry(routeId: string, clientModulePath: string): string {
223
+ // Windows 경로의 백슬래시를 슬래시로 변환 (JS escape 문제 방지)
224
+ const normalizedPath = clientModulePath.replace(/\\/g, "/");
223
225
  return `
224
226
  /**
225
227
  * Mandu Island Entry: ${routeId} (Generated)
226
228
  */
227
229
 
228
- import island from "${clientModulePath}";
230
+ import island from "${normalizedPath}";
229
231
  import { registerIsland } from "./_runtime.js";
230
232
 
231
233
  registerIsland("${routeId}", () => island);
@@ -122,7 +122,7 @@ function computeSlotImportPath(slotModule: string, fromDir: string): string {
122
122
  }
123
123
 
124
124
  export function generatePageComponent(route: RouteSpec): string {
125
- const pageName = capitalize(route.id);
125
+ const pageName = toPascalCase(route.id);
126
126
  return `// Generated by Mandu - DO NOT EDIT DIRECTLY
127
127
  // Route ID: ${route.id}
128
128
  // Pattern: ${route.pattern}
@@ -143,6 +143,14 @@ export default function ${pageName}Page({ params }: Props): React.ReactElement {
143
143
  `;
144
144
  }
145
145
 
146
- function capitalize(str: string): string {
147
- return str.charAt(0).toUpperCase() + str.slice(1);
146
+ /**
147
+ * Convert string to PascalCase (handles kebab-case, snake_case)
148
+ * "todo-page" → "TodoPage"
149
+ * "user_profile" → "UserProfile"
150
+ */
151
+ function toPascalCase(str: string): string {
152
+ return str
153
+ .split(/[-_]/)
154
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
155
+ .join("");
148
156
  }