@teamvelix/velix 5.0.1
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/LICENSE +21 -0
- package/README.md +117 -0
- package/assets/logo.webp +0 -0
- package/dist/build/index.d.ts +19 -0
- package/dist/build/index.js +588 -0
- package/dist/build/index.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +148 -0
- package/dist/client/index.js.map +1 -0
- package/dist/config.d.ts +194 -0
- package/dist/config.js +129 -0
- package/dist/config.js.map +1 -0
- package/dist/index-C4udNtpZ.d.ts +405 -0
- package/dist/index-l0dwPa62.d.ts +106 -0
- package/dist/index.d.ts +792 -0
- package/dist/index.js +3387 -0
- package/dist/index.js.map +1 -0
- package/dist/islands/index.d.ts +97 -0
- package/dist/islands/index.js +182 -0
- package/dist/islands/index.js.map +1 -0
- package/dist/runtime/start-dev.d.ts +2 -0
- package/dist/runtime/start-dev.js +2432 -0
- package/dist/runtime/start-dev.js.map +1 -0
- package/dist/runtime/start-prod.d.ts +2 -0
- package/dist/runtime/start-prod.js +2408 -0
- package/dist/runtime/start-prod.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +2442 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../build/index.ts","../../config.ts","../../router/index.ts","../../utils.ts","../../logger.ts"],"sourcesContent":["/**\n * Velix v5 Build System\n * Production build using esbuild\n */\n\nimport esbuild from 'esbuild';\nimport fs from 'fs';\nimport path from 'path';\nimport { loadConfig, resolvePaths } from '../config.js';\nimport { buildRouteTree } from '../router/index.js';\nimport { ensureDir, cleanDir, findFiles, formatBytes, formatTime } from '../utils.js';\nimport logger from '../logger.js';\n\nexport interface BuildOptions {\n projectRoot?: string;\n outDir?: string;\n minify?: boolean;\n sourcemap?: boolean;\n}\n\n/**\n * Build the Velix application for production\n */\nexport async function build(options: BuildOptions = {}) {\n const projectRoot = options.projectRoot || process.cwd();\n const config = await loadConfig(projectRoot);\n const resolved = resolvePaths(config, projectRoot);\n\n const outDir = options.outDir || resolved.resolvedOutDir;\n const startTime = Date.now();\n\n logger.logo();\n logger.info('Building for production...');\n logger.blank();\n\n // Clean output directory\n cleanDir(outDir);\n\n const appDir = resolved.resolvedAppDir;\n const routes = buildRouteTree(appDir);\n\n // Collect all source files\n const sourceFiles = findFiles(appDir, /\\.(tsx?|jsx?)$/);\n\n if (sourceFiles.length === 0) {\n logger.warn('No source files found in app/ directory');\n return;\n }\n\n // Build server bundle\n try {\n const serverOutDir = path.join(outDir, 'server');\n ensureDir(serverOutDir);\n\n await esbuild.build({\n entryPoints: sourceFiles,\n outdir: serverOutDir,\n bundle: false,\n format: 'esm',\n platform: 'node',\n target: config.build.target,\n minify: options.minify ?? config.build.minify,\n sourcemap: options.sourcemap ?? config.build.sourcemap,\n jsx: 'automatic',\n logLevel: 'silent',\n });\n\n logger.success('Server bundle built');\n } catch (err: any) {\n logger.error('Server build failed', err);\n process.exit(1);\n }\n\n // Build client bundle (client components and islands)\n try {\n const clientOutDir = path.join(outDir, 'client');\n ensureDir(clientOutDir);\n\n const clientFiles = sourceFiles.filter(f => {\n const content = fs.readFileSync(f, 'utf-8');\n const firstLine = content.split('\\n')[0]?.trim();\n return firstLine === \"'use client'\" || firstLine === '\"use client\"' ||\n firstLine === \"'use island'\" || firstLine === '\"use island\"';\n });\n\n if (clientFiles.length > 0) {\n await esbuild.build({\n entryPoints: clientFiles,\n outdir: clientOutDir,\n bundle: true,\n format: 'esm',\n platform: 'browser',\n target: ['es2022'],\n minify: options.minify ?? config.build.minify,\n sourcemap: options.sourcemap ?? config.build.sourcemap,\n splitting: config.build.splitting,\n jsx: 'automatic',\n logLevel: 'silent',\n external: ['react', 'react-dom'],\n });\n\n logger.success(`Client bundle built (${clientFiles.length} components)`);\n }\n } catch (err: any) {\n logger.error('Client build failed', err);\n process.exit(1);\n }\n\n // Copy public directory\n const publicDir = resolved.resolvedPublicDir;\n if (fs.existsSync(publicDir)) {\n const publicOutDir = path.join(outDir, 'public');\n ensureDir(publicOutDir);\n copyDirRecursive(publicDir, publicOutDir);\n logger.success('Static assets copied');\n }\n\n // Generate build manifest\n const manifest = {\n version: '5.0.0',\n buildTime: new Date().toISOString(),\n routes: routes.appRoutes.map(r => ({\n path: r.path,\n type: r.path.includes(':') ? 'dynamic' : 'static',\n })),\n api: routes.api.map(r => ({ path: r.path })),\n };\n\n fs.writeFileSync(path.join(outDir, 'manifest.json'), JSON.stringify(manifest, null, 2));\n\n const elapsed = Date.now() - startTime;\n const totalSize = getDirSize(outDir);\n\n logger.blank();\n logger.divider();\n logger.blank();\n\n // Log routes\n routes.appRoutes.forEach(r => {\n const type = r.path.includes(':') || r.path.includes('*') ? 'dynamic' : 'static';\n logger.route(r.path, type);\n });\n routes.api.forEach(r => logger.route(r.path, 'api'));\n\n logger.blank();\n logger.build({ time: elapsed });\n logger.info(`Output: ${outDir} (${formatBytes(totalSize)})`);\n logger.blank();\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction copyDirRecursive(src: string, dest: string) {\n ensureDir(dest);\n const entries = fs.readdirSync(src, { withFileTypes: true });\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n if (entry.isDirectory()) copyDirRecursive(srcPath, destPath);\n else fs.copyFileSync(srcPath, destPath);\n }\n}\n\nfunction getDirSize(dir: string): number {\n let size = 0;\n if (!fs.existsSync(dir)) return size;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) size += getDirSize(fullPath);\n else size += fs.statSync(fullPath).size;\n }\n return size;\n}\n\nexport default { build };\n","/**\n * Velix v5 Configuration System\n * Handles loading, validation, and merging of velix.config.ts\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { pathToFileURL } from 'url';\nimport { z } from 'zod';\nimport pc from 'picocolors';\n\n// ============================================================================\n// Configuration Schema (Zod validation)\n// ============================================================================\n\nconst AppConfigSchema = z.object({\n name: z.string().default('Velix App'),\n url: z.string().url().optional(),\n}).default({});\n\nconst ServerConfigSchema = z.object({\n port: z.number().min(1).max(65535).default(3000),\n host: z.string().default('localhost'),\n}).default({});\n\nconst RoutingConfigSchema = z.object({\n trailingSlash: z.boolean().default(false),\n}).default({});\n\nconst SEOConfigSchema = z.object({\n sitemap: z.boolean().default(true),\n robots: z.boolean().default(true),\n openGraph: z.boolean().default(true),\n}).default({});\n\nconst BuildConfigSchema = z.object({\n target: z.string().default('es2022'),\n minify: z.boolean().default(true),\n sourcemap: z.boolean().default(true),\n splitting: z.boolean().default(true),\n outDir: z.string().default('.velix'),\n}).default({});\n\nconst ExperimentalConfigSchema = z.object({\n islands: z.boolean().default(true),\n streaming: z.boolean().default(true),\n}).default({});\n\nconst PluginSchema = z.union([\n z.string(),\n z.object({\n name: z.string()\n }).passthrough(),\n]);\n\nexport const VelixConfigSchema = z.object({\n // App identity\n app: AppConfigSchema,\n\n // DevTools toggle\n devtools: z.boolean().default(true),\n\n // Server options\n server: ServerConfigSchema,\n\n // Routing options\n routing: RoutingConfigSchema,\n\n // SEO configuration\n seo: SEOConfigSchema,\n\n // Build options\n build: BuildConfigSchema,\n\n // Experimental features\n experimental: ExperimentalConfigSchema,\n\n // Plugins\n plugins: z.array(PluginSchema).default([]),\n\n // Directories (resolved automatically)\n appDir: z.string().default('app'),\n publicDir: z.string().default('public'),\n\n // Stylesheets\n styles: z.array(z.string()).default([]),\n\n // Favicon\n favicon: z.string().nullable().default(null),\n});\n\nexport type VelixConfig = z.infer<typeof VelixConfigSchema>;\n\n// ============================================================================\n// Default configuration\n// ============================================================================\n\nexport const defaultConfig: VelixConfig = VelixConfigSchema.parse({});\n\n// ============================================================================\n// defineConfig helper\n// ============================================================================\n\n/**\n * Helper function to define configuration with full type support.\n * Use this in your velix.config.ts file.\n *\n * @example\n * ```ts\n * import { defineConfig } from \"velix\";\n *\n * export default defineConfig({\n * app: { name: \"My App\" },\n * server: { port: 3000 },\n * seo: { sitemap: true }\n * });\n * ```\n */\nexport function defineConfig(config: Partial<VelixConfig>): Partial<VelixConfig> {\n return config;\n}\n\n// ============================================================================\n// Config Loader\n// ============================================================================\n\n/**\n * Loads and validates configuration from velix.config.ts\n */\nexport async function loadConfig(projectRoot: string): Promise<VelixConfig> {\n const configPathTs = path.join(projectRoot, 'velix.config.ts');\n const configPathJs = path.join(projectRoot, 'velix.config.js');\n // Support legacy config for migration\n const configPathLegacyTs = path.join(projectRoot, 'flexireact.config.ts');\n const configPathLegacyJs = path.join(projectRoot, 'flexireact.config.js');\n\n let configPath: string | null = null;\n if (fs.existsSync(configPathTs)) configPath = configPathTs;\n else if (fs.existsSync(configPathJs)) configPath = configPathJs;\n else if (fs.existsSync(configPathLegacyTs)) configPath = configPathLegacyTs;\n else if (fs.existsSync(configPathLegacyJs)) configPath = configPathLegacyJs;\n\n let userConfig: Partial<VelixConfig> = {};\n\n if (configPath) {\n try {\n const configUrl = pathToFileURL(configPath).href;\n const module = await import(`${configUrl}?t=${Date.now()}`);\n userConfig = module.default || module;\n } catch (error: any) {\n console.warn(pc.yellow(`⚠ Failed to load config: ${error.message}`));\n }\n }\n\n // Merge and validate with Zod\n const merged = deepMerge(defaultConfig, userConfig as Record<string, any>);\n\n try {\n return VelixConfigSchema.parse(merged);\n } catch (err: unknown) {\n if (err instanceof z.ZodError) {\n console.error(pc.red('✖ Configuration validation failed:'));\n for (const issue of err.issues) {\n console.error(pc.dim(` - ${issue.path.join('.')}: ${issue.message}`));\n }\n process.exit(1);\n }\n throw err;\n }\n}\n\n// ============================================================================\n// Path Resolution\n// ============================================================================\n\n/**\n * Resolves all paths in config relative to project root\n */\nexport function resolvePaths(config: VelixConfig, projectRoot: string): VelixConfig & { resolvedAppDir: string; resolvedPublicDir: string; resolvedOutDir: string } {\n return {\n ...config,\n resolvedAppDir: path.resolve(projectRoot, config.appDir),\n resolvedPublicDir: path.resolve(projectRoot, config.publicDir),\n resolvedOutDir: path.resolve(projectRoot, config.build.outDir),\n };\n}\n\n// ============================================================================\n// Utility: Deep merge\n// ============================================================================\n\nfunction deepMerge(target: Record<string, any>, source: Record<string, any>): Record<string, any> {\n const result = { ...target };\n\n for (const key in source) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n result[key] = deepMerge(target[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n\n return result;\n}\n","/**\n * Velix v5 Router\n * File-based routing using the app/ directory convention\n *\n * Supports:\n * - app/page.tsx → /\n * - app/dashboard/page.tsx → /dashboard\n * - app/blog/[slug]/page.tsx → /blog/:slug\n * - app/(group)/page.tsx → / (route groups)\n * - app/[...slug]/page.tsx → catch-all routes\n * - layout.tsx, loading.tsx, error.tsx, not-found.tsx\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { isServerComponent, isClientComponent, isIsland } from '../utils.js';\n\n// ============================================================================\n// Route Types\n// ============================================================================\n\nexport const RouteType = {\n PAGE: 'page',\n API: 'api',\n LAYOUT: 'layout',\n LOADING: 'loading',\n ERROR: 'error',\n NOT_FOUND: 'not-found'\n} as const;\n\n// ============================================================================\n// Build Route Tree\n// ============================================================================\n\n/**\n * Builds the complete route tree from the app/ directory\n */\nexport function buildRouteTree(appDir: string) {\n const projectRoot = path.dirname(appDir);\n\n const routes: {\n pages: any[];\n api: any[];\n layouts: Map<string, string>;\n tree: Record<string, any>;\n appRoutes: any[];\n rootLayout?: string;\n } = {\n pages: [],\n api: [],\n layouts: new Map(),\n tree: {},\n appRoutes: [],\n };\n\n // Scan app/ directory\n if (fs.existsSync(appDir)) {\n scanAppDirectory(appDir, appDir, routes);\n }\n\n // Scan server/api/ for API routes\n const serverApiDir = path.join(projectRoot, 'server', 'api');\n if (fs.existsSync(serverApiDir)) {\n scanApiDirectory(serverApiDir, serverApiDir, routes);\n }\n\n // Check for root layout\n const rootLayoutTsx = path.join(appDir, 'layout.tsx');\n const rootLayoutJsx = path.join(appDir, 'layout.jsx');\n if (fs.existsSync(rootLayoutTsx)) routes.rootLayout = rootLayoutTsx;\n else if (fs.existsSync(rootLayoutJsx)) routes.rootLayout = rootLayoutJsx;\n\n // Build route tree for nested routes\n routes.tree = buildTree(routes.appRoutes);\n\n return routes;\n}\n\n// ============================================================================\n// App Directory Scanner\n// ============================================================================\n\n/**\n * Scans app/ directory for file-based routing\n * Supports: page.tsx, layout.tsx, loading.tsx, error.tsx, not-found.tsx, [param].tsx\n */\nfunction scanAppDirectory(\n baseDir: string,\n currentDir: string,\n routes: any,\n parentSegments: string[] = [],\n parentLayout: string | null = null,\n parentMiddleware: string | null = null\n) {\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n\n // Find special files in current directory\n const specialFiles: Record<string, string | null> = {\n page: null,\n layout: null,\n loading: null,\n error: null,\n notFound: null,\n template: null,\n middleware: null\n };\n\n for (const entry of entries) {\n if (entry.isFile()) {\n const name = entry.name.replace(/\\.(jsx|js|tsx|ts)$/, '');\n const fullPath = path.join(currentDir, entry.name);\n const ext = path.extname(entry.name);\n\n // Only process relevant extensions\n if (!['.tsx', '.jsx', '.ts', '.js'].includes(ext)) continue;\n\n if (name === 'page') specialFiles.page = fullPath;\n if (name === 'layout') specialFiles.layout = fullPath;\n if (name === 'loading') specialFiles.loading = fullPath;\n if (name === 'error') specialFiles.error = fullPath;\n if (name === 'not-found') specialFiles.notFound = fullPath;\n if (name === 'template') specialFiles.template = fullPath;\n if (name === 'middleware' || name === '_middleware') specialFiles.middleware = fullPath;\n\n // Handle [param].tsx files directly in app/ (alternative to [param]/page.tsx)\n if (name.startsWith('[') && name.endsWith(']') && ['.tsx', '.jsx'].includes(ext)) {\n const paramName = name.slice(1, -1);\n let segmentName: string;\n\n if (paramName.startsWith('...')) {\n segmentName = '*' + paramName.slice(3);\n } else {\n segmentName = ':' + paramName;\n }\n\n const routePath = '/' + [...parentSegments, segmentName].join('/');\n\n routes.appRoutes.push({\n type: RouteType.PAGE,\n path: routePath.replace(/\\/+/g, '/'),\n filePath: fullPath,\n pattern: createRoutePattern(routePath),\n segments: [...parentSegments, segmentName],\n layout: specialFiles.layout || parentLayout,\n loading: specialFiles.loading,\n error: specialFiles.error,\n notFound: specialFiles.notFound,\n template: specialFiles.template,\n middleware: specialFiles.middleware || parentMiddleware,\n isServerComponent: isServerComponent(fullPath),\n isClientComponent: isClientComponent(fullPath),\n isIsland: isIsland(fullPath),\n });\n }\n }\n }\n\n // If there's a page.tsx, create a route for this directory\n if (specialFiles.page) {\n const routePath = '/' + parentSegments.join('/') || '/';\n\n routes.appRoutes.push({\n type: RouteType.PAGE,\n path: routePath.replace(/\\/+/g, '/') || '/',\n filePath: specialFiles.page,\n pattern: createRoutePattern(routePath || '/'),\n segments: parentSegments,\n layout: specialFiles.layout || parentLayout,\n loading: specialFiles.loading,\n error: specialFiles.error,\n notFound: specialFiles.notFound,\n template: specialFiles.template,\n middleware: specialFiles.middleware || parentMiddleware,\n isServerComponent: isServerComponent(specialFiles.page),\n isClientComponent: isClientComponent(specialFiles.page),\n isIsland: isIsland(specialFiles.page),\n });\n }\n\n // Recursively scan subdirectories\n for (const entry of entries) {\n if (entry.isDirectory()) {\n const fullPath = path.join(currentDir, entry.name);\n\n // Skip special directories\n if (entry.name.startsWith('_') || entry.name.startsWith('.')) continue;\n\n // Handle route groups (parentheses) — don't add to URL\n const isGroup = entry.name.startsWith('(') && entry.name.endsWith(')');\n\n // Handle dynamic segments [param]\n let segmentName = entry.name;\n if (entry.name.startsWith('[') && entry.name.endsWith(']')) {\n segmentName = ':' + entry.name.slice(1, -1);\n if (entry.name.startsWith('[...')) {\n segmentName = '*' + entry.name.slice(4, -1);\n }\n if (entry.name.startsWith('[[...')) {\n segmentName = '*' + entry.name.slice(5, -2);\n }\n }\n\n const newSegments = isGroup ? parentSegments : [...parentSegments, segmentName];\n const newLayout = specialFiles.layout || parentLayout;\n const newMiddleware = specialFiles.middleware || parentMiddleware;\n\n scanAppDirectory(baseDir, fullPath, routes, newSegments, newLayout, newMiddleware);\n }\n }\n}\n\n// ============================================================================\n// API Directory Scanner (server/api/)\n// ============================================================================\n\nfunction scanApiDirectory(baseDir: string, currentDir: string, routes: any, parentSegments: string[] = []) {\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(currentDir, entry.name);\n\n if (entry.isDirectory()) {\n scanApiDirectory(baseDir, fullPath, routes, [...parentSegments, entry.name]);\n } else if (entry.isFile()) {\n const ext = path.extname(entry.name);\n if (!['.ts', '.js'].includes(ext)) continue;\n\n const baseName = path.basename(entry.name, ext);\n // route.ts maps to the parent path, other names become segments\n const apiSegments = baseName === 'route' || baseName === 'index'\n ? parentSegments\n : [...parentSegments, baseName];\n\n const apiPath = '/api/' + apiSegments.join('/');\n\n routes.api.push({\n type: RouteType.API,\n path: apiPath.replace(/\\/+/g, '/') || '/api',\n filePath: fullPath,\n pattern: createRoutePattern(apiPath),\n segments: ['api', ...apiSegments].filter(Boolean),\n });\n }\n }\n}\n\n// ============================================================================\n// Route Matching\n// ============================================================================\n\n/**\n * Creates regex pattern for route matching\n */\nfunction createRoutePattern(routePath: string): RegExp {\n let pattern = routePath\n .replace(/\\*[^/]*/g, '(.*)') // Catch-all\n .replace(/:[^/]+/g, '([^/]+)') // Dynamic segments\n .replace(/\\//g, '\\\\/');\n\n return new RegExp(`^${pattern}$`);\n}\n\n/**\n * Matches URL path against routes\n */\nexport function matchRoute(urlPath: string, routes: any[]) {\n const normalizedPath = urlPath === '' ? '/' : urlPath.split('?')[0];\n\n for (const route of routes) {\n const match = normalizedPath.match(route.pattern);\n if (match) {\n const params = extractParams(route.path, match);\n return { ...route, params };\n }\n }\n\n return null;\n}\n\n/**\n * Extracts parameters from route match\n */\nfunction extractParams(routePath: string, match: RegExpMatchArray): Record<string, string> {\n const params: Record<string, string> = {};\n const paramNames: string[] = [];\n\n const paramRegex = /:([^/]+)|\\*([^/]*)/g;\n let paramMatch;\n while ((paramMatch = paramRegex.exec(routePath)) !== null) {\n paramNames.push(paramMatch[1] || paramMatch[2] || 'splat');\n }\n\n paramNames.forEach((name, index) => {\n params[name] = match[index + 1];\n });\n\n return params;\n}\n\n// ============================================================================\n// Layout Resolution\n// ============================================================================\n\n/**\n * Finds all layouts that apply to a route\n */\nexport function findRouteLayouts(route: any, layoutsMap: Map<string, string>): Array<{ name: string; filePath: string | undefined }> {\n const layouts: Array<{ name: string; filePath: string | undefined }> = [];\n\n // Check for segment-based layouts\n for (const segment of route.segments) {\n if (layoutsMap.has(segment)) {\n layouts.push({ name: segment, filePath: layoutsMap.get(segment) });\n }\n }\n\n // Check for route-specific layout\n if (route.layout) {\n layouts.push({ name: 'route', filePath: route.layout });\n }\n\n // Check for root layout\n if (layoutsMap.has('root')) {\n layouts.unshift({ name: 'root', filePath: layoutsMap.get('root') });\n }\n\n return layouts;\n}\n\n// ============================================================================\n// Tree Building\n// ============================================================================\n\nfunction buildTree(routes: any[]): any {\n const tree: any = { children: {}, routes: [] };\n\n for (const route of routes) {\n let current = tree;\n for (const segment of route.segments) {\n if (!current.children[segment]) {\n current.children[segment] = { children: {}, routes: [] };\n }\n current = current.children[segment];\n }\n current.routes.push(route);\n }\n\n return tree;\n}\n\n// ============================================================================\n// Default Export\n// ============================================================================\n\nexport default {\n buildRouteTree,\n matchRoute,\n findRouteLayouts,\n RouteType\n};\n","/**\n * Velix v5 Utility Functions\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport crypto from 'crypto';\n\n/**\n * Generates a unique hash for cache busting\n */\nexport function generateHash(content: string): string {\n return crypto.createHash('md5').update(content).digest('hex').slice(0, 8);\n}\n\n/**\n * Escapes HTML special characters\n */\nexport function escapeHtml(str: string): string {\n const htmlEntities: Record<string, string> = {\n '&': '&', '<': '<', '>': '>',\n '\"': '"', \"'\": '''\n };\n return String(str).replace(/[&<>\"']/g, char => htmlEntities[char]);\n}\n\n/**\n * Recursively finds all files matching a pattern\n */\nexport function findFiles(dir: string, pattern: RegExp, files: string[] = []): string[] {\n if (!fs.existsSync(dir)) return files;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) findFiles(fullPath, pattern, files);\n else if (pattern.test(entry.name)) files.push(fullPath);\n }\n return files;\n}\n\n/**\n * Ensures a directory exists\n */\nexport function ensureDir(dir: string): void {\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n}\n\n/**\n * Cleans a directory\n */\nexport function cleanDir(dir: string): void {\n if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true, force: true });\n fs.mkdirSync(dir, { recursive: true });\n}\n\n/**\n * Copies a directory recursively\n */\nexport function copyDir(src: string, dest: string): void {\n ensureDir(dest);\n const entries = fs.readdirSync(src, { withFileTypes: true });\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n if (entry.isDirectory()) copyDir(srcPath, destPath);\n else fs.copyFileSync(srcPath, destPath);\n }\n}\n\n/**\n * Debounce function for file watching\n */\nexport function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n return (...args: Parameters<T>) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n };\n}\n\n/**\n * Formats bytes to human-readable string\n */\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n}\n\n/**\n * Formats milliseconds to human-readable string\n */\nexport function formatTime(ms: number): string {\n if (ms < 1000) return `${ms}ms`;\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/**\n * Creates a deferred promise\n */\nexport function createDeferred() {\n let resolve: any, reject: any;\n const promise = new Promise((res, rej) => { resolve = res; reject = rej; });\n return { promise, resolve, reject };\n}\n\n/**\n * Sleep utility\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Check if a file is a server component (has 'use server' directive)\n */\nexport function isServerComponent(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n const firstLine = content.split('\\n')[0].trim();\n return firstLine === \"'use server'\" || firstLine === '\"use server\"';\n } catch { return false; }\n}\n\n/**\n * Check if a file is a client component (has 'use client' directive)\n */\nexport function isClientComponent(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n const firstLine = content.split('\\n')[0].trim();\n return firstLine === \"'use client'\" || firstLine === '\"use client\"';\n } catch { return false; }\n}\n\n/**\n * Check if a component is an island (has 'use island' directive)\n */\nexport function isIsland(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n const firstLine = content.split('\\n')[0].trim();\n return firstLine === \"'use island'\" || firstLine === '\"use island\"';\n } catch { return false; }\n}\n","/**\n * Velix v5 Logger\n * Minimalist, professional output inspired by modern CLIs\n */\n\nconst colors = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n dim: '\\x1b[2m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n magenta: '\\x1b[35m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m',\n};\n\nconst c = colors;\n\nfunction getTime() {\n const now = new Date();\n const hours = String(now.getHours()).padStart(2, '0');\n const minutes = String(now.getMinutes()).padStart(2, '0');\n const seconds = String(now.getSeconds()).padStart(2, '0');\n return `${c.dim}${hours}:${minutes}:${seconds}${c.reset}`;\n}\n\nfunction getStatusColor(status: number) {\n if (status >= 500) return c.red;\n if (status >= 400) return c.yellow;\n if (status >= 300) return c.cyan;\n if (status >= 200) return c.green;\n return c.white;\n}\n\nfunction fmtTime(ms: number) {\n if (ms < 1) return `${c.gray}<1ms${c.reset}`;\n if (ms < 100) return `${c.green}${ms}ms${c.reset}`;\n if (ms < 500) return `${c.yellow}${ms}ms${c.reset}`;\n return `${c.red}${ms}ms${c.reset}`;\n}\n\nconst VERSION = '5.0.0';\n\nconst LOGO = `\n ${c.cyan}▲${c.reset} ${c.bold}Velix${c.reset} ${c.dim}v${VERSION}${c.reset}\n`;\n\nexport const logger = {\n logo() {\n console.log(LOGO);\n console.log(`${c.dim} ──────────────────────────────────────────────${c.reset}`);\n console.log('');\n },\n\n serverStart(config: any, startTime = Date.now()) {\n const { port, host, mode, pagesDir } = config;\n const elapsed = Date.now() - startTime;\n\n console.log(LOGO);\n console.log(` ${c.green}✔${c.reset} ${c.bold}Ready${c.reset} in ${elapsed}ms`);\n console.log('');\n console.log(` ${c.bold}Local:${c.reset} ${c.cyan}http://${host}:${port}${c.reset}`);\n console.log(` ${c.bold}Mode:${c.reset} ${mode === 'development' ? c.yellow : c.green}${mode}${c.reset}`);\n if (pagesDir) console.log(` ${c.bold}App:${c.reset} ${c.dim}${pagesDir}${c.reset}`);\n console.log('');\n },\n\n request(method: string, path: string, status: number, time: number, extra: { type?: string } = {}) {\n const statusColor = getStatusColor(status);\n const timeStr = fmtTime(time);\n\n let badge = `${c.dim}○${c.reset}`;\n if (extra.type === 'dynamic' || extra.type === 'ssr') badge = `${c.white}ƒ${c.reset}`;\n else if (extra.type === 'api') badge = `${c.cyan}λ${c.reset}`;\n\n const statusStr = `${statusColor}${status}${c.reset}`;\n console.log(` ${badge} ${c.white}${method}${c.reset} ${path} ${statusStr} ${c.dim}${timeStr}${c.reset}`);\n },\n\n info(msg: string) { console.log(` ${c.cyan}ℹ${c.reset} ${msg}`); },\n success(msg: string) { console.log(` ${c.green}✔${c.reset} ${msg}`); },\n warn(msg: string) { console.log(` ${c.yellow}⚠${c.reset} ${c.yellow}${msg}${c.reset}`); },\n\n error(msg: string, err: Error | null = null) {\n console.log(` ${c.red}✖${c.reset} ${c.red}${msg}${c.reset}`);\n if (err?.stack) {\n console.log('');\n console.log(`${c.dim}${err.stack.split('\\n').slice(1, 4).join('\\n')}${c.reset}`);\n console.log('');\n }\n },\n\n compile(file: string, time: number) {\n console.log(` ${c.white}●${c.reset} Compiling ${c.dim}${file}${c.reset} ${c.dim}(${time}ms)${c.reset}`);\n },\n\n hmr(file: string) {\n console.log(` ${c.green}↻${c.reset} Fast Refresh ${c.dim}${file}${c.reset}`);\n },\n\n plugin(name: string) {\n console.log(` ${c.cyan}◆${c.reset} Plugin ${c.dim}${name}${c.reset}`);\n },\n\n route(path: string, type: string) {\n const typeLabel = type === 'api' ? 'λ' : type === 'dynamic' ? 'ƒ' : '○';\n const color = type === 'api' ? c.cyan : type === 'dynamic' ? c.white : c.dim;\n console.log(` ${color}${typeLabel}${c.reset} ${path}`);\n },\n\n divider() { console.log(`${c.dim} ──────────────────────────────────────────────${c.reset}`); },\n blank() { console.log(''); },\n\n portInUse(port: number | string) {\n this.error(`Port ${port} is already in use.`);\n this.blank();\n console.log(` ${c.dim}Try:${c.reset}`);\n console.log(` 1. Kill the process on port ${port}`);\n console.log(` 2. Use a different port via PORT env var`);\n this.blank();\n },\n\n build(stats: { time: number }) {\n this.blank();\n console.log(` ${c.green}✔${c.reset} Build completed`);\n this.blank();\n console.log(` ${c.dim}Total time:${c.reset} ${c.white}${stats.time}ms${c.reset}`);\n this.blank();\n },\n};\n\nexport default logger;\n"],"mappings":";AAKA,OAAO,aAAa;AACpB,OAAOA,SAAQ;AACf,OAAOC,WAAU;;;ACFjB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,SAAS;AAClB,OAAO,QAAQ;AAMf,IAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,MAAM,EAAE,OAAO,EAAE,QAAQ,WAAW;AAAA,EACpC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACjC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEb,IAAM,qBAAqB,E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;AACX,MAAI,CAACA,IAAG,WAAW,GAAG,EAAG,QAAO;AAChC,QAAM,UAAUA,IAAG,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AAC3D,aAAW,SAAS,SAAS;AAC3B,UAAM,WAAWD,MAAK,KAAK,KAAK,MAAM,IAAI;AAC1C,QAAI,MAAM,YAAY,EAAG,SAAQ,WAAW,QAAQ;AAAA,QAC/C,SAAQC,IAAG,SAAS,QAAQ,EAAE;AAAA,EACrC;AACA,SAAO;AACT;AAEA,IAAO,gBAAQ,EAAE,MAAM;","names":["fs","path","fs","path","fs","path","fs","path","fs","path","fs","path","path","fs"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// context.ts
|
|
2
|
+
import React from "react";
|
|
3
|
+
var RequestContext = React.createContext(null);
|
|
4
|
+
var RouteContext = React.createContext(null);
|
|
5
|
+
var LayoutContext = React.createContext(null);
|
|
6
|
+
function useParams() {
|
|
7
|
+
const context = React.useContext(RouteContext);
|
|
8
|
+
return context?.params || {};
|
|
9
|
+
}
|
|
10
|
+
function useQuery() {
|
|
11
|
+
const context = React.useContext(RouteContext);
|
|
12
|
+
return context?.query || {};
|
|
13
|
+
}
|
|
14
|
+
function usePathname() {
|
|
15
|
+
const context = React.useContext(RouteContext);
|
|
16
|
+
return context?.pathname || "/";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// client/index.ts
|
|
20
|
+
import React2 from "react";
|
|
21
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
22
|
+
var currentState = {
|
|
23
|
+
pathname: typeof window !== "undefined" ? window.location.pathname : "/",
|
|
24
|
+
query: {},
|
|
25
|
+
params: {}
|
|
26
|
+
};
|
|
27
|
+
function notify() {
|
|
28
|
+
listeners.forEach((fn) => fn());
|
|
29
|
+
}
|
|
30
|
+
var router = {
|
|
31
|
+
push(url) {
|
|
32
|
+
if (typeof window === "undefined") return;
|
|
33
|
+
window.history.pushState({}, "", url);
|
|
34
|
+
currentState = { ...currentState, pathname: url.split("?")[0] };
|
|
35
|
+
notify();
|
|
36
|
+
},
|
|
37
|
+
replace(url) {
|
|
38
|
+
if (typeof window === "undefined") return;
|
|
39
|
+
window.history.replaceState({}, "", url);
|
|
40
|
+
currentState = { ...currentState, pathname: url.split("?")[0] };
|
|
41
|
+
notify();
|
|
42
|
+
},
|
|
43
|
+
back() {
|
|
44
|
+
if (typeof window === "undefined") return;
|
|
45
|
+
window.history.back();
|
|
46
|
+
},
|
|
47
|
+
forward() {
|
|
48
|
+
if (typeof window === "undefined") return;
|
|
49
|
+
window.history.forward();
|
|
50
|
+
},
|
|
51
|
+
refresh() {
|
|
52
|
+
if (typeof window === "undefined") return;
|
|
53
|
+
window.location.reload();
|
|
54
|
+
},
|
|
55
|
+
prefetch(_url) {
|
|
56
|
+
},
|
|
57
|
+
subscribe(listener) {
|
|
58
|
+
listeners.add(listener);
|
|
59
|
+
return () => listeners.delete(listener);
|
|
60
|
+
},
|
|
61
|
+
getState() {
|
|
62
|
+
return currentState;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
function useRouter() {
|
|
66
|
+
return router;
|
|
67
|
+
}
|
|
68
|
+
if (typeof window !== "undefined") {
|
|
69
|
+
window.addEventListener("popstate", () => {
|
|
70
|
+
currentState = { ...currentState, pathname: window.location.pathname };
|
|
71
|
+
notify();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function Link({ href, prefetch = false, replace: shouldReplace = false, scroll = true, shallow = false, children, onClick, onMouseEnter, ...rest }) {
|
|
75
|
+
const linkRef = React2.useRef(null);
|
|
76
|
+
const [isPrefetched, setIsPrefetched] = React2.useState(false);
|
|
77
|
+
const handleMouseEnter = (e) => {
|
|
78
|
+
if (prefetch === "hover" && !isPrefetched) {
|
|
79
|
+
router.prefetch(href);
|
|
80
|
+
setIsPrefetched(true);
|
|
81
|
+
}
|
|
82
|
+
onMouseEnter?.(e);
|
|
83
|
+
};
|
|
84
|
+
React2.useEffect(() => {
|
|
85
|
+
if (prefetch === "visible" && linkRef.current && !isPrefetched) {
|
|
86
|
+
const observer = new IntersectionObserver(
|
|
87
|
+
(entries) => {
|
|
88
|
+
if (entries[0].isIntersecting) {
|
|
89
|
+
router.prefetch(href);
|
|
90
|
+
setIsPrefetched(true);
|
|
91
|
+
observer.disconnect();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{ rootMargin: "100px" }
|
|
95
|
+
);
|
|
96
|
+
observer.observe(linkRef.current);
|
|
97
|
+
return () => observer.disconnect();
|
|
98
|
+
}
|
|
99
|
+
}, [href, prefetch, isPrefetched]);
|
|
100
|
+
React2.useEffect(() => {
|
|
101
|
+
if (prefetch === true && !isPrefetched) {
|
|
102
|
+
router.prefetch(href);
|
|
103
|
+
setIsPrefetched(true);
|
|
104
|
+
}
|
|
105
|
+
}, [href, prefetch, isPrefetched]);
|
|
106
|
+
const handleClick = (e) => {
|
|
107
|
+
if (href.startsWith("http") || href.startsWith("//") || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0) {
|
|
108
|
+
onClick?.(e);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
onClick?.(e);
|
|
113
|
+
if (typeof window !== "undefined" && window.__VELIX_DEV_TOOLS__) {
|
|
114
|
+
window.__VELIX_DEV_TOOLS__.setStatus("navigating");
|
|
115
|
+
}
|
|
116
|
+
if (shouldReplace) {
|
|
117
|
+
router.replace(href);
|
|
118
|
+
} else {
|
|
119
|
+
router.push(href);
|
|
120
|
+
}
|
|
121
|
+
if (scroll) {
|
|
122
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return React2.createElement("a", { ref: linkRef, href, onClick: handleClick, onMouseEnter: handleMouseEnter, ...rest }, children);
|
|
126
|
+
}
|
|
127
|
+
async function hydrate() {
|
|
128
|
+
if (typeof window === "undefined") return;
|
|
129
|
+
const { hydrateRoot } = await import("react-dom/client");
|
|
130
|
+
const rootElement = document.getElementById("__velix");
|
|
131
|
+
if (!rootElement) {
|
|
132
|
+
console.warn("[Velix] No #__velix element found for hydration");
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
console.log("[Velix] Hydration complete");
|
|
136
|
+
}
|
|
137
|
+
var client_default = { Link, useRouter, router, hydrate };
|
|
138
|
+
export {
|
|
139
|
+
Link,
|
|
140
|
+
client_default as default,
|
|
141
|
+
hydrate,
|
|
142
|
+
router,
|
|
143
|
+
useParams,
|
|
144
|
+
usePathname,
|
|
145
|
+
useQuery,
|
|
146
|
+
useRouter
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../context.ts","../../client/index.ts"],"sourcesContent":["/**\n * Velix v5 Context System\n * Provides request context and shared state for SSR\n */\n\nimport React from 'react';\n\n// Route context type\ninterface RouteContextType {\n params: Record<string, string>;\n query: Record<string, string>;\n pathname: string;\n}\n\n// Server-side request context\nexport const RequestContext = React.createContext<any>(null);\n\n// Route context for nested routes\nexport const RouteContext = React.createContext<RouteContextType | null>(null);\n\n// Layout context\nexport const LayoutContext = React.createContext<any>(null);\n\n/**\n * Creates a request context value\n */\nexport function createRequestContext(\n req: import('http').IncomingMessage,\n res: import('http').ServerResponse,\n params: Record<string, string> = {},\n query: Record<string, string> = {}\n) {\n return {\n req,\n res,\n params,\n query,\n url: req.url,\n method: req.method,\n headers: req.headers,\n cookies: parseCookies(req.headers.cookie || '')\n };\n}\n\n/**\n * Parse cookies from header string\n */\nfunction parseCookies(cookieHeader: string): Record<string, string> {\n const cookies: Record<string, string> = {};\n if (!cookieHeader) return cookies;\n cookieHeader.split(';').forEach((cookie: string) => {\n const [name, ...rest] = cookie.split('=');\n if (name) cookies[name.trim()] = rest.join('=').trim();\n });\n return cookies;\n}\n\n/**\n * Hook to access request context (server-side only)\n */\nexport function useRequest() {\n const context = React.useContext(RequestContext);\n if (!context) throw new Error('useRequest must be used within a RequestContext provider');\n return context;\n}\n\n/**\n * Hook to access route params\n */\nexport function useParams() {\n const context = React.useContext(RouteContext);\n return context?.params || {};\n}\n\n/**\n * Hook to access query parameters\n */\nexport function useQuery() {\n const context = React.useContext(RouteContext);\n return context?.query || {};\n}\n\n/**\n * Hook to access current pathname\n */\nexport function usePathname() {\n const context = React.useContext(RouteContext);\n return context?.pathname || '/';\n}\n","/**\n * Velix v5 Client Module\n * Client-side navigation, hydration, and the Link component.\n */\n\nexport { useParams, useQuery, usePathname } from '../context.js';\n\n// ============================================================================\n// Client-side Router\n// ============================================================================\n\ninterface RouterState {\n pathname: string;\n query: Record<string, string>;\n params: Record<string, string>;\n}\n\nconst listeners = new Set<() => void>();\nlet currentState: RouterState = {\n pathname: typeof window !== 'undefined' ? window.location.pathname : '/',\n query: {},\n params: {},\n};\n\nfunction notify() {\n listeners.forEach(fn => fn());\n}\n\nexport const router = {\n push(url: string) {\n if (typeof window === 'undefined') return;\n window.history.pushState({}, '', url);\n currentState = { ...currentState, pathname: url.split('?')[0] };\n notify();\n },\n\n replace(url: string) {\n if (typeof window === 'undefined') return;\n window.history.replaceState({}, '', url);\n currentState = { ...currentState, pathname: url.split('?')[0] };\n notify();\n },\n\n back() {\n if (typeof window === 'undefined') return;\n window.history.back();\n },\n\n forward() {\n if (typeof window === 'undefined') return;\n window.history.forward();\n },\n\n refresh() {\n if (typeof window === 'undefined') return;\n window.location.reload();\n },\n\n prefetch(_url: string) {\n // Future: implement prefetching\n },\n\n subscribe(listener: () => void) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n\n getState(): RouterState {\n return currentState;\n },\n};\n\n/**\n * Hook to access the Velix client router\n */\nexport function useRouter() {\n return router;\n}\n\n// Listen for popstate (browser back/forward)\nif (typeof window !== 'undefined') {\n window.addEventListener('popstate', () => {\n currentState = { ...currentState, pathname: window.location.pathname };\n notify();\n });\n}\n\n// ============================================================================\n// Link Component\n// ============================================================================\n\nimport React from 'react';\n\ninterface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n prefetch?: boolean | 'hover' | 'visible';\n replace?: boolean;\n scroll?: boolean;\n shallow?: boolean;\n children: React.ReactNode;\n}\n\n/**\n * Client-side navigation link component\n *\n * @example\n * ```tsx\n * import { Link } from 'velix/client';\n *\n * <Link href=\"/dashboard\">Dashboard</Link>\n * <Link href=\"/blog\" prefetch>Blog</Link>\n * ```\n */\nexport function Link({ href, prefetch = false, replace: shouldReplace = false, scroll = true, shallow = false, children, onClick, onMouseEnter, ...rest }: LinkProps) {\n const linkRef = React.useRef<HTMLAnchorElement>(null);\n const [isPrefetched, setIsPrefetched] = React.useState(false);\n\n // Prefetch on hover\n const handleMouseEnter = (e: React.MouseEvent<HTMLAnchorElement>) => {\n if (prefetch === 'hover' && !isPrefetched) {\n router.prefetch(href);\n setIsPrefetched(true);\n }\n onMouseEnter?.(e);\n };\n\n // Prefetch when visible\n React.useEffect(() => {\n if (prefetch === 'visible' && linkRef.current && !isPrefetched) {\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries[0].isIntersecting) {\n router.prefetch(href);\n setIsPrefetched(true);\n observer.disconnect();\n }\n },\n { rootMargin: '100px' }\n );\n observer.observe(linkRef.current);\n return () => observer.disconnect();\n }\n }, [href, prefetch, isPrefetched]);\n\n // Prefetch immediately\n React.useEffect(() => {\n if (prefetch === true && !isPrefetched) {\n router.prefetch(href);\n setIsPrefetched(true);\n }\n }, [href, prefetch, isPrefetched]);\n\n const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Allow default behavior for external links, ctrl/meta clicks, etc.\n if (\n href.startsWith('http') || href.startsWith('//') ||\n e.ctrlKey || e.metaKey || e.shiftKey || e.altKey ||\n e.button !== 0\n ) {\n onClick?.(e);\n return;\n }\n\n e.preventDefault();\n onClick?.(e);\n\n // Notify DevTools of navigation start\n if (typeof window !== 'undefined' && (window as any).__VELIX_DEV_TOOLS__) {\n (window as any).__VELIX_DEV_TOOLS__.setStatus('navigating');\n }\n\n if (shouldReplace) {\n router.replace(href);\n } else {\n router.push(href);\n }\n\n if (scroll) {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n }\n };\n\n return React.createElement('a', { ref: linkRef, href, onClick: handleClick, onMouseEnter: handleMouseEnter, ...rest }, children);\n}\n\n// ============================================================================\n// Hydration\n// ============================================================================\n\n/**\n * Client entry point for hydrating the app\n */\nexport async function hydrate() {\n if (typeof window === 'undefined') return;\n\n const { hydrateRoot } = await import('react-dom/client');\n const rootElement = document.getElementById('__velix');\n\n if (!rootElement) {\n console.warn('[Velix] No #__velix element found for hydration');\n return;\n }\n\n // Minimal hydration — full implementation is done per-island\n console.log('[Velix] Hydration complete');\n}\n\nexport default { Link, useRouter, router, hydrate };\n"],"mappings":";AAKA,OAAO,WAAW;AAUX,IAAM,iBAAiB,MAAM,cAAmB,IAAI;AAGpD,IAAM,eAAe,MAAM,cAAuC,IAAI;AAGtE,IAAM,gBAAgB,MAAM,cAAmB,IAAI;AAgDnD,SAAS,YAAY;AAC1B,QAAM,UAAU,MAAM,WAAW,YAAY;AAC7C,SAAO,SAAS,UAAU,CAAC;AAC7B;AAKO,SAAS,WAAW;AACzB,QAAM,UAAU,MAAM,WAAW,YAAY;AAC7C,SAAO,SAAS,SAAS,CAAC;AAC5B;AAKO,SAAS,cAAc;AAC5B,QAAM,UAAU,MAAM,WAAW,YAAY;AAC7C,SAAO,SAAS,YAAY;AAC9B;;;ACGA,OAAOA,YAAW;AA1ElB,IAAM,YAAY,oBAAI,IAAgB;AACtC,IAAI,eAA4B;AAAA,EAC9B,UAAU,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW;AAAA,EACrE,OAAO,CAAC;AAAA,EACR,QAAQ,CAAC;AACX;AAEA,SAAS,SAAS;AAChB,YAAU,QAAQ,QAAM,GAAG,CAAC;AAC9B;AAEO,IAAM,SAAS;AAAA,EACpB,KAAK,KAAa;AAChB,QAAI,OAAO,WAAW,YAAa;AACnC,WAAO,QAAQ,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Ac,KAAK,EAAE,KAAK,SAAS,MAAM,SAAS,aAAa,cAAc,kBAAkB,GAAG,KAAK,GAAG,QAAQ;AACjI;AASA,eAAsB,UAAU;AAC9B,MAAI,OAAO,WAAW,YAAa;AAEnC,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,kBAAkB;AACvD,QAAM,cAAc,SAAS,eAAe,SAAS;AAErD,MAAI,CAAC,aAAa;AAChB,YAAQ,KAAK,iDAAiD;AAC9D;AAAA,EACF;AAGA,UAAQ,IAAI,4BAA4B;AAC1C;AAEA,IAAO,iBAAQ,EAAE,MAAM,WAAW,QAAQ,QAAQ;","names":["React"]}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Velix v5 Configuration System
|
|
5
|
+
* Handles loading, validation, and merging of velix.config.ts
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare const VelixConfigSchema: z.ZodObject<{
|
|
9
|
+
app: z.ZodDefault<z.ZodObject<{
|
|
10
|
+
name: z.ZodDefault<z.ZodString>;
|
|
11
|
+
url: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
name: string;
|
|
14
|
+
url?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
url?: string | undefined;
|
|
18
|
+
}>>;
|
|
19
|
+
devtools: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
server: z.ZodDefault<z.ZodObject<{
|
|
21
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
host: z.ZodDefault<z.ZodString>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
port: number;
|
|
25
|
+
host: string;
|
|
26
|
+
}, {
|
|
27
|
+
port?: number | undefined;
|
|
28
|
+
host?: string | undefined;
|
|
29
|
+
}>>;
|
|
30
|
+
routing: z.ZodDefault<z.ZodObject<{
|
|
31
|
+
trailingSlash: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
trailingSlash: boolean;
|
|
34
|
+
}, {
|
|
35
|
+
trailingSlash?: boolean | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
seo: z.ZodDefault<z.ZodObject<{
|
|
38
|
+
sitemap: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
robots: z.ZodDefault<z.ZodBoolean>;
|
|
40
|
+
openGraph: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
sitemap: boolean;
|
|
43
|
+
robots: boolean;
|
|
44
|
+
openGraph: boolean;
|
|
45
|
+
}, {
|
|
46
|
+
sitemap?: boolean | undefined;
|
|
47
|
+
robots?: boolean | undefined;
|
|
48
|
+
openGraph?: boolean | undefined;
|
|
49
|
+
}>>;
|
|
50
|
+
build: z.ZodDefault<z.ZodObject<{
|
|
51
|
+
target: z.ZodDefault<z.ZodString>;
|
|
52
|
+
minify: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
sourcemap: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
splitting: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
target: string;
|
|
58
|
+
minify: boolean;
|
|
59
|
+
sourcemap: boolean;
|
|
60
|
+
splitting: boolean;
|
|
61
|
+
outDir: string;
|
|
62
|
+
}, {
|
|
63
|
+
target?: string | undefined;
|
|
64
|
+
minify?: boolean | undefined;
|
|
65
|
+
sourcemap?: boolean | undefined;
|
|
66
|
+
splitting?: boolean | undefined;
|
|
67
|
+
outDir?: string | undefined;
|
|
68
|
+
}>>;
|
|
69
|
+
experimental: z.ZodDefault<z.ZodObject<{
|
|
70
|
+
islands: z.ZodDefault<z.ZodBoolean>;
|
|
71
|
+
streaming: z.ZodDefault<z.ZodBoolean>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
islands: boolean;
|
|
74
|
+
streaming: boolean;
|
|
75
|
+
}, {
|
|
76
|
+
islands?: boolean | undefined;
|
|
77
|
+
streaming?: boolean | undefined;
|
|
78
|
+
}>>;
|
|
79
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
86
|
+
appDir: z.ZodDefault<z.ZodString>;
|
|
87
|
+
publicDir: z.ZodDefault<z.ZodString>;
|
|
88
|
+
styles: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
89
|
+
favicon: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
app: {
|
|
92
|
+
name: string;
|
|
93
|
+
url?: string | undefined;
|
|
94
|
+
};
|
|
95
|
+
devtools: boolean;
|
|
96
|
+
server: {
|
|
97
|
+
port: number;
|
|
98
|
+
host: string;
|
|
99
|
+
};
|
|
100
|
+
routing: {
|
|
101
|
+
trailingSlash: boolean;
|
|
102
|
+
};
|
|
103
|
+
seo: {
|
|
104
|
+
sitemap: boolean;
|
|
105
|
+
robots: boolean;
|
|
106
|
+
openGraph: boolean;
|
|
107
|
+
};
|
|
108
|
+
build: {
|
|
109
|
+
target: string;
|
|
110
|
+
minify: boolean;
|
|
111
|
+
sourcemap: boolean;
|
|
112
|
+
splitting: boolean;
|
|
113
|
+
outDir: string;
|
|
114
|
+
};
|
|
115
|
+
experimental: {
|
|
116
|
+
islands: boolean;
|
|
117
|
+
streaming: boolean;
|
|
118
|
+
};
|
|
119
|
+
plugins: (string | z.objectOutputType<{
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
}, z.ZodTypeAny, "passthrough">)[];
|
|
122
|
+
appDir: string;
|
|
123
|
+
publicDir: string;
|
|
124
|
+
styles: string[];
|
|
125
|
+
favicon: string | null;
|
|
126
|
+
}, {
|
|
127
|
+
app?: {
|
|
128
|
+
name?: string | undefined;
|
|
129
|
+
url?: string | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
devtools?: boolean | undefined;
|
|
132
|
+
server?: {
|
|
133
|
+
port?: number | undefined;
|
|
134
|
+
host?: string | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
routing?: {
|
|
137
|
+
trailingSlash?: boolean | undefined;
|
|
138
|
+
} | undefined;
|
|
139
|
+
seo?: {
|
|
140
|
+
sitemap?: boolean | undefined;
|
|
141
|
+
robots?: boolean | undefined;
|
|
142
|
+
openGraph?: boolean | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
build?: {
|
|
145
|
+
target?: string | undefined;
|
|
146
|
+
minify?: boolean | undefined;
|
|
147
|
+
sourcemap?: boolean | undefined;
|
|
148
|
+
splitting?: boolean | undefined;
|
|
149
|
+
outDir?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
experimental?: {
|
|
152
|
+
islands?: boolean | undefined;
|
|
153
|
+
streaming?: boolean | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
plugins?: (string | z.objectInputType<{
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
}, z.ZodTypeAny, "passthrough">)[] | undefined;
|
|
158
|
+
appDir?: string | undefined;
|
|
159
|
+
publicDir?: string | undefined;
|
|
160
|
+
styles?: string[] | undefined;
|
|
161
|
+
favicon?: string | null | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
type VelixConfig = z.infer<typeof VelixConfigSchema>;
|
|
164
|
+
declare const defaultConfig: VelixConfig;
|
|
165
|
+
/**
|
|
166
|
+
* Helper function to define configuration with full type support.
|
|
167
|
+
* Use this in your velix.config.ts file.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* import { defineConfig } from "velix";
|
|
172
|
+
*
|
|
173
|
+
* export default defineConfig({
|
|
174
|
+
* app: { name: "My App" },
|
|
175
|
+
* server: { port: 3000 },
|
|
176
|
+
* seo: { sitemap: true }
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare function defineConfig(config: Partial<VelixConfig>): Partial<VelixConfig>;
|
|
181
|
+
/**
|
|
182
|
+
* Loads and validates configuration from velix.config.ts
|
|
183
|
+
*/
|
|
184
|
+
declare function loadConfig(projectRoot: string): Promise<VelixConfig>;
|
|
185
|
+
/**
|
|
186
|
+
* Resolves all paths in config relative to project root
|
|
187
|
+
*/
|
|
188
|
+
declare function resolvePaths(config: VelixConfig, projectRoot: string): VelixConfig & {
|
|
189
|
+
resolvedAppDir: string;
|
|
190
|
+
resolvedPublicDir: string;
|
|
191
|
+
resolvedOutDir: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export { type VelixConfig, VelixConfigSchema, defaultConfig, defineConfig, loadConfig, resolvePaths };
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// config.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { pathToFileURL } from "url";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import pc from "picocolors";
|
|
7
|
+
var AppConfigSchema = z.object({
|
|
8
|
+
name: z.string().default("Velix App"),
|
|
9
|
+
url: z.string().url().optional()
|
|
10
|
+
}).default({});
|
|
11
|
+
var ServerConfigSchema = z.object({
|
|
12
|
+
port: z.number().min(1).max(65535).default(3e3),
|
|
13
|
+
host: z.string().default("localhost")
|
|
14
|
+
}).default({});
|
|
15
|
+
var RoutingConfigSchema = z.object({
|
|
16
|
+
trailingSlash: z.boolean().default(false)
|
|
17
|
+
}).default({});
|
|
18
|
+
var SEOConfigSchema = z.object({
|
|
19
|
+
sitemap: z.boolean().default(true),
|
|
20
|
+
robots: z.boolean().default(true),
|
|
21
|
+
openGraph: z.boolean().default(true)
|
|
22
|
+
}).default({});
|
|
23
|
+
var BuildConfigSchema = z.object({
|
|
24
|
+
target: z.string().default("es2022"),
|
|
25
|
+
minify: z.boolean().default(true),
|
|
26
|
+
sourcemap: z.boolean().default(true),
|
|
27
|
+
splitting: z.boolean().default(true),
|
|
28
|
+
outDir: z.string().default(".velix")
|
|
29
|
+
}).default({});
|
|
30
|
+
var ExperimentalConfigSchema = z.object({
|
|
31
|
+
islands: z.boolean().default(true),
|
|
32
|
+
streaming: z.boolean().default(true)
|
|
33
|
+
}).default({});
|
|
34
|
+
var PluginSchema = z.union([
|
|
35
|
+
z.string(),
|
|
36
|
+
z.object({
|
|
37
|
+
name: z.string()
|
|
38
|
+
}).passthrough()
|
|
39
|
+
]);
|
|
40
|
+
var VelixConfigSchema = z.object({
|
|
41
|
+
// App identity
|
|
42
|
+
app: AppConfigSchema,
|
|
43
|
+
// DevTools toggle
|
|
44
|
+
devtools: z.boolean().default(true),
|
|
45
|
+
// Server options
|
|
46
|
+
server: ServerConfigSchema,
|
|
47
|
+
// Routing options
|
|
48
|
+
routing: RoutingConfigSchema,
|
|
49
|
+
// SEO configuration
|
|
50
|
+
seo: SEOConfigSchema,
|
|
51
|
+
// Build options
|
|
52
|
+
build: BuildConfigSchema,
|
|
53
|
+
// Experimental features
|
|
54
|
+
experimental: ExperimentalConfigSchema,
|
|
55
|
+
// Plugins
|
|
56
|
+
plugins: z.array(PluginSchema).default([]),
|
|
57
|
+
// Directories (resolved automatically)
|
|
58
|
+
appDir: z.string().default("app"),
|
|
59
|
+
publicDir: z.string().default("public"),
|
|
60
|
+
// Stylesheets
|
|
61
|
+
styles: z.array(z.string()).default([]),
|
|
62
|
+
// Favicon
|
|
63
|
+
favicon: z.string().nullable().default(null)
|
|
64
|
+
});
|
|
65
|
+
var defaultConfig = VelixConfigSchema.parse({});
|
|
66
|
+
function defineConfig(config) {
|
|
67
|
+
return config;
|
|
68
|
+
}
|
|
69
|
+
async function loadConfig(projectRoot) {
|
|
70
|
+
const configPathTs = path.join(projectRoot, "velix.config.ts");
|
|
71
|
+
const configPathJs = path.join(projectRoot, "velix.config.js");
|
|
72
|
+
const configPathLegacyTs = path.join(projectRoot, "flexireact.config.ts");
|
|
73
|
+
const configPathLegacyJs = path.join(projectRoot, "flexireact.config.js");
|
|
74
|
+
let configPath = null;
|
|
75
|
+
if (fs.existsSync(configPathTs)) configPath = configPathTs;
|
|
76
|
+
else if (fs.existsSync(configPathJs)) configPath = configPathJs;
|
|
77
|
+
else if (fs.existsSync(configPathLegacyTs)) configPath = configPathLegacyTs;
|
|
78
|
+
else if (fs.existsSync(configPathLegacyJs)) configPath = configPathLegacyJs;
|
|
79
|
+
let userConfig = {};
|
|
80
|
+
if (configPath) {
|
|
81
|
+
try {
|
|
82
|
+
const configUrl = pathToFileURL(configPath).href;
|
|
83
|
+
const module = await import(`${configUrl}?t=${Date.now()}`);
|
|
84
|
+
userConfig = module.default || module;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.warn(pc.yellow(`\u26A0 Failed to load config: ${error.message}`));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const merged = deepMerge(defaultConfig, userConfig);
|
|
90
|
+
try {
|
|
91
|
+
return VelixConfigSchema.parse(merged);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
if (err instanceof z.ZodError) {
|
|
94
|
+
console.error(pc.red("\u2716 Configuration validation failed:"));
|
|
95
|
+
for (const issue of err.issues) {
|
|
96
|
+
console.error(pc.dim(` - ${issue.path.join(".")}: ${issue.message}`));
|
|
97
|
+
}
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function resolvePaths(config, projectRoot) {
|
|
104
|
+
return {
|
|
105
|
+
...config,
|
|
106
|
+
resolvedAppDir: path.resolve(projectRoot, config.appDir),
|
|
107
|
+
resolvedPublicDir: path.resolve(projectRoot, config.publicDir),
|
|
108
|
+
resolvedOutDir: path.resolve(projectRoot, config.build.outDir)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function deepMerge(target, source) {
|
|
112
|
+
const result = { ...target };
|
|
113
|
+
for (const key in source) {
|
|
114
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
115
|
+
result[key] = deepMerge(target[key] || {}, source[key]);
|
|
116
|
+
} else {
|
|
117
|
+
result[key] = source[key];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
VelixConfigSchema,
|
|
124
|
+
defaultConfig,
|
|
125
|
+
defineConfig,
|
|
126
|
+
loadConfig,
|
|
127
|
+
resolvePaths
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../config.ts"],"sourcesContent":["/**\n * Velix v5 Configuration System\n * Handles loading, validation, and merging of velix.config.ts\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { pathToFileURL } from 'url';\nimport { z } from 'zod';\nimport pc from 'picocolors';\n\n// ============================================================================\n// Configuration Schema (Zod validation)\n// ============================================================================\n\nconst AppConfigSchema = z.object({\n name: z.string().default('Velix App'),\n url: z.string().url().optional(),\n}).default({});\n\nconst ServerConfigSchema = z.object({\n port: z.number().min(1).max(65535).default(3000),\n host: z.string().default('localhost'),\n}).default({});\n\nconst RoutingConfigSchema = z.object({\n trailingSlash: z.boolean().default(false),\n}).default({});\n\nconst SEOConfigSchema = z.object({\n sitemap: z.boolean().default(true),\n robots: z.boolean().default(true),\n openGraph: z.boolean().default(true),\n}).default({});\n\nconst BuildConfigSchema = z.object({\n target: z.string().default('es2022'),\n minify: z.boolean().default(true),\n sourcemap: z.boolean().default(true),\n splitting: z.boolean().default(true),\n outDir: z.string().default('.velix'),\n}).default({});\n\nconst ExperimentalConfigSchema = z.object({\n islands: z.boolean().default(true),\n streaming: z.boolean().default(true),\n}).default({});\n\nconst PluginSchema = z.union([\n z.string(),\n z.object({\n name: z.string()\n }).passthrough(),\n]);\n\nexport const VelixConfigSchema = z.object({\n // App identity\n app: AppConfigSchema,\n\n // DevTools toggle\n devtools: z.boolean().default(true),\n\n // Server options\n server: ServerConfigSchema,\n\n // Routing options\n routing: RoutingConfigSchema,\n\n // SEO configuration\n seo: SEOConfigSchema,\n\n // Build options\n build: BuildConfigSchema,\n\n // Experimental features\n experimental: ExperimentalConfigSchema,\n\n // Plugins\n plugins: z.array(PluginSchema).default([]),\n\n // Directories (resolved automatically)\n appDir: z.string().default('app'),\n publicDir: z.string().default('public'),\n\n // Stylesheets\n styles: z.array(z.string()).default([]),\n\n // Favicon\n favicon: z.string().nullable().default(null),\n});\n\nexport type VelixConfig = z.infer<typeof VelixConfigSchema>;\n\n// ============================================================================\n// Default configuration\n// ============================================================================\n\nexport const defaultConfig: VelixConfig = VelixConfigSchema.parse({});\n\n// ============================================================================\n// defineConfig helper\n// ============================================================================\n\n/**\n * Helper function to define configuration with full type support.\n * Use this in your velix.config.ts file.\n *\n * @example\n * ```ts\n * import { defineConfig } from \"velix\";\n *\n * export default defineConfig({\n * app: { name: \"My App\" },\n * server: { port: 3000 },\n * seo: { sitemap: true }\n * });\n * ```\n */\nexport function defineConfig(config: Partial<VelixConfig>): Partial<VelixConfig> {\n return config;\n}\n\n// ============================================================================\n// Config Loader\n// ============================================================================\n\n/**\n * Loads and validates configuration from velix.config.ts\n */\nexport async function loadConfig(projectRoot: string): Promise<VelixConfig> {\n const configPathTs = path.join(projectRoot, 'velix.config.ts');\n const configPathJs = path.join(projectRoot, 'velix.config.js');\n // Support legacy config for migration\n const configPathLegacyTs = path.join(projectRoot, 'flexireact.config.ts');\n const configPathLegacyJs = path.join(projectRoot, 'flexireact.config.js');\n\n let configPath: string | null = null;\n if (fs.existsSync(configPathTs)) configPath = configPathTs;\n else if (fs.existsSync(configPathJs)) configPath = configPathJs;\n else if (fs.existsSync(configPathLegacyTs)) configPath = configPathLegacyTs;\n else if (fs.existsSync(configPathLegacyJs)) configPath = configPathLegacyJs;\n\n let userConfig: Partial<VelixConfig> = {};\n\n if (configPath) {\n try {\n const configUrl = pathToFileURL(configPath).href;\n const module = await import(`${configUrl}?t=${Date.now()}`);\n userConfig = module.default || module;\n } catch (error: any) {\n console.warn(pc.yellow(`⚠ Failed to load config: ${error.message}`));\n }\n }\n\n // Merge and validate with Zod\n const merged = deepMerge(defaultConfig, userConfig as Record<string, any>);\n\n try {\n return VelixConfigSchema.parse(merged);\n } catch (err: unknown) {\n if (err instanceof z.ZodError) {\n console.error(pc.red('✖ Configuration validation failed:'));\n for (const issue of err.issues) {\n console.error(pc.dim(` - ${issue.path.join('.')}: ${issue.message}`));\n }\n process.exit(1);\n }\n throw err;\n }\n}\n\n// ============================================================================\n// Path Resolution\n// ============================================================================\n\n/**\n * Resolves all paths in config relative to project root\n */\nexport function resolvePaths(config: VelixConfig, projectRoot: string): VelixConfig & { resolvedAppDir: string; resolvedPublicDir: string; resolvedOutDir: string } {\n return {\n ...config,\n resolvedAppDir: path.resolve(projectRoot, config.appDir),\n resolvedPublicDir: path.resolve(projectRoot, config.publicDir),\n resolvedOutDir: path.resolve(projectRoot, config.build.outDir),\n };\n}\n\n// ============================================================================\n// Utility: Deep merge\n// ============================================================================\n\nfunction deepMerge(target: Record<string, any>, source: Record<string, any>): Record<string, any> {\n const result = { ...target };\n\n for (const key in source) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n result[key] = deepMerge(target[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n\n return result;\n}\n"],"mappings":";AAKA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,SAAS;AAClB,OAAO,QAAQ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