diff --git a/package.json b/package.json index 0b657af..1c2b5dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "umi-plugin-ssr-routes", "author": "xXAvoraXx", - "version": "1.0.9", + "version": "1.0.10", "main": "dist/cjs/index.js", "types": "dist/cjs/index.d.ts", "scripts": { diff --git a/src/utils/getSessionContent.ts b/src/utils/getSessionContent.ts index f2aafd2..614de9d 100644 --- a/src/utils/getSessionContent.ts +++ b/src/utils/getSessionContent.ts @@ -15,40 +15,40 @@ export function setRemoteMenu(data: RouteRaw[]) { } function generateComponentPath(inputPath: string): string { - // Başındaki './' kısmını kaldır + // Remove the './' at the beginning let newPath = inputPath.replace(/^\\.\\//, ''); - // Slash karakterlerini işle + // Process slash characters const pathSegments = newPath.split('/'); newPath = pathSegments .map((segment, index) => { - // İlk segmentin sonuna "pages" ekleme + // Add "pages" at the end of the first segment if (index === 0) { return segment; } - // Diğer segmentlerin sonuna "pages" ekle + // Add "pages" at the end of other segments return 'pages/' + segment; }) .join('/'); - // Sonuna '/index' ekle + // Add '/index' at the end newPath = newPath + '/index'; return newPath; } -// component özelliğini eleman özelliğine çeviren fonksiyon +// Function to convert component property to element property function generateComponent(component: string | undefined): React.ReactNode | null { - // component değeri varsa dönüş yapın, yoksa null döndürün + // Return if component exists, otherwise return null if (component) { const componentPath = generateComponentPath(component); - // Bileşeni oluştur ve sakla + // Create and store the component return React.createElement(LazyLoadable(lazy(() => import(\`@/pages/\${componentPath}\`)))); } return React.createElement(EmptyRouteOutlet); } -// Sunucudan gelen RouteRaw dizisini Route dizisine dönüştürün +// Convert RouteRaw array from server to Route array function convertRoutes(rawRoutes: RouteRaw[]): Route[] { return rawRoutes.map((rawRoute) => { const { component, routes, ...rest } = rawRoute; diff --git a/src/utils/getTypeContent.ts b/src/utils/getTypeContent.ts index 4147604..57afb68 100644 --- a/src/utils/getTypeContent.ts +++ b/src/utils/getTypeContent.ts @@ -4,7 +4,7 @@ interface RouteObject { element?: React.ReactNode | null; } -// Ön tarafta sunucudan gelen verilere dayalı olarak oluşturulan rota verisi +// Route data generated on the front end based on data from the server. interface Route extends RouteObject { id: string; path: string; @@ -32,7 +32,7 @@ interface Route extends RouteObject { [key: string]: any; } -// Sunucudan gelen rota verisi RouteRaw[] olarak olur +// Route data from the server will be RouteRaw[] interface RouteRaw extends Route { key?: string; parentKeys?: 'ant-design-pro-layout' | string[];