@teamvelix/velix 5.1.7 → 5.2.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/dist/build/index.js +3 -2
- package/dist/chunk-4S5YQJHB.js +11 -0
- package/dist/chunk-4S5YQJHB.js.map +1 -0
- package/dist/{chunk-CFDPNOWM.js → chunk-DTF3KTLR.js} +82 -31
- package/dist/chunk-DTF3KTLR.js.map +1 -0
- package/dist/{chunk-OIZNYND3.js → chunk-JI2HJFUT.js} +2 -2
- package/dist/chunk-JI2HJFUT.js.map +1 -0
- package/dist/{chunk-X2EZAAQS.js → chunk-QIPVMOXL.js} +4 -4
- package/dist/chunk-QIPVMOXL.js.map +1 -0
- package/dist/{chunk-INOZP2VD.js → chunk-QLFG6PW3.js} +3 -2
- package/dist/chunk-QLFG6PW3.js.map +1 -0
- package/dist/{chunk-SB5DCDTH.js → chunk-XXPHGRLC.js} +3 -3
- package/dist/{chunk-SB5DCDTH.js.map → chunk-XXPHGRLC.js.map} +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +2 -1
- package/dist/config.js +1 -0
- package/dist/{image-optimizer-I6TWWH6W.js → image-optimizer-KPRXE5VI.js} +3 -3
- package/dist/image-optimizer-KPRXE5VI.js.map +1 -0
- package/dist/index-8CqitL9K.d.ts +300 -0
- package/dist/{index-C4udNtpZ.d.ts → index-ChyKLf1W.d.ts} +18 -3
- package/dist/index.d.ts +53 -176
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/islands/index.d.ts +22 -10
- package/dist/islands/index.js +2 -1
- package/dist/runtime/start-build.js +2 -2
- package/dist/runtime/start-build.js.map +1 -1
- package/dist/runtime/start-dev.js +81 -22
- package/dist/runtime/start-dev.js.map +1 -1
- package/dist/runtime/start-prod.js +81 -22
- package/dist/runtime/start-prod.js.map +1 -1
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.js +4 -3
- package/package.json +60 -58
- package/dist/chunk-CFDPNOWM.js.map +0 -1
- package/dist/chunk-INOZP2VD.js.map +0 -1
- package/dist/chunk-OIZNYND3.js.map +0 -1
- package/dist/chunk-X2EZAAQS.js.map +0 -1
- package/dist/image-optimizer-I6TWWH6W.js.map +0 -1
- package/dist/index-DYgxL3mE.d.ts +0 -107
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../build/index.ts","../../config.ts","../../router/index.ts","../../utils.ts","../../version.ts","../../logger.ts","../../runtime/start-build.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';\nimport { VERSION } from '../version.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 treeShaking: true,\n legalComments: 'none',\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 treeShaking: true,\n legalComments: 'none',\n drop: options.minify ?? config.build.minify ? ['console', 'debugger'] : [],\n chunkNames: 'chunks/[name]-[hash]',\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: VERSION,\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 version — single source of truth.\n * Update this file only when releasing a new version.\n */\nexport const VERSION = '5.1.6';\n","/**\n * Velix v5 Logger\n * Minimalist, professional output inspired by modern CLIs\n */\n\nimport { VERSION } from './version.js';\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 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","/**\n * Velix v5 — Build Script\n * Build the application for production\n */\n\nimport { build } from '../build/index.js';\nimport logger from '../logger.js';\n\nbuild().catch(err => {\n logger.error('Build failed', err);\n process.exit(1);\n});\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,EAAE,OAAO;AAAA,EAClC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,QAAQ,GAAI;AAAA,EAC/C,MAAM,EAAE,OAAO,EAAE,QAAQ,WAAW;AACtC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEb,IAAM,sBAAsB,EAAE,OAAO;AAAA,EACnC,eAAe,EAAE,QAAQ,EAAE,QAAQ,KA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AAK,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;;;AM9KA,MAAM,EAAE,MAAM,SAAO;AACnB,iBAAO,MAAM,gBAAgB,GAAG;AAChC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","fs","path","fs","path","fs","path","fs","path","fs","path","path","fs"]}
|
|
1
|
+
{"version":3,"sources":["../../build/index.ts","../../config.ts","../../router/index.ts","../../utils.ts","../../version.ts","../../logger.ts","../../runtime/start-build.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';\nimport { VERSION } from '../version.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 treeShaking: true,\n legalComments: 'none',\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 treeShaking: true,\n legalComments: 'none',\n drop: options.minify ?? config.build.minify ? ['console', 'debugger'] : [],\n chunkNames: 'chunks/[name]-[hash]',\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: VERSION,\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';\nimport type { Route, RouteTree as TypedRouteTree, RouteTreeNode } from '../types.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: Route[];\n api: Route[];\n layouts: Map<string, string>;\n tree: RouteTreeNode;\n appRoutes: Route[];\n rootLayout?: string;\n } = {\n pages: [],\n api: [],\n layouts: new Map(),\n tree: { children: {}, routes: [] },\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: { appRoutes: Route[] },\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: { api: Route[] }, 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: Route[]) {\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: Route, 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: Route[]): RouteTreeNode {\n const tree: RouteTreeNode = { 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: unknown[]) => unknown>(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<T>() {\n let resolve: (value: T | PromiseLike<T>) => void;\n let reject: (reason?: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve!, reject: 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 version — single source of truth.\n * Update this file only when releasing a new version.\n */\nexport const VERSION = '5.1.7';\n","/**\n * Velix v5 Logger\n * Minimalist, professional output inspired by modern CLIs\n */\n\nimport { VERSION } from './version.js';\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 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: { port: number | string; host: string; mode: string; pagesDir?: string }, 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","/**\n * Velix v5 — Build Script\n * Build the application for production\n */\n\nimport { build } from '../build/index.js';\nimport logger from '../logger.js';\n\nbuild().catch(err => {\n logger.error('Build failed', err);\n process.exit(1);\n});\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,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E,eAAe,KAAK,CAAC;AAC3D,aAAW,SAAS,SAAS;AAC3B,UAAM,UAAUD,MAAK,KAAK,KAAK,MAAM,IAAI;AACzC,UAAM,WAAWA,MAAK,KAAK,MAAM,MAAM,IAAI;AAC3C,QAAI,MAAM,YAAY,EAAG,kBAAiB,SAAS,QAAQ;AAAA,QACtD,CAAAC,IAAG,aAAa,SAAS,QAAQ;AAAA,EACxC;AACF;AAEA,SAAS,WAAW,KAAqB;AACvC,MAAI,OAAO;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;;;AM9KA,MAAM,EAAE,MAAM,SAAO;AACnB,iBAAO,MAAM,gBAAgB,GAAG;AAChC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","fs","path","fs","path","fs","path","fs","path","fs","path","path","fs"]}
|
|
@@ -11,9 +11,13 @@ var __export = (target, all) => {
|
|
|
11
11
|
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postc_36112cdf9ab6125b194fc7941daee874/node_modules/tsup/assets/esm_shims.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
|
+
var getFilename, getDirname, __dirname;
|
|
14
15
|
var init_esm_shims = __esm({
|
|
15
16
|
"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postc_36112cdf9ab6125b194fc7941daee874/node_modules/tsup/assets/esm_shims.js"() {
|
|
16
17
|
"use strict";
|
|
18
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
19
|
+
getDirname = () => path.dirname(getFilename());
|
|
20
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
17
21
|
}
|
|
18
22
|
});
|
|
19
23
|
|
|
@@ -273,7 +277,7 @@ function buildRouteTree(appDir) {
|
|
|
273
277
|
pages: [],
|
|
274
278
|
api: [],
|
|
275
279
|
layouts: /* @__PURE__ */ new Map(),
|
|
276
|
-
tree: {},
|
|
280
|
+
tree: { children: {}, routes: [] },
|
|
277
281
|
appRoutes: []
|
|
278
282
|
};
|
|
279
283
|
if (fs3.existsSync(appDir)) {
|
|
@@ -468,7 +472,8 @@ async function loadMiddleware(projectRoot) {
|
|
|
468
472
|
break;
|
|
469
473
|
}
|
|
470
474
|
} catch (err) {
|
|
471
|
-
|
|
475
|
+
const error = err;
|
|
476
|
+
console.warn(`\u26A0 Failed to load proxy ${file}: ${error.message}`);
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
479
|
return fns;
|
|
@@ -645,11 +650,12 @@ async function loadPlugins(projectRoot, config) {
|
|
|
645
650
|
console.warn(`\u26A0 Plugin not found: ${entry}`);
|
|
646
651
|
}
|
|
647
652
|
}
|
|
648
|
-
} else if (typeof entry === "object" && entry
|
|
653
|
+
} else if (typeof entry === "object" && entry !== null && "name" in entry) {
|
|
649
654
|
pluginManager.register(entry);
|
|
650
655
|
}
|
|
651
656
|
} catch (err) {
|
|
652
|
-
|
|
657
|
+
const error = err;
|
|
658
|
+
console.warn(`\u26A0 Failed to load plugin: ${error?.message || String(error)}`);
|
|
653
659
|
}
|
|
654
660
|
}
|
|
655
661
|
}
|
|
@@ -664,10 +670,11 @@ var builtinPlugins = {
|
|
|
664
670
|
name: "velix:security",
|
|
665
671
|
hooks: {
|
|
666
672
|
[PluginHooks.RESPONSE]: (_req, res) => {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
673
|
+
const response = res;
|
|
674
|
+
if (!response.headersSent) {
|
|
675
|
+
response.setHeader("X-Content-Type-Options", "nosniff");
|
|
676
|
+
response.setHeader("X-Frame-Options", "DENY");
|
|
677
|
+
response.setHeader("X-XSS-Protection", "1; mode=block");
|
|
671
678
|
}
|
|
672
679
|
}
|
|
673
680
|
}
|
|
@@ -679,7 +686,8 @@ var builtinPlugins = {
|
|
|
679
686
|
name: "velix:logger",
|
|
680
687
|
hooks: {
|
|
681
688
|
[PluginHooks.RESPONSE]: (req, _res, duration) => {
|
|
682
|
-
|
|
689
|
+
const request = req;
|
|
690
|
+
console.log(` ${request.method} ${request.url} ${duration}ms`);
|
|
683
691
|
}
|
|
684
692
|
}
|
|
685
693
|
})
|
|
@@ -693,7 +701,7 @@ init_esm_shims();
|
|
|
693
701
|
|
|
694
702
|
// version.ts
|
|
695
703
|
init_esm_shims();
|
|
696
|
-
var VERSION = "5.1.
|
|
704
|
+
var VERSION = "5.1.7";
|
|
697
705
|
|
|
698
706
|
// logger.ts
|
|
699
707
|
var colors = {
|
|
@@ -1222,7 +1230,8 @@ async function executeAction(actionId, args, context) {
|
|
|
1222
1230
|
try {
|
|
1223
1231
|
const result = await action(...args);
|
|
1224
1232
|
return { success: true, data: result };
|
|
1225
|
-
} catch (
|
|
1233
|
+
} catch (err) {
|
|
1234
|
+
const error = err;
|
|
1226
1235
|
if (error instanceof RedirectError) return { success: true, redirect: error.url };
|
|
1227
1236
|
if (error instanceof NotFoundError) return { success: false, error: "Not found" };
|
|
1228
1237
|
return { success: false, error: error.message || "Action failed" };
|
|
@@ -2118,6 +2127,14 @@ function generate500Page(options) {
|
|
|
2118
2127
|
}
|
|
2119
2128
|
|
|
2120
2129
|
// server/index.ts
|
|
2130
|
+
import {
|
|
2131
|
+
defineRoute,
|
|
2132
|
+
VelixHttpError,
|
|
2133
|
+
defineLoader,
|
|
2134
|
+
serverAction,
|
|
2135
|
+
buildApiManifest,
|
|
2136
|
+
handleApiRequest
|
|
2137
|
+
} from "@teamvelix/velix-core";
|
|
2121
2138
|
function getProjectVersion(dep, projectRoot) {
|
|
2122
2139
|
try {
|
|
2123
2140
|
const projectRequire = createRequire(pathToFileURL3(path7.join(projectRoot, "package.json")).href);
|
|
@@ -2228,14 +2245,15 @@ async function createServer(options = {}) {
|
|
|
2228
2245
|
res.end(generate404Page(pathname));
|
|
2229
2246
|
if (isDev) logger_default.request(req.method || "GET", pathname, 404, Date.now() - requestStart);
|
|
2230
2247
|
} catch (error) {
|
|
2248
|
+
const err = error;
|
|
2231
2249
|
console.error("Server error:", error);
|
|
2232
2250
|
if (!res.headersSent) {
|
|
2233
2251
|
res.writeHead(500, { "Content-Type": "text/html; charset=utf-8" });
|
|
2234
2252
|
res.end(generate500Page({
|
|
2235
2253
|
statusCode: 500,
|
|
2236
2254
|
title: "Server Error",
|
|
2237
|
-
message:
|
|
2238
|
-
stack: isDev ?
|
|
2255
|
+
message: err.message || "An unexpected error occurred",
|
|
2256
|
+
stack: isDev ? err.stack : void 0,
|
|
2239
2257
|
isDev,
|
|
2240
2258
|
pathname
|
|
2241
2259
|
}));
|
|
@@ -2392,8 +2410,9 @@ async function handleApiRoute(route, req, res, url) {
|
|
|
2392
2410
|
res.end(String(response));
|
|
2393
2411
|
}
|
|
2394
2412
|
} catch (err) {
|
|
2413
|
+
const error = err;
|
|
2395
2414
|
res.writeHead(500, { "Content-Type": "application/json" });
|
|
2396
|
-
res.end(JSON.stringify({ error:
|
|
2415
|
+
res.end(JSON.stringify({ error: error.message }));
|
|
2397
2416
|
}
|
|
2398
2417
|
}
|
|
2399
2418
|
async function handleServerAction(req, res) {
|
|
@@ -2409,8 +2428,9 @@ async function handleServerAction(req, res) {
|
|
|
2409
2428
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
2410
2429
|
res.end(JSON.stringify(result));
|
|
2411
2430
|
} catch (err) {
|
|
2431
|
+
const error = err;
|
|
2412
2432
|
res.writeHead(500, { "Content-Type": "application/json" });
|
|
2413
|
-
res.end(JSON.stringify({ success: false, error:
|
|
2433
|
+
res.end(JSON.stringify({ success: false, error: error.message }));
|
|
2414
2434
|
}
|
|
2415
2435
|
}
|
|
2416
2436
|
async function handlePageRoute(route, routes, req, res, url, config, isDev, projectRoot) {
|
|
@@ -2475,9 +2495,14 @@ async function handlePageRoute(route, routes, req, res, url, config, isDev, proj
|
|
|
2475
2495
|
const headInjectionsHtml = `
|
|
2476
2496
|
${headInjections}
|
|
2477
2497
|
`;
|
|
2498
|
+
const hmrScript = isDev ? `
|
|
2499
|
+
<script type="module">
|
|
2500
|
+
import { initHMRClient, VelixDevOverlay } from '/__velix/hmr-client.js';
|
|
2501
|
+
initHMRClient();
|
|
2502
|
+
</script>` : "";
|
|
2478
2503
|
const bodyInjectionsHtml = `
|
|
2479
2504
|
<div id="__velix-islands"></div>
|
|
2480
|
-
${hydrationScript}${devToolsHtml}
|
|
2505
|
+
${hydrationScript}${devToolsHtml}${hmrScript}
|
|
2481
2506
|
`;
|
|
2482
2507
|
if (finalHtml.includes("<html")) {
|
|
2483
2508
|
const headEnd = finalHtml.lastIndexOf("</head>");
|
|
@@ -2513,13 +2538,14 @@ async function handlePageRoute(route, routes, req, res, url, config, isDev, proj
|
|
|
2513
2538
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
2514
2539
|
res.end(finalHtml);
|
|
2515
2540
|
} catch (err) {
|
|
2516
|
-
|
|
2541
|
+
const error = err;
|
|
2542
|
+
logger_default.error(`Render error: ${route.path}`, error);
|
|
2517
2543
|
res.writeHead(500, { "Content-Type": "text/html; charset=utf-8" });
|
|
2518
2544
|
res.end(generate500Page({
|
|
2519
2545
|
statusCode: 500,
|
|
2520
2546
|
title: "Render Error",
|
|
2521
|
-
message:
|
|
2522
|
-
stack: isDev ?
|
|
2547
|
+
message: error.message || "Failed to render page",
|
|
2548
|
+
stack: isDev ? error.stack : void 0,
|
|
2523
2549
|
isDev,
|
|
2524
2550
|
pathname: route.path
|
|
2525
2551
|
}));
|
|
@@ -2562,6 +2588,38 @@ async function serveVelixInternal(pathname, req, res, projectRoot) {
|
|
|
2562
2588
|
}
|
|
2563
2589
|
return;
|
|
2564
2590
|
}
|
|
2591
|
+
if (pathname === "/__velix/hmr-client.js") {
|
|
2592
|
+
try {
|
|
2593
|
+
const candidates = [
|
|
2594
|
+
path7.join(process.cwd(), "packages", "velix-react", "src", "hmr", "hmr-client.ts"),
|
|
2595
|
+
path7.join(process.cwd(), "node_modules", "@teamvelix", "velix-react", "src", "hmr", "hmr-client.ts"),
|
|
2596
|
+
path7.join(__dirname, "..", "..", "velix-react", "src", "hmr", "hmr-client.ts")
|
|
2597
|
+
];
|
|
2598
|
+
const hmrClientSrc = candidates.find((p) => fs7.existsSync(p));
|
|
2599
|
+
if (!hmrClientSrc) {
|
|
2600
|
+
res.writeHead(404);
|
|
2601
|
+
res.end();
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
const result = await esbuild.build({
|
|
2605
|
+
entryPoints: [hmrClientSrc],
|
|
2606
|
+
bundle: true,
|
|
2607
|
+
format: "esm",
|
|
2608
|
+
platform: "browser",
|
|
2609
|
+
target: ["es2022"],
|
|
2610
|
+
minify: true,
|
|
2611
|
+
write: false
|
|
2612
|
+
});
|
|
2613
|
+
res.writeHead(200, { "Content-Type": "application/javascript", "Cache-Control": "no-cache" });
|
|
2614
|
+
res.end(result.outputFiles[0].text);
|
|
2615
|
+
return;
|
|
2616
|
+
} catch (err) {
|
|
2617
|
+
console.error("HMR Client build failed", err);
|
|
2618
|
+
res.writeHead(500);
|
|
2619
|
+
res.end();
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2565
2623
|
if (pathname.startsWith("/__velix/islands/") && pathname.endsWith(".js")) {
|
|
2566
2624
|
const componentName = pathname.replace("/__velix/islands/", "").replace(".js", "");
|
|
2567
2625
|
try {
|
|
@@ -2602,9 +2660,10 @@ async function serveVelixInternal(pathname, req, res, projectRoot) {
|
|
|
2602
2660
|
res.end(result.outputFiles[0].text);
|
|
2603
2661
|
return;
|
|
2604
2662
|
} catch (err) {
|
|
2605
|
-
|
|
2663
|
+
const error = err;
|
|
2664
|
+
logger_default.error(`Island bundling failed: ${componentName}`, error);
|
|
2606
2665
|
res.writeHead(500);
|
|
2607
|
-
res.end(`console.error("Island bundling failed: ${
|
|
2666
|
+
res.end(`console.error("Island bundling failed: ${error.message}");`);
|
|
2608
2667
|
return;
|
|
2609
2668
|
}
|
|
2610
2669
|
}
|
|
@@ -2629,7 +2688,7 @@ async function serveVelixInternal(pathname, req, res, projectRoot) {
|
|
|
2629
2688
|
return;
|
|
2630
2689
|
}
|
|
2631
2690
|
}
|
|
2632
|
-
res.writeHead(404);
|
|
2691
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
2633
2692
|
res.end("Not found");
|
|
2634
2693
|
}
|
|
2635
2694
|
function parseRequestBody(req) {
|