reroute-js 0.0.5 → 0.0.7

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/cli/bin.js.map CHANGED
@@ -1,15 +1,28 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../packages/cli/src/commands/init.ts", "../../packages/cli/src/commands/build.ts", "../../packages/cli/src/commands/dev.ts", "../../packages/cli/src/libs/tailwind.ts", "../../packages/cli/src/commands/gen.ts", "../../packages/cli/src/index.ts"],
3
+ "sources": ["../../packages/cli/src/commands/init.ts", "../../packages/cli/src/commands/build.ts", "../../packages/cli/src/commands/dev.ts", "../../packages/core/src/bundler/index.ts", "../../packages/core/src/content/discovery.ts", "../../packages/core/src/content/index.ts", "../../packages/core/src/ssr/seed.ts", "../../packages/core/src/ssr/data.ts", "../../node_modules/dedent/dist/dedent.mjs", "../../packages/core/src/template/index.ts", "../../packages/core/src/ssr/render.ts", "../../packages/core/src/ssr/index.ts", "../../packages/core/src/tailwind.ts", "../../packages/core/src/utils/index.ts", "../../packages/core/src/index.ts", "../../packages/core/index.ts", "../../packages/cli/src/libs/tailwind.ts", "../../packages/cli/src/commands/gen.ts", "../../packages/cli/src/index.ts"],
4
4
  "sourcesContent": [
5
5
  "#!/usr/bin/env bun\n\n/**\n * Reroute init command\n *\n * Scaffold a new Reroute project with templates\n */\n\nimport { existsSync } from 'node:fs';\nimport { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\ninterface InitOptions {\n\tprojectName: string;\n\ttemplate: 'basic' | 'blog';\n}\n\nexport default async function init(args: string[]) {\n\tconst options = parseArgs(args);\n\n\tif (!options) {\n\t\tprintHelp();\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tawait scaffoldProject(options);\n\t} catch (error) {\n\t\tconsole.error('Error scaffolding project:', error);\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction parseArgs(args: string[]): InitOptions | null {\n\tif (args.length === 0 || args[0] === '--help' || args[0] === '-h') {\n\t\treturn null;\n\t}\n\n\tconst projectName = args[0];\n\n\tif (!projectName || projectName.startsWith('-')) {\n\t\tconsole.error('Error: Project name is required');\n\t\treturn null;\n\t}\n\n\t// Validate project name\n\tif (!/^[a-z0-9-_]+$/i.test(projectName)) {\n\t\tconsole.error(\n\t\t\t'Error: Project name can only contain letters, numbers, hyphens, and underscores',\n\t\t);\n\t\treturn null;\n\t}\n\n\tlet template: 'basic' | 'blog' = 'basic';\n\n\t// Parse template flag\n\tconst templateIndex = args.indexOf('--template');\n\tif (templateIndex !== -1 && args[templateIndex + 1]) {\n\t\tconst templateArg = args[templateIndex + 1];\n\t\tif (templateArg === 'basic' || templateArg === 'blog') {\n\t\t\ttemplate = templateArg;\n\t\t} else {\n\t\t\tconsole.error(\n\t\t\t\t`Error: Unknown template \"${templateArg}\". Available templates: basic, blog`,\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn { projectName, template };\n}\n\nasync function scaffoldProject(options: InitOptions) {\n\tconst { projectName, template } = options;\n\tconst projectPath = join(process.cwd(), projectName);\n\n\t// Check if directory already exists\n\tif (existsSync(projectPath)) {\n\t\tconsole.error(`Error: Directory \"${projectName}\" already exists`);\n\t\tprocess.exit(1);\n\t}\n\n\tconsole.log(`\\nšŸš€ Creating new Reroute project: ${projectName}`);\n\tconsole.log(`šŸ“¦ Template: ${template}\\n`);\n\n\t// Get template directory path\n\tconst templatePath = join(import.meta.dir, '..', '_', template);\n\n\tif (!existsSync(templatePath)) {\n\t\tconsole.error(`Error: Template directory not found at ${templatePath}`);\n\t\tprocess.exit(1);\n\t}\n\n\t// Create project directory\n\tawait mkdir(projectPath, { recursive: true });\n\n\t// Copy template files\n\tawait copyTemplateFiles(templatePath, projectPath, {\n\t\tPROJECT_NAME: projectName,\n\t});\n\n\t// Run bun install\n\tconsole.log('šŸ“„ Installing dependencies...\\n');\n\tconst proc = Bun.spawn(['bun', 'install'], {\n\t\tcwd: projectPath,\n\t\tstdout: 'inherit',\n\t\tstderr: 'inherit',\n\t});\n\n\tawait proc.exited;\n\n\t// Print success message\n\tprintSuccess(projectName, template);\n}\n\nasync function copyTemplateFiles(\n\ttemplatePath: string,\n\ttargetPath: string,\n\tvariables: Record<string, string>,\n) {\n\tconst entries = await readdir(templatePath, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tconst sourcePath = join(templatePath, entry.name);\n\t\tconst destPath = join(targetPath, entry.name);\n\n\t\tif (entry.isDirectory()) {\n\t\t\t// Create directory and recurse\n\t\t\tawait mkdir(destPath, { recursive: true });\n\t\t\tawait copyTemplateFiles(sourcePath, destPath, variables);\n\t\t} else if (entry.isFile()) {\n\t\t\t// Read file content\n\t\t\tconst content = await readFile(sourcePath, 'utf-8');\n\n\t\t\t// Replace variables in content\n\t\t\tlet processedContent = content;\n\t\t\tfor (const [key, value] of Object.entries(variables)) {\n\t\t\t\tconst placeholder = `{{${key}}}`;\n\t\t\t\tprocessedContent = processedContent.split(placeholder).join(value);\n\t\t\t}\n\n\t\t\t// Write file\n\t\t\tawait writeFile(destPath, processedContent);\n\t\t}\n\t}\n}\n\nfunction printSuccess(projectName: string, template: string) {\n\tconsole.log('\\n[āœ“] Project created successfully!\\n');\n\tconsole.log('Next steps:\\n');\n\tconsole.log(` cd ${projectName}`);\n\tconsole.log(' bun dev\\n');\n\tconsole.log('Your app will be running at http://localhost:3000\\n');\n\tconsole.log('Project structure:');\n\tconsole.log(' src/');\n\tconsole.log(' |-- index.ts # Server entry point');\n\tconsole.log(' +-- client/');\n\tconsole.log(' |-- App.tsx # Root React component');\n\tconsole.log(' |-- index.tsx # Client entry point');\n\tconsole.log(' |-- index.html # HTML template');\n\tconsole.log(' |-- routes/ # File-based routes');\n\tif (template === 'blog') {\n\t\tconsole.log(' | |-- blog/');\n\t\tconsole.log(' | | |-- content/ # Blog posts');\n\t\tconsole.log(' | | |-- [slug].tsx');\n\t\tconsole.log(' | | +-- index.tsx');\n\t}\n\tconsole.log(' | |-- index.tsx');\n\tconsole.log(' | +-- about.tsx');\n\tconsole.log(' +-- components/ # React components\\n');\n\tconsole.log('Learn more at https://github.com/stewones/reroute');\n}\n\nfunction printHelp() {\n\tconsole.log('reroute init - Scaffold a new Reroute project');\n\tconsole.log('');\n\tconsole.log('Usage:');\n\tconsole.log(' reroute init <project-name> [options]');\n\tconsole.log('');\n\tconsole.log('Options:');\n\tconsole.log(' --template <name> Template to use (basic, blog)');\n\tconsole.log(' -h, --help Show help');\n\tconsole.log('');\n\tconsole.log('Examples:');\n\tconsole.log(' reroute init my-app');\n\tconsole.log(' reroute init my-blog --template blog');\n}\n",
6
6
  "#!/usr/bin/env bun\n\n/**\n * Reroute build command\n *\n * Build your Reroute application for production\n */\n\nexport default async function build(_args: string[]) {\n\tconsole.log('reroute build - Coming Soon');\n\tconsole.log('');\n\tconsole.log(\n\t\t'This command will build your Reroute application for production.',\n\t);\n\tconsole.log('');\n\tconsole.log('Planned usage:');\n\tconsole.log(' reroute build');\n\tconsole.log(' reroute build --minify');\n\tconsole.log(' reroute build --analyze');\n\tconsole.log('');\n\tconsole.log(\n\t\t'For now, please use your own build setup or check the examples.',\n\t);\n}\n",
7
7
  "#!/usr/bin/env bun\n\n/**\n * Reroute dev command\n *\n * Start a development server with live reload\n */\n\nexport default async function dev(_args: string[]) {\n\tconsole.log('reroute dev - Coming Soon');\n\tconsole.log('');\n\tconsole.log('This command will start a development server with live reload.');\n\tconsole.log('');\n\tconsole.log('Planned usage:');\n\tconsole.log(' reroute dev');\n\tconsole.log(' reroute dev --port 3000');\n\tconsole.log(' reroute dev --host 0.0.0.0');\n\tconsole.log('');\n\tconsole.log('Note: dev already generates content registry and static assets');\n\tconsole.log('');\n\tconsole.log(\n\t\t'For now, please use your own dev server setup or check the examples.',\n\t);\n}\n",
8
- "#!/usr/bin/env bun\n\n/**\n * Tailwind CSS v4 integration utility\n *\n * Manages Tailwind CLI integration for the Reroute framework\n */\n\nimport type { ChildProcess } from 'node:child_process';\nimport { spawn } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\ninterface TailwindProcess {\n\tprocess: ChildProcess;\n\tstop: () => void;\n}\n\n/**\n * Check if Tailwind CSS v4 is available in the project\n */\nfunction isTailwindAvailable(cwd: string): boolean {\n\tconst packageJsonPath = join(cwd, 'package.json');\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\n\t\treturn '@tailwindcss/cli' in deps;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Get the default paths for Tailwind CSS\n */\nfunction getTailwindPaths(cwd: string) {\n\tconst input = join(cwd, 'src/client/theme.css');\n\tconst output = join(cwd, '.reroute/theme.css');\n\n\treturn { input, output };\n}\n\n/**\n * Check if Tailwind input file exists and uses v4 format\n */\nfunction hasTailwindInput(cwd: string): boolean {\n\tconst { input } = getTailwindPaths(cwd);\n\n\tif (!existsSync(input)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(input, 'utf-8');\n\t\t// v4 uses @import \"tailwindcss\"\n\t\treturn content.includes('@import \"tailwindcss\"');\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction resolveTailwindBin(cwd: string): string {\n\t// Try to find tailwindcss binary, checking up to 3 levels up\n\tconst pathsToTry = [\n\t\tjoin(cwd, 'node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../../node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../../../node_modules/.bin/tailwindcss'),\n\t];\n\n\tfor (const binPath of pathsToTry) {\n\t\tif (existsSync(binPath)) {\n\t\t\treturn binPath;\n\t\t}\n\t}\n\n\t// Fallback to the default location if none found\n\treturn join(cwd, 'node_modules/.bin/tailwindcss');\n}\n\n/**\n * Build Tailwind CSS using the Tailwind CLI\n */\nexport async function buildTailwind(cwd: string): Promise<void> {\n\tconst { input, output } = getTailwindPaths(cwd);\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst tailwindBin = resolveTailwindBin(cwd);\n\t\tconst args = ['-i', input, '-o', output];\n\n\t\tconst tailwind = spawn(tailwindBin, args, {\n\t\t\tcwd,\n\t\t\tstdio: 'inherit',\n\t\t});\n\n\t\ttailwind.on('close', (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\treject(new Error(`Tailwind CSS build failed with code ${code}`));\n\t\t\t}\n\t\t});\n\n\t\ttailwind.on('error', (error) => {\n\t\t\treject(error);\n\t\t});\n\t});\n}\n\n/**\n * Start Tailwind CSS in watch mode\n */\nfunction watchTailwind(cwd: string): TailwindProcess {\n\tconst { input, output } = getTailwindPaths(cwd);\n\n\tconst tailwindBin = resolveTailwindBin(cwd);\n\tconst args = ['-i', input, '-o', output, '--watch'];\n\n\tconsole.log('[reroute/tailwind] Starting Tailwind CSS v4 in watch mode...');\n\n\tconst tailwind = spawn(tailwindBin, args, {\n\t\tcwd,\n\t\tstdio: 'inherit',\n\t});\n\n\ttailwind.on('error', (error) => {\n\t\tconsole.error('[reroute/tailwind] Error:', error);\n\t});\n\n\tconst stop = () => {\n\t\tconsole.log('[reroute/tailwind] Stopping Tailwind CSS...');\n\t\ttailwind.kill();\n\t};\n\n\treturn {\n\t\tprocess: tailwind,\n\t\tstop,\n\t};\n}\n\n/**\n * Initialize Tailwind CSS integration\n * Returns null if Tailwind is not available or configured\n */\nexport function initTailwind(\n\tcwd: string,\n\twatch = false,\n): TailwindProcess | null {\n\t// Check if Tailwind is installed\n\tif (!isTailwindAvailable(cwd)) {\n\t\treturn null;\n\t}\n\n\t// Check if input file exists and uses v4 format\n\tif (!hasTailwindInput(cwd)) {\n\t\tconsole.log(\n\t\t\t'[reroute/tailwind] theme.css not found or missing @import \"tailwindcss\", skipping...',\n\t\t);\n\t\treturn null;\n\t}\n\n\tconsole.log('[reroute/tailwind] Detected Tailwind CSS v4');\n\n\tif (watch) {\n\t\treturn watchTailwind(cwd);\n\t}\n\n\t// For non-watch mode, build once and return null\n\tbuildTailwind(cwd)\n\t\t.then(() => {\n\t\t\tconsole.log('[reroute/tailwind] Built successfully');\n\t\t})\n\t\t.catch((error) => {\n\t\t\tconsole.error('[reroute/tailwind] Build failed:', error);\n\t\t});\n\n\treturn null;\n}\n",
9
- "#!/usr/bin/env bun\nimport { watch } from 'node:fs';\nimport { mkdir, readdir, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { buildTailwind, initTailwind } from '../libs/tailwind';\n\n// biome-ignore lint/suspicious/noExplicitAny: flexible content meta type\ntype Doc = any;\n\ninterface RouteFile {\n\tpath: string;\n\tpattern: string;\n\tfilePath: string;\n\tisLayout: boolean;\n\tisDynamic: boolean;\n\tparams: string[];\n\t/** special case for [404].tsx */\n\tisNotFound?: boolean;\n\t/** when isNotFound, this is the base pattern to match as a prefix */\n\tnotFoundBasePattern?: string;\n}\n\ninterface RouteTree {\n\troutes: RouteFile[];\n\tlayouts: RouteFile[];\n\tnotFoundRoutes: RouteFile[];\n}\n\nconst ROUTES_DIR = 'src/client/routes';\nconst OUTPUT_DIR = '.reroute';\nconst OUTPUT_ROUTES = '.reroute/routes.ts';\nconst OUTPUT_CONTENT_TS = '.reroute/content.ts';\nconst OUTPUT_COLLECTIONS_DIR = '.reroute/collections';\nconst OUTPUT_INDEX = '.reroute/index.ts';\n\nasync function cleanupOutputDir(cwd: string) {\n\tconst outputPath = join(cwd, OUTPUT_DIR);\n\ttry {\n\t\tawait rm(outputPath, { recursive: true, force: true });\n\t\tconsole.log(`[reroute/gen] Cleaned up ${outputPath}`);\n\t} catch {\n\t\t// Directory might not exist, which is fine\n\t}\n}\n\nasync function scanDirectory(dir: string, base = ''): Promise<string[]> {\n\tconst files: string[] = [];\n\tconst entries = await readdir(dir, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tconst fullPath = join(dir, entry.name);\n\t\tconst relativePath = join(base, entry.name);\n\n\t\tif (entry.isDirectory()) {\n\t\t\t// Skip content directories; those are not routes\n\t\t\tif (entry.name === 'content') continue;\n\t\t\tconst nested = await scanDirectory(fullPath, relativePath);\n\t\t\tfiles.push(...nested);\n\t\t} else if (\n\t\t\tentry.isFile() &&\n\t\t\t(entry.name.endsWith('.tsx') || entry.name.endsWith('.ts'))\n\t\t) {\n\t\t\t// Skip non-route files and any files under a content/ segment\n\t\t\tif (\n\t\t\t\trelativePath.includes('/content/') ||\n\t\t\t\trelativePath.startsWith('content/')\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.name.startsWith('_') || entry.name === '[layout].tsx') {\n\t\t\t\tfiles.push(relativePath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn files;\n}\n\n// Recursively scan for [404].tsx or [404].ts anywhere under routes, including content dirs\nasync function scan404Files(dir: string, base = ''): Promise<string[]> {\n\tconst files: string[] = [];\n\tconst entries = await readdir(dir, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tconst fullPath = join(dir, entry.name);\n\t\tconst relativePath = join(base, entry.name);\n\t\tif (entry.isDirectory()) {\n\t\t\tconst nested = await scan404Files(fullPath, relativePath);\n\t\t\tfiles.push(...nested);\n\t\t} else if (entry.isFile()) {\n\t\t\tif (/^\\[404]\\.(tsx|ts)$/.test(entry.name)) files.push(relativePath);\n\t\t}\n\t}\n\treturn files;\n}\n\nfunction fileToRoute(filePath: string): RouteFile {\n\tconst isLayout =\n\t\tfilePath.endsWith('[layout].tsx') || filePath.endsWith('[layout].ts');\n\n\t// Remove extension\n\tlet routePath = filePath.replace(/\\.(tsx|ts)$/, '');\n\n\t// Handle layouts\n\tif (isLayout) {\n\t\troutePath = routePath.replace(/[layout]$/, '').replace(/\\/$/, '');\n\t}\n\n\t// Convert index to /\n\troutePath = routePath.replace(/\\/index$/, '').replace(/^index$/, '');\n\n\t// Extract params from [param] syntax\n\tconst params: string[] = [];\n\tconst pattern = routePath.replace(/\\[([^\\]]+)\\]/g, (_, param) => {\n\t\tparams.push(param);\n\t\treturn `:${param}`;\n\t});\n\n\t// Ensure leading slash\n\tconst normalizedPattern = pattern === '' ? '/' : `/${pattern}`;\n\n\t// Special case: [404].tsx files act as NotFound entries for their directory\n\tconst isNotFound = /(^|\\/)\\[404\\]$/.test(routePath);\n\tlet notFoundBasePattern: string | undefined;\n\tif (isNotFound) {\n\t\tconst base = routePath.replace(/(^|\\/)\\[404\\]$/, '').replace(/\\/$/, '');\n\t\tnotFoundBasePattern = base ? `/${base}` : '/';\n\t}\n\n\treturn {\n\t\tpath: routePath,\n\t\tpattern: normalizedPattern,\n\t\tfilePath,\n\t\tisLayout,\n\t\tisDynamic: params.length > 0,\n\t\tparams,\n\t\tisNotFound,\n\t\tnotFoundBasePattern,\n\t};\n}\n\nfunction sortRoutes(routes: RouteFile[]): RouteFile[] {\n\t// Sort by specificity: static routes first, then dynamic, then catch-all\n\treturn routes.sort((a, b) => {\n\t\tconst aDepth = a.pattern.split('/').length;\n\t\tconst bDepth = b.pattern.split('/').length;\n\n\t\t// Deeper routes first\n\t\tif (aDepth !== bDepth) return bDepth - aDepth;\n\n\t\t// Static before dynamic\n\t\tif (!a.isDynamic && b.isDynamic) return -1;\n\t\tif (a.isDynamic && !b.isDynamic) return 1;\n\n\t\t// Alphabetical\n\t\treturn a.pattern.localeCompare(b.pattern);\n\t});\n}\n\nfunction generateRouteTree(files: string[]): RouteTree {\n\tconst routes: RouteFile[] = [];\n\tconst layouts: RouteFile[] = [];\n\tconst notFoundRoutes: RouteFile[] = [];\n\n\tfor (const file of files) {\n\t\tconst route = fileToRoute(file);\n\t\tif (route.isLayout) {\n\t\t\tlayouts.push(route);\n\t\t} else if (route.isNotFound) {\n\t\t\t// Do not include [404] as a normal route; store separately\n\t\t\tnotFoundRoutes.push(route);\n\t\t} else {\n\t\t\troutes.push(route);\n\t\t}\n\t}\n\n\treturn {\n\t\troutes: sortRoutes(routes),\n\t\tlayouts,\n\t\tnotFoundRoutes: notFoundRoutes,\n\t};\n}\n\nfunction generateTypeScript(tree: RouteTree): string {\n\t// Import only default exports so optional named exports like\n\t// `ssr` and `meta` can be tree-shaken from the client bundle.\n\tconst imports = [\n\t\t...tree.routes.map(\n\t\t\t(r, i) =>\n\t\t\t\t`import Route${i} from '../src/client/routes/${r.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t\t...tree.layouts.map(\n\t\t\t(l, i) =>\n\t\t\t\t`import Layout${i} from '../src/client/routes/${l.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t\t...tree.notFoundRoutes.map(\n\t\t\t(nf, i) =>\n\t\t\t\t`import NotFound${i} from '../src/client/routes/${nf.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t].join('\\n');\n\n\tconst routesArray = tree.routes\n\t\t.map((r, i) => {\n\t\t\treturn ` {\n pattern: \"${r.pattern}\",\n path: \"${r.path}\",\n component: Route${i},\n params: ${JSON.stringify(r.params)},\n isDynamic: ${r.isDynamic},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\tconst routePatterns = tree.routes.map((r) => ` | \"${r.pattern}\"`).join('\\n');\n\n\tconst routeParamsUnion = tree.routes\n\t\t.filter((r) => r.isDynamic)\n\t\t.map((r) => {\n\t\t\tconst params = r.params.map((p) => `${p}: string`).join('; ');\n\t\t\treturn ` T extends \"${r.pattern}\" ? { ${params} } :`;\n\t\t})\n\t\t.join('\\n');\n\n\tconst layoutsArray = tree.layouts\n\t\t.map((l, i) => {\n\t\t\treturn ` {\n pattern: \"${l.pattern}\",\n path: \"${l.path}\",\n component: Layout${i},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\tconst notFoundRoutesArray = tree.notFoundRoutes\n\t\t.map((nf, i) => {\n\t\t\treturn ` {\n pattern: \"${nf.notFoundBasePattern || '/'}\",\n path: \"${nf.path}\",\n component: NotFound${i},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\treturn `// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨\n/* eslint-disable */\n// @ts-nocheck\n\n${imports}\n\nexport const routes: RouteInfo = [\n${routesArray}\n] as const;\n\nexport const layouts = [\n${layoutsArray || ''}\n] as const;\n\nexport const notFoundRoutes = [\n${notFoundRoutesArray || ''}\n] as const;\n\nexport type RoutePath =\n${routePatterns || ' | \"/\"'};\n\nexport type RouteParams<T extends RoutePath> = ${\n\t\trouteParamsUnion\n\t\t\t? `\\n${routeParamsUnion}\\n Record<string, never>;`\n\t\t\t: 'Record<string, never>;'\n\t}\n\nexport interface Route {\n pattern: string;\n path: string;\n component: any;\n params: string[];\n isDynamic: boolean;\n}\n\nexport function matchRoute(pathname: string): { route: Route; params: Record<string, string> } | null {\n for (const route of routes) {\n const match = matchPattern(route.pattern, pathname);\n if (match) {\n return { route, params: match };\n }\n }\n return null;\n}\n\nfunction matchPattern(pattern: string, pathname: string): Record<string, string> | null {\n const patternParts = pattern.split('/').filter(Boolean);\n const pathnameParts = pathname.split('/').filter(Boolean);\n\n if (patternParts.length !== pathnameParts.length) {\n return null;\n }\n\n const params: Record<string, string> = {};\n\n for (let i = 0; i < patternParts.length; i++) {\n const patternPart = patternParts[i];\n const pathnamePart = pathnameParts[i];\n\n if (patternPart.startsWith(':')) {\n params[patternPart.slice(1)] = pathnamePart;\n } else if (patternPart !== pathnamePart) {\n return null;\n }\n }\n\n return params;\n}\n`;\n}\n\nasync function listContentFiles(collectionDir: string): Promise<string[]> {\n\ttry {\n\t\tconst entries = await readdir(collectionDir, { withFileTypes: true });\n\t\treturn entries\n\t\t\t.filter(\n\t\t\t\t(e) =>\n\t\t\t\t\te.isFile() && /\\.(tsx|ts)$/.test(e.name) && !e.name.startsWith('_'),\n\t\t\t)\n\t\t\t.map((e) => e.name);\n\t} catch {\n\t\treturn [];\n\t}\n}\n\nasync function sha8(text: string): Promise<string> {\n\tconst data = new TextEncoder().encode(text);\n\tconst buf = await crypto.subtle.digest('SHA-256', data);\n\tlet hex = '';\n\tfor (const b of new Uint8Array(buf)) hex += b.toString(16).padStart(2, '0');\n\treturn hex.slice(0, 8);\n}\n\nasync function buildContentChunks(cwd: string) {\n\tconst routesRoot = join(cwd, ROUTES_DIR);\n\tconsole.log(`[reroute/content] scan ${routesRoot}`);\n\t// Find any '<collection>/content/*.(ts|tsx)'\n\tconst collections = await readdir(routesRoot, { withFileTypes: true });\n\tconst results: Array<{\n\t\tcollection: string;\n\t\tname: string;\n\t\tslug: string;\n\t\thref: string;\n\t\tmoduleUrl: string;\n\t\tmeta: Doc;\n\t}> = [];\n\n\tfor (const c of collections) {\n\t\tif (!c.isDirectory()) continue;\n\t\tconst collection = c.name;\n\t\tconst contentDir = join(routesRoot, collection, 'content');\n\t\tconsole.log(`[reroute/content] collection ${collection} dir ${contentDir}`);\n\t\tconst files = await listContentFiles(contentDir);\n\t\tconsole.log(`[reroute/content] files ${files.join(',')}`);\n\t\tif (!files.length) continue;\n\n\t\tfor (const file of files) {\n\t\t\tconst name = file.replace(/\\.(tsx|ts)$/, '');\n\t\t\tconst absSrc = join(contentDir, file);\n\t\t\t// Build to JS once (no minify) for dev reliability\n\t\t\tlet code = '';\n\t\t\ttry {\n\t\t\t\tconsole.log(`[reroute/content] build ${absSrc}`);\n\t\t\t\tconst result = await Bun.build({\n\t\t\t\t\tentrypoints: [absSrc],\n\t\t\t\t\ttarget: 'browser',\n\t\t\t\t\tformat: 'esm',\n\t\t\t\t\tsplitting: false,\n\t\t\t\t\tsourcemap: 'none',\n\t\t\t\t\tminify: false,\n\t\t\t\t\tdefine: { 'process.env.NODE_ENV': '\"production\"' },\n\t\t\t\t});\n\t\t\t\tif (!result.success) throw new Error('build failed');\n\t\t\t\tcode = await result.outputs[0].text();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'[reroute/gen] Failed to build content chunk:',\n\t\t\t\t\tabsSrc,\n\t\t\t\t\te,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst hash = await sha8(code);\n\t\t\tconst chunkRelDir = join('.reroute', 'chunks', collection);\n\t\t\tconst chunkAbsDir = join(cwd, chunkRelDir);\n\t\t\tconst outFile = `${name}.${hash}.js`;\n\t\t\tconst absOut = join(chunkAbsDir, outFile);\n\t\t\tawait mkdir(chunkAbsDir, { recursive: true });\n\t\t\ttry {\n\t\t\t\tconst exists = await Bun.file(absOut).exists();\n\t\t\t\tif (!exists) await writeFile(absOut, code, 'utf-8');\n\t\t\t} catch {}\n\n\t\t\t// Meta via source import (not bundled)\n\t\t\tlet meta: Doc = {};\n\t\t\ttry {\n\t\t\t\tconsole.log(`[reroute/content] meta ${absSrc}`);\n\t\t\t\tconst url = `${pathToFileURL(absSrc).href}?t=${Date.now()}`;\n\t\t\t\tconst m = await import(url);\n\t\t\t\tmeta = (m as Doc).meta || {};\n\t\t\t} catch {}\n\n\t\t\tresults.push({\n\t\t\t\tcollection,\n\t\t\t\tname,\n\t\t\t\tslug: name,\n\t\t\t\thref: `/${collection}/${name}`,\n\t\t\t\tmoduleUrl: (\n\t\t\t\t\t'/' +\n\t\t\t\t\tchunkRelDir.replace(/\\\\/g, '/') +\n\t\t\t\t\t'/' +\n\t\t\t\t\toutFile\n\t\t\t\t).replace(/\\\\+/g, '/'),\n\t\t\t\tmeta,\n\t\t\t});\n\t\t}\n\t}\n\n\t// Write .reroute/content.ts (types for tooling only)\n\tconst lines: string[] = [];\n\tlines.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\tlines.push('/* eslint-disable */');\n\tlines.push('// @ts-nocheck');\n\tlines.push('');\n\tlines.push('export const contents = [');\n\tfor (const e of results) {\n\t\tlines.push(\n\t\t\t\" { collection: '\" +\n\t\t\t\te.collection +\n\t\t\t\t\"', slug: '\" +\n\t\t\t\te.slug +\n\t\t\t\t\"', name: '\" +\n\t\t\t\te.name +\n\t\t\t\t\"', href: '\" +\n\t\t\t\te.href +\n\t\t\t\t\"', module: '\" +\n\t\t\t\te.moduleUrl +\n\t\t\t\t\"', meta: \" +\n\t\t\t\tJSON.stringify(e.meta || {}) +\n\t\t\t\t' },',\n\t\t);\n\t}\n\tlines.push('] as const;');\n\tlines.push('');\n\tlines.push('export const byCollection: Record<string, any[]> = {};');\n\tlines.push(\n\t\t'for (const c of contents) { (byCollection[c.collection] ||= []).push(c as any); }',\n\t);\n\tlines.push('');\n\tlines.push(\n\t\t'export const byCollectionAndName: Record<string, Record<string, any>> = {};',\n\t);\n\tlines.push(\n\t\t'for (const c of contents) { ((byCollectionAndName[c.collection] ||= {})[c.name] = c as any); }',\n\t);\n\tlines.push('');\n\tlines.push('export type Collections = keyof typeof byCollection;');\n\tlines.push(\n\t\t'export type Names<C extends Collections> = keyof (typeof byCollectionAndName)[C];',\n\t);\n\tlines.push('export type ContentEntry = (typeof contents)[number];');\n\tlines.push('');\n\tlines.push(\n\t\t'export function getContentEntry<C extends string, N extends string>(collection: C, name: N) {',\n\t);\n\tlines.push(' const m = (byCollectionAndName as any)[collection];');\n\tlines.push(' return m ? (m as Record<string, any>)[name] : undefined;');\n\tlines.push('}');\n\tlines.push('');\n\n\tawait mkdir(join(cwd, '.reroute'), { recursive: true });\n\tawait writeFile(join(cwd, OUTPUT_CONTENT_TS), lines.join('\\n'), 'utf-8');\n\tconsole.log(`[reroute/content] wrote ${join(cwd, OUTPUT_CONTENT_TS)}`);\n\n\t// Write per-collection runtime ESM files under .reroute/collections/<collection>.js\n\tconst collectionsSet = new Set(results.map((r) => r.collection));\n\tawait mkdir(join(cwd, OUTPUT_COLLECTIONS_DIR), { recursive: true });\n\tfor (const collection of collectionsSet) {\n\t\tconst items = results.filter((r) => r.collection === collection);\n\t\tconst js: string[] = [];\n\t\tjs.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\t\tjs.push('');\n\t\tjs.push('export const items = [');\n\t\tfor (const e of items) {\n\t\t\tjs.push(\n\t\t\t\t` { collection: '${e.collection}', slug: '${e.slug}', name: '${e.name}', href: '${e.href}', module: '${e.moduleUrl}', meta: ${JSON.stringify(e.meta || {})} },`,\n\t\t\t);\n\t\t}\n\t\tjs.push('];');\n\t\tjs.push('');\n\t\tjs.push('export const byName = {};');\n\t\tjs.push('for (const it of items) { byName[it.name] = it; }');\n\t\tjs.push('');\n\t\tjs.push('export function get(collectionName, name) {');\n\t\tjs.push(` if (collectionName !== '${collection}') return undefined;`);\n\t\tjs.push(' return byName[name];');\n\t\tjs.push('}');\n\t\tjs.push('');\n\n\t\tawait writeFile(\n\t\t\tjoin(cwd, OUTPUT_COLLECTIONS_DIR, `${collection}.js`),\n\t\t\tjs.join('\\n'),\n\t\t\t'utf-8',\n\t\t);\n\t\tconsole.log(\n\t\t\t`[reroute/content] wrote ${join(cwd, OUTPUT_COLLECTIONS_DIR, `${collection}.js`)}`,\n\t\t);\n\t}\n}\n\nasync function generate(cwd: string) {\n\tconsole.log('[reroute/gen] Starting generation...');\n\n\t// Cleanup old generated files due to SSR issues for non-watch mode\n\tawait cleanupOutputDir(cwd);\n\n\t// Routes\n\tconst routesPath = join(cwd, ROUTES_DIR);\n\ttry {\n\t\tconst files = await scanDirectory(routesPath);\n\t\tconst nfFiles = await scan404Files(routesPath);\n\t\tconst all = Array.from(new Set([...files, ...nfFiles]));\n\t\tconst tree = generateRouteTree(all.map((f) => f.replace(/\\\\/g, '/')));\n\t\tconst ts = generateTypeScript(tree);\n\t\tawait mkdir(join(cwd, '.reroute'), { recursive: true });\n\t\tawait writeFile(join(cwd, OUTPUT_ROUTES), ts, 'utf-8');\n\t\tconsole.log(`[reroute/gen] Generated routes: ${join(cwd, OUTPUT_ROUTES)}`);\n\t} catch (error) {\n\t\tconsole.error('[reroute/gen] Failed to generate routes:', error);\n\t\tthrow error;\n\t}\n\n\t// Content\n\ttry {\n\t\tawait buildContentChunks(cwd);\n\t\tconsole.log(\n\t\t\t`[reroute/gen] Generated content: ${join(cwd, OUTPUT_CONTENT_TS)} + collections/*.js`,\n\t\t);\n\t} catch (error) {\n\t\tconsole.error('[reroute/gen] Failed to generate content:', error);\n\t\tthrow error;\n\t}\n\n\t// Write .reroute/index.ts aggregator\n\tconst indexLines: string[] = [];\n\tindexLines.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\tindexLines.push('/* eslint-disable */');\n\tindexLines.push('// @ts-nocheck');\n\tindexLines.push('');\n\tindexLines.push(\n\t\t\"import { layouts, matchRoute, notFoundRoutes } from './routes';\",\n\t);\n\tindexLines.push('');\n\tindexLines.push('export const artifacts = {');\n\tindexLines.push(' layouts,');\n\tindexLines.push(' matchRoute,');\n\tindexLines.push(' notFoundRoutes,');\n\tindexLines.push(\" contentBaseUrl: '/.reroute/collections'\");\n\tindexLines.push('} as const;');\n\tindexLines.push('');\n\tindexLines.push('export type RerouteArtifacts = typeof artifacts;');\n\tawait writeFile(join(cwd, OUTPUT_INDEX), indexLines.join('\\n'), 'utf-8');\n\tconsole.log(`[reroute/gen] Generated index: ${join(cwd, OUTPUT_INDEX)}`);\n\n\tconsole.log('[reroute/gen] āœ… Generation complete!');\n}\n\nexport default async function gen(args: string[]) {\n\tconst watchMode = args.includes('--watch') || args.includes('-w');\n\tconst cwd = process.cwd();\n\n\tif (watchMode) {\n\t\tconsole.log('[reroute/gen] Watch mode enabled');\n\t\tconsole.log('[reroute/gen] Initial generation...');\n\t\tawait generate(cwd);\n\n\t\t// Initial Tailwind build (ignore if Tailwind is not configured)\n\t\ttry {\n\t\t\tawait buildTailwind(cwd);\n\t\t} catch {}\n\n\t\t// Watch for file changes\n\t\tconst routesPath = join(cwd, ROUTES_DIR);\n\t\tconsole.log(`[reroute/gen] Watching ${routesPath} for changes...`);\n\n\t\tlet timeout: NodeJS.Timeout | null = null;\n\n\t\t// Use fs.watch for cross-platform compatibility\n\t\tconst watcher = watch(\n\t\t\troutesPath,\n\t\t\t{ recursive: true },\n\t\t\t(_eventType, filename) => {\n\t\t\t\tif (!filename) return;\n\n\t\t\t\t// Debounce: wait 300ms after last change\n\t\t\t\tif (timeout) clearTimeout(timeout);\n\t\t\t\ttimeout = setTimeout(async () => {\n\t\t\t\t\tconsole.log('[reroute/gen] Change detected, regenerating...');\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait generate(cwd);\n\t\t\t\t\t\t// Rebuild Tailwind to capture class changes in routes\n\t\t\t\t\t\tawait buildTailwind(cwd);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error('[reroute/gen] Error during regeneration:', error);\n\t\t\t\t\t}\n\t\t\t\t}, 300);\n\t\t\t},\n\t\t);\n\n\t\t// Also watch src/client for component/template changes and rebuild Tailwind\n\t\tconst clientPath = join(cwd, 'src', 'client');\n\t\tconsole.log(\n\t\t\t`[reroute/gen] Watching ${clientPath} for Tailwind class changes...`,\n\t\t);\n\t\tlet twTimeout: NodeJS.Timeout | null = null;\n\t\tconst twWatcher = watch(\n\t\t\tclientPath,\n\t\t\t{ recursive: true },\n\t\t\t(_eventType, filename) => {\n\t\t\t\tif (!filename) return;\n\t\t\t\t// Skip generated, node_modules and route files (handled by routes watcher)\n\t\t\t\tif (filename.includes('.reroute') || filename.includes('node_modules'))\n\t\t\t\t\treturn;\n\t\t\t\tif (filename.includes('routes/') || filename.includes('routes\\\\'))\n\t\t\t\t\treturn;\n\t\t\t\tif (!/\\.(tsx|ts|jsx|js|html|md|mdx|css)$/.test(filename)) return;\n\n\t\t\t\tif (twTimeout) clearTimeout(twTimeout);\n\t\t\t\ttwTimeout = setTimeout(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait buildTailwind(cwd);\n\t\t\t\t\t} catch {}\n\t\t\t\t}, 200);\n\t\t\t},\n\t\t);\n\n\t\t// Keep the process running\n\t\tprocess.on('SIGINT', () => {\n\t\t\tconsole.log('\\n[reroute/gen] Stopping watch mode...');\n\t\t\twatcher.close();\n\t\t\ttwWatcher.close();\n\t\t\tprocess.exit(0);\n\t\t});\n\t} else {\n\t\tawait generate(cwd);\n\n\t\t// Build Tailwind CSS once in non-watch mode\n\t\tinitTailwind(cwd, false);\n\t}\n}\n",
8
+ "export * from './hash';\nexport * from './transpile';\n",
9
+ "import { readdir, stat } from 'node:fs/promises';\nimport type { ContentItemDTO } from '../types';\nimport { basename, join, stripEnd, stripStart } from '../utils/path';\nimport { getContentMeta } from './metadata';\n\nexport async function listContentFiles(\n\tdir: string,\n\tbaseRel: string,\n): Promise<string[]> {\n\tconst out: string[] = [];\n\ttry {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst full = join(dir, entry.name);\n\t\t\tconst rel = join(baseRel, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tconst nested = await listContentFiles(full, rel);\n\t\t\t\tout.push(...nested);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\tif (/\\.(tsx|ts)$/.test(entry.name) && !entry.name.startsWith('_')) {\n\t\t\t\t\tout.push(rel);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// ignore missing dirs\n\t}\n\treturn out;\n}\n\nexport async function buildContentDTOs(\n\tcollectionPath: string,\n\tclientDir: string,\n\tprefix: string,\n\tisWatchMode: boolean,\n): Promise<ContentItemDTO[]> {\n\tconst normalized = stripStart(stripEnd(collectionPath, '/'), '/');\n\tconst contentRelDir = join('routes', normalized, 'content');\n\tconst contentAbsDir = join(clientDir, contentRelDir);\n\n\tconst files = await listContentFiles(contentAbsDir, '');\n\tconst items: ContentItemDTO[] = [];\n\tfor (const rel of files) {\n\t\tconst fullRelPath = join(contentRelDir, rel);\n\t\tconst absPath = join(clientDir, fullRelPath);\n\t\tconst noExt = rel.replace(/\\.(tsx|ts)$/, '');\n\t\tconst name = basename(noExt);\n\n\t\t// Use raw TSX path; served and transpiled on-demand by static route\n\t\tconst moduleUrl = `${prefix}/${fullRelPath}`.replace(/\\/+/g, '/');\n\t\tconst meta = await getContentMeta(absPath, isWatchMode);\n\t\t// Use the last path segment for href to fit current '/blog/:slug' route\n\t\tconst href = `/${normalized}/${name}`.replace(/\\\\+/g, '/');\n\n\t\titems.push({\n\t\t\tslug: noExt,\n\t\t\tname,\n\t\t\tpath: fullRelPath,\n\t\t\tmodule: moduleUrl,\n\t\t\tmeta,\n\t\t\thref,\n\t\t});\n\t}\n\treturn items;\n}\n\nexport async function discoverCollections(\n\tclientDir: string,\n): Promise<string[]> {\n\tconst root = join(clientDir, 'routes');\n\tconst collections = new Set<string>();\n\ttry {\n\t\tconst entries = await readdir(root, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tconst contentDir = join(root, entry.name, 'content');\n\t\t\t\ttry {\n\t\t\t\t\tawait stat(contentDir);\n\t\t\t\t\tcollections.add(entry.name);\n\t\t\t\t} catch {\n\t\t\t\t\t// content directory doesn't exist, skip\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// routes directory doesn't exist\n\t}\n\treturn Array.from(collections);\n}\n",
10
+ "export * from './builder';\nexport * from './discovery';\nexport * from './metadata';\nexport * from './registry';\n",
11
+ "import type { Doc } from '../types';\nimport { importContentModuleForPath } from './modules';\n\nexport async function seedSSRModuleForPath(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<void> {\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length < 2) return;\n\t\tconst collection = parts[0];\n\t\tconst name = parts[1];\n\t\tconst key = `${collection}:${name}`;\n\n\t\tconst mod = await importContentModuleForPath(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t);\n\n\t\tif (!mod) return;\n\n\t\tconst C = (mod as Doc).default || (mod as Doc);\n\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__ =\n\t\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__ || {};\n\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__[key] = C;\n\n\t\t// Also capture exported meta/frontmatter and optional ssr config for head injection\n\t\ttry {\n\t\t\tconst pageMeta = (mod as Doc).meta || (mod as Doc).frontmatter || {};\n\t\t\tconst pageSSR = (mod as Doc).ssr || {};\n\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__ =\n\t\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__ || {};\n\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__[key] = {\n\t\t\t\tmeta: pageMeta,\n\t\t\t\tssr: pageSSR,\n\t\t\t};\n\t\t} catch {}\n\t} catch {}\n}\n",
12
+ "import { pathToFileURL } from 'node:url';\nimport type { Doc } from '../types';\nimport { join } from '../utils/path';\nimport { seedSSRModuleForPath } from './seed';\n\ntype ComputeParams = {\n\tpathname: string;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n};\n\nexport async function computeSSRDataForPath(\n\tparams: ComputeParams,\n): Promise<unknown> {\n\tconst { pathname, clientDir, cwd, isWatchMode } = params;\n\n\t// Seed content modules for potential content pages\n\ttry {\n\t\tawait seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode);\n\t} catch {}\n\n\t// 1) Try content-level export ssr.data if available\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length >= 2) {\n\t\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\t\tconst g = globalThis as Doc;\n\t\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key] as\n\t\t\t\t| { ssr?: { data?: (ctx: Doc) => unknown | Promise<unknown> } }\n\t\t\t\t| undefined;\n\t\t\tconst dataFn = (exp as Doc)?.ssr?.data as\n\t\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t\t| undefined;\n\t\t\tif (typeof dataFn === 'function') {\n\t\t\t\treturn await dataFn({ pathname, params: { name: parts[1] } } as Doc);\n\t\t\t}\n\t\t}\n\t} catch {}\n\n\t// 2) Route-level export ssr.data (non-content routes)\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await import(\n\t\t\tpathToFileURL(routesPath).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t);\n\t\tconst match =\n\t\t\ttypeof (m as Doc).matchRoute === 'function'\n\t\t\t\t? (m as Doc).matchRoute(pathname)\n\t\t\t\t: null;\n\t\tconst r = (match as Doc | null | undefined)?.route as Doc | undefined;\n\t\tconst paramsValue = ((match as Doc | null | undefined)?.params ||\n\t\t\t{}) as Record<string, string>;\n\t\tif (r && typeof (r as Doc).path === 'string') {\n\t\t\ttry {\n\t\t\t\tconst abs = join(clientDir, 'routes', String((r as Doc).path));\n\t\t\t\tconst mod = (await import(\n\t\t\t\t\tpathToFileURL(abs).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t\t)) as Doc;\n\t\t\t\tconst ssr = (mod as Doc)?.ssr as Doc | undefined;\n\t\t\t\tconst dataFn = (ssr as Doc)?.data as\n\t\t\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t\t\t| undefined;\n\t\t\t\tif (typeof dataFn === 'function') {\n\t\t\t\t\treturn await dataFn({ pathname, params: paramsValue } as Doc);\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t} catch {}\n\n\treturn null;\n}\n",
13
+ "function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nconst dedent = createDedent({});\nexport default dedent;\nfunction createDedent(options) {\n dedent.withOptions = newOptions => createDedent(_objectSpread(_objectSpread({}, options), newOptions));\n return dedent;\n function dedent(strings, ...values) {\n const raw = typeof strings === \"string\" ? [strings] : strings.raw;\n const {\n alignValues = false,\n escapeSpecialCharacters = Array.isArray(strings),\n trimWhitespace = true\n } = options;\n\n // first, perform interpolation\n let result = \"\";\n for (let i = 0; i < raw.length; i++) {\n let next = raw[i];\n if (escapeSpecialCharacters) {\n // handle escaped newlines, backticks, and interpolation characters\n next = next.replace(/\\\\\\n[ \\t]*/g, \"\").replace(/\\\\`/g, \"`\").replace(/\\\\\\$/g, \"$\").replace(/\\\\\\{/g, \"{\");\n }\n result += next;\n if (i < values.length) {\n const value = alignValues ? alignValue(values[i], result) : values[i];\n\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n result += value;\n }\n }\n\n // now strip indentation\n const lines = result.split(\"\\n\");\n let mindent = null;\n for (const l of lines) {\n const m = l.match(/^(\\s+)\\S+/);\n if (m) {\n const indent = m[1].length;\n if (!mindent) {\n // this is the first indented line\n mindent = indent;\n } else {\n mindent = Math.min(mindent, indent);\n }\n }\n }\n if (mindent !== null) {\n const m = mindent; // appease TypeScript\n result = lines\n // https://github.com/typescript-eslint/typescript-eslint/issues/7140\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n .map(l => l[0] === \" \" || l[0] === \"\\t\" ? l.slice(m) : l).join(\"\\n\");\n }\n\n // dedent eats leading and trailing whitespace too\n if (trimWhitespace) {\n result = result.trim();\n }\n\n // handle escaped newlines at the end to ensure they don't get stripped too\n if (escapeSpecialCharacters) {\n result = result.replace(/\\\\n/g, \"\\n\");\n }\n return result;\n }\n}\n\n/**\n * Adjusts the indentation of a multi-line interpolated value to match the current line.\n */\nfunction alignValue(value, precedingText) {\n if (typeof value !== \"string\" || !value.includes(\"\\n\")) {\n return value;\n }\n const currentLine = precedingText.slice(precedingText.lastIndexOf(\"\\n\") + 1);\n const indentMatch = currentLine.match(/^(\\s+)/);\n if (indentMatch) {\n const indent = indentMatch[1];\n return value.replace(/\\n/g, `\\n${indent}`);\n }\n return value;\n}\n",
14
+ "export * from './html';\n",
15
+ "import { readdir, stat } from 'node:fs/promises';\nimport { pathToFileURL } from 'node:url';\nimport dedent from 'dedent';\nimport { cloneElement, type ReactElement } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport { buildHeadFromMeta } from '../content/metadata';\nimport { applyIndexTemplate, loadIndexHtml } from '../template';\nimport type { Doc } from '../types';\nimport { join } from '../utils/path';\nimport { seedSSRModuleForPath } from './seed';\n\ntype SSRRenderOptions = {\n\tpathname: string;\n\trootComponent: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\t// When true, also attempt to minify inlined assets like CSS\n\tminify?: boolean;\n};\n\ntype SSRRenderResult = {\n\thtml: string;\n\tstatus: number;\n};\n\nasync function renderSSRDocument(\n\toptions: SSRRenderOptions,\n): Promise<SSRRenderResult> {\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\thead = '',\n\t\tlang = 'en',\n\t\tappId = 'root',\n\t\tminify = false,\n\t} = options;\n\n\tconst scripts = [bundleUrl];\n\tlet hydrationScript = '';\n\tlet extraHead = '';\n\n\t// Track HTTP status override (e.g., 404 when content entry missing)\n\tlet statusOverride: number | undefined;\n\n\t// Reset per-request SSR access tracking to avoid cross-request leakage\n\t// Shape: { [collection]: { limit: number|Infinity, sort: 'date-desc'|'date-asc'|'none'|'custom' } }\n\ttry {\n\t\t(globalThis as Doc).__REROUTE_SSR_ACCESSED__ = {} as unknown as Doc;\n\t} catch {}\n\n\t// If current page is a content page (/collection/name) AND the collection exists,\n\t// preload its module for instant hydration. Avoid treating non-content dynamic\n\t// routes (e.g., /products/19) as missing content, which would set 404.\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length >= 2) {\n\t\t\tconst collection = parts[0];\n\t\t\tconst name = parts[1];\n\t\t\tlet modulePath = '';\n\n\t\t\t// Only consider this a content collection if routes/<collection>/content exists\n\t\t\tlet isContentCollection = false;\n\t\t\ttry {\n\t\t\t\tconst maybeDir = join(clientDir, 'routes', collection, 'content');\n\t\t\t\tconst s = await stat(maybeDir);\n\t\t\t\tisContentCollection =\n\t\t\t\t\ttypeof s?.isDirectory === 'function' ? s.isDirectory() : true;\n\t\t\t} catch {\n\t\t\t\tisContentCollection = false;\n\t\t\t}\n\n\t\t\tif (!isContentCollection) {\n\t\t\t\t// Not a content collection path; skip content preloading logic\n\t\t\t\t// to avoid incorrectly marking the request as 404.\n\t\t\t\tthrow new Error('skip-content-preload');\n\t\t\t}\n\n\t\t\t// Prefer registry mapping from .reroute/content.ts for exact chunk\n\t\t\ttry {\n\t\t\t\tconst registryPath = join(cwd, '.reroute', 'content.ts');\n\t\t\t\tconst reg = (await import(\n\t\t\t\t\tpathToFileURL(registryPath).href +\n\t\t\t\t\t\t(isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t\t)) as Doc;\n\t\t\t\tconst get = (reg as Doc)?.getContentEntry as\n\t\t\t\t\t| ((c: string, n: string) => { module?: string } | undefined)\n\t\t\t\t\t| undefined;\n\t\t\t\tconst entry =\n\t\t\t\t\ttypeof get === 'function' ? get(collection, name) : undefined;\n\t\t\t\tconst moduleUrl = (entry as Doc)?.module as string | undefined;\n\t\t\t\tif (moduleUrl?.endsWith('.js')) {\n\t\t\t\t\tmodulePath = moduleUrl;\n\t\t\t\t}\n\t\t\t} catch {}\n\n\t\t\t// Fallback: pick newest chunk if registry unavailable\n\t\t\tif (!modulePath) {\n\t\t\t\ttry {\n\t\t\t\t\tconst chunkDir = join(cwd, '.reroute', 'chunks', collection);\n\t\t\t\t\tconst files = await readdir(chunkDir);\n\t\t\t\t\tconst candidates = files.filter(\n\t\t\t\t\t\t(n) => n.startsWith(`${name}.`) && n.endsWith('.js'),\n\t\t\t\t\t);\n\t\t\t\t\tif (candidates.length) {\n\t\t\t\t\t\tlet latest = candidates[0];\n\t\t\t\t\t\tlet latestM = 0;\n\t\t\t\t\t\tfor (const candidateName of candidates) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst s = await stat(join(chunkDir, candidateName));\n\t\t\t\t\t\t\t\tif (s.mtimeMs >= latestM) {\n\t\t\t\t\t\t\t\t\tlatestM = s.mtimeMs;\n\t\t\t\t\t\t\t\t\tlatest = candidateName;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmodulePath = `/${join('.reroute', 'chunks', collection, latest).replace(/\\\\+/g, '/')}`;\n\t\t\t\t\t}\n\t\t\t\t} catch {}\n\t\t\t}\n\n\t\t\t// Fallback to raw source if chunk missing\n\t\t\tif (!modulePath) {\n\t\t\t\tconst tsx = join(\n\t\t\t\t\tclientDir,\n\t\t\t\t\t'routes',\n\t\t\t\t\tcollection,\n\t\t\t\t\t'content',\n\t\t\t\t\t`${name}.tsx`,\n\t\t\t\t);\n\t\t\t\tconst ts = join(\n\t\t\t\t\tclientDir,\n\t\t\t\t\t'routes',\n\t\t\t\t\tcollection,\n\t\t\t\t\t'content',\n\t\t\t\t\t`${name}.ts`,\n\t\t\t\t);\n\t\t\t\tlet srcUrl = '';\n\t\t\t\tif (await Bun.file(tsx).exists()) {\n\t\t\t\t\tsrcUrl = `/${join('routes', collection, 'content', `${name}.tsx`).replace(/\\\\+/g, '/')}`;\n\t\t\t\t} else if (await Bun.file(ts).exists()) {\n\t\t\t\t\tsrcUrl = `/${join('routes', collection, 'content', `${name}.ts`).replace(/\\\\+/g, '/')}`;\n\t\t\t\t}\n\t\t\t\tif (srcUrl) {\n\t\t\t\t\tmodulePath = srcUrl;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!modulePath) {\n\t\t\t\tstatusOverride = 404;\n\t\t\t}\n\n\t\t\tif (modulePath) {\n\t\t\t\tconst key = `${collection}:${name}`;\n\t\t\t\t// Hint the browser to fetch the module ASAP\n\t\t\t\textraHead += `\\n<link rel=\"modulepreload\" href=\"${modulePath}\" />`;\n\t\t\t\t// Ensure the module is evaluated before the main app module runs via external module\n\t\t\t\tconst qs = `src=${encodeURIComponent(modulePath)}&key=${encodeURIComponent(key)}`;\n\t\t\t\thydrationScript += `<script type=\"module\" src=\"/__reroute_preload?${qs}\"></script>`;\n\t\t\t}\n\t\t}\n\t} catch {}\n\n\t// Seed SSR store with content component so BlogPost can render on server\n\tawait seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode);\n\n\t// Route component module preload removed to avoid extra requests.\n\n\t// Execute optional route/content ssr.data and expose per-request store\n\tconst __SSR_DATA__: Record<string, unknown> = {};\n\ttry {\n\t\t// Content page ssr.data exported from the content module (if any)\n\t\ttry {\n\t\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\t\tif (parts.length >= 2) {\n\t\t\t\tconst g = globalThis as Doc;\n\t\t\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\t\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key] as\n\t\t\t\t\t| { ssr?: { data?: (ctx: Doc) => unknown | Promise<unknown> } }\n\t\t\t\t\t| undefined;\n\t\t\t\tconst dataFn = (exp as Doc)?.ssr?.data as\n\t\t\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t\t\t| undefined;\n\t\t\t\tif (typeof dataFn === 'function') {\n\t\t\t\t\tconst out = await dataFn({\n\t\t\t\t\t\tpathname,\n\t\t\t\t\t\tparams: { name: parts[1] },\n\t\t\t\t\t} as Doc);\n\t\t\t\t\t__SSR_DATA__[pathname] = out as unknown;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\n\t\t// Route-level ssr.data from route module (non-content routes)\n\t\ttry {\n\t\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\t\tconst m = await import(\n\t\t\t\tpathToFileURL(routesPath).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t);\n\t\t\tconst match =\n\t\t\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathname) : null;\n\t\t\tconst r = match?.route as Doc | undefined;\n\t\t\tconst params = (match?.params || {}) as Record<string, string>;\n\n\t\t\tif (r && typeof r.path === 'string') {\n\t\t\t\ttry {\n\t\t\t\t\tconst abs = join(clientDir, 'routes', String(r.path));\n\t\t\t\t\tconst mod = (await import(\n\t\t\t\t\t\tpathToFileURL(abs).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t\t\t)) as Doc;\n\t\t\t\t\tconst ssr = (mod as Doc)?.ssr as Doc | undefined;\n\t\t\t\t\tconst dataFn = (ssr as Doc)?.data as\n\t\t\t\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (typeof dataFn === 'function') {\n\t\t\t\t\t\tconst out = await dataFn({ pathname, params } as Doc);\n\t\t\t\t\t\t__SSR_DATA__[pathname] = out as unknown;\n\t\t\t\t\t}\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t} catch {}\n\t} catch {}\n\n\ttry {\n\t\t(globalThis as Doc).__REROUTE_DATA__ = __SSR_DATA__ as Doc;\n\t} catch {}\n\n\t// Seed content collections on the server for SSR rendering (no client delivery yet).\n\t// We'll only inline the collections actually accessed during this render, captured\n\t// via the hook-level tracker.\n\tlet __byCollectionForSSR: Record<string, unknown[]> = {};\n\ttry {\n\t\tconst p = join(cwd, '.reroute', 'content.ts');\n\t\tconst mod = await import(\n\t\t\tpathToFileURL(p).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t);\n\t\t__byCollectionForSSR = ((mod as Doc)?.byCollection || {}) as Record<\n\t\t\tstring,\n\t\t\tunknown[]\n\t\t>;\n\t\ttry {\n\t\t\t(globalThis as Doc).__REROUTE_COLLECTIONS__ = __byCollectionForSSR as Doc;\n\t\t} catch {}\n\t} catch {}\n\n\t// (moved) Entry + dev watcher scripts are appended later, after we inline\n\t// any accessed collections so data is available before app boot.\n\n\tconst componentWithPathname = cloneElement<Doc>(rootComponent, {\n\t\tpathname,\n\t});\n\tconst appHtml = renderToString(componentWithPathname);\n\tconst baseTemplate = await loadIndexHtml(clientDir);\n\n\t// Inline compiled Tailwind CSS output if present (generated by CLI):\n\t// Prefer theme.css relative to clientDir (e.g., src/client/theme.css -> ../../.reroute/theme.css)\n\tlet inlineStyleTag = '';\n\ttry {\n\t\tconst candidates = [\n\t\t\tjoin(clientDir, '..', '.reroute', 'theme.css'),\n\t\t\tjoin(clientDir, '..', '..', '.reroute', 'theme.css'),\n\t\t\tjoin(clientDir, '..', '..', '..', '.reroute', 'theme.css'),\n\t\t\tjoin(clientDir, '..', '..', '..', '..', '.reroute', 'theme.css'),\n\t\t];\n\t\tlet cssPath = '';\n\t\tfor (const p of candidates) {\n\t\t\tif (await Bun.file(p).exists()) {\n\t\t\t\tcssPath = p;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (cssPath) {\n\t\t\tlet css = await Bun.file(cssPath).text();\n\t\t\tif (minify) {\n\t\t\t\t// Best-effort, safe-ish CSS minification without external deps\n\t\t\t\tcss = css\n\t\t\t\t\t// Remove /* block comments */\n\t\t\t\t\t.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n\t\t\t\t\t// Collapse whitespace\n\t\t\t\t\t.replace(/\\s+/g, ' ')\n\t\t\t\t\t// Remove space around selectors, braces, colons and semicolons\n\t\t\t\t\t.replace(/\\s*([{}:;,>+~])\\s*/g, '$1')\n\t\t\t\t\t// Remove final semicolons before closing brace\n\t\t\t\t\t.replace(/;}/g, '}')\n\t\t\t\t\t// Trim\n\t\t\t\t\t.trim();\n\t\t\t}\n\t\t\tinlineStyleTag = `<style data-reroute=\"tailwind\">${css}</style>`;\n\t\t}\n\t} catch {}\n\n\t// After rendering, inline only the content collections that were actually\n\t// accessed during this SSR render. This preserves SSR for static routes that\n\t// use useContent(), while avoiding shipping the entire content index to pages\n\t// that don't need it (e.g., a single post entry without lists).\n\ttry {\n\t\tconst g = globalThis as unknown as { __REROUTE_SSR_ACCESSED__?: unknown };\n\t\tconst acc = g.__REROUTE_SSR_ACCESSED__ as Doc;\n\n\t\t// Helper for date ordering\n\t\tconst sortByDate = (order: 'asc' | 'desc') => (a: Doc, b: Doc) => {\n\t\t\tconst da = a?.meta?.date ? Date.parse(String(a.meta.date)) : 0;\n\t\t\tconst db = b?.meta?.date ? Date.parse(String(b.meta.date)) : 0;\n\t\t\treturn order === 'asc' ? da - db : db - da;\n\t\t};\n\n\t\t// Normalize tracker into a map of collection -> { limit, sort }\n\t\tconst usage: Record<string, { limit: number; sort: string }> = {};\n\t\tif (acc && typeof acc.forEach === 'function') {\n\t\t\t// Back-compat with old Set<string> form: treat as full list\n\t\t\t(acc as Set<string>).forEach((c) => {\n\t\t\t\tif (typeof c === 'string')\n\t\t\t\t\tusage[c] = { limit: Number.POSITIVE_INFINITY, sort: 'custom' };\n\t\t\t});\n\t\t} else if (acc && typeof acc === 'object') {\n\t\t\tfor (const [k, v] of Object.entries(acc as Record<string, Doc>)) {\n\t\t\t\tconst lim =\n\t\t\t\t\ttypeof v?.limit === 'number' ? v.limit : Number.POSITIVE_INFINITY;\n\t\t\t\tconst s = typeof v?.sort === 'string' ? v.sort : 'custom';\n\t\t\t\tusage[k] = { limit: lim, sort: s };\n\t\t\t}\n\t\t}\n\n\t\tconst collections = Object.keys(usage);\n\t\tif (collections.length) {\n\t\t\tconst subset: Record<string, unknown[]> = {};\n\t\t\tconst partial: Record<string, boolean> = {};\n\t\t\tfor (const c of collections) {\n\t\t\t\tconst conf = usage[c];\n\t\t\t\tconst full = __byCollectionForSSR?.[c] || [];\n\t\t\t\tlet arr: unknown[] = full;\n\t\t\t\tif (\n\t\t\t\t\tNumber.isFinite(conf.limit) &&\n\t\t\t\t\tconf.limit > 0 &&\n\t\t\t\t\tconf.sort !== 'custom'\n\t\t\t\t) {\n\t\t\t\t\tif (conf.sort === 'date-desc') {\n\t\t\t\t\t\tarr = [...full].sort(sortByDate('desc')).slice(0, conf.limit);\n\t\t\t\t\t} else if (conf.sort === 'date-asc') {\n\t\t\t\t\t\tarr = [...full].sort(sortByDate('asc')).slice(0, conf.limit);\n\t\t\t\t\t} else if (conf.sort === 'none') {\n\t\t\t\t\t\tarr = full.slice(0, conf.limit);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsubset[c] = arr;\n\t\t\t\tpartial[c] =\n\t\t\t\t\tArray.isArray(arr) && Array.isArray(full)\n\t\t\t\t\t\t? arr.length < full.length\n\t\t\t\t\t\t: false;\n\t\t\t}\n\t\t\tconst subsetJson = JSON.stringify(subset);\n\t\t\tconst partialJson = JSON.stringify(partial);\n\t\t\thydrationScript += `\\n<script>\\n (function(){ try {\\n var w = (typeof window!== 'undefined'? window : globalThis);\\n w.__REROUTE_COLLECTIONS__ = w.__REROUTE_COLLECTIONS__ || {};\\n Object.assign(w.__REROUTE_COLLECTIONS__, ${subsetJson});\\n w.__REROUTE_COLLECTIONS_PARTIAL__ = w.__REROUTE_COLLECTIONS_PARTIAL__ || {};\\n Object.assign(w.__REROUTE_COLLECTIONS_PARTIAL__, ${partialJson});\\n } catch(e){} })();\\n</script>`;\n\t\t}\n\t} catch {}\n\n\t// Inline SSR data before client entry loads\n\ttry {\n\t\tconst seededJson = JSON.stringify(__SSR_DATA__);\n\t\thydrationScript += `\\n<script>\\n (function(){ try {\\n var w = (typeof window!== 'undefined'? window : globalThis);\\n w.__REROUTE_DATA__ = Object.assign({}, w.__REROUTE_DATA__ || {}, ${seededJson});\\n } catch(e){} })();\\n</script>`;\n\t} catch {}\n\n\t// Append client entry module only after inlining accessed collections\n\thydrationScript += scripts\n\t\t.map((src) => `<script type=\"module\" src=\"${src}\"></script>`)\n\t\t.join('');\n\n\t// (Dev) Load live reload module (no inline script)\n\tif (isWatchMode) {\n\t\thydrationScript += `<script type=\"module\" src=\"/__reroute_watch.js\"></script>`;\n\t}\n\n\t// Derive per-page head from exported meta/ssr if available\n\tlet perPageHead = '';\n\tlet pageLang: string | undefined;\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length >= 2) {\n\t\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\t\tconst g = globalThis as Doc;\n\t\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key] as\n\t\t\t\t| { meta?: unknown; ssr?: unknown }\n\t\t\t\t| undefined;\n\t\t\tconst meta = (exp as Doc)?.meta;\n\t\t\tconst ssr = (exp as Doc)?.ssr;\n\t\t\tperPageHead += buildHeadFromMeta(meta);\n\t\t\tconst ssrHead =\n\t\t\t\ttypeof ssr?.head === 'string'\n\t\t\t\t\t? ssr.head\n\t\t\t\t\t: Array.isArray(ssr?.head)\n\t\t\t\t\t\t? String(ssr.head.join('\\n'))\n\t\t\t\t\t\t: '';\n\t\t\tif (ssrHead) perPageHead += `\\n${ssrHead}`;\n\t\t\tif (typeof ssr?.lang === 'string' && ssr.lang.trim()) {\n\t\t\t\tpageLang = ssr.lang.trim();\n\t\t\t}\n\t\t}\n\t} catch {}\n\n\t// Additionally, import the matched route module to apply route-level meta/ssr for non-content routes\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await import(\n\t\t\tpathToFileURL(routesPath).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t);\n\t\tconst match =\n\t\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathname) : null;\n\t\tconst r = match?.route as Doc | undefined;\n\t\tif (!r) {\n\t\t\t// No route matched; mark as 404 for status\n\t\t\tstatusOverride = statusOverride || 404;\n\t\t}\n\t\tif (r && typeof r.path === 'string') {\n\t\t\ttry {\n\t\t\t\tconst abs = join(clientDir, 'routes', String(r.path));\n\t\t\t\tconst mod = (await import(\n\t\t\t\t\tpathToFileURL(abs).href + (isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t\t)) as Doc;\n\t\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\t\tconst ssr = (mod as Doc)?.ssr as Doc | undefined;\n\t\t\t\tif (meta) perPageHead += buildHeadFromMeta(meta);\n\t\t\t\tif (ssr) {\n\t\t\t\t\tconst ssrHead =\n\t\t\t\t\t\ttypeof ssr.head === 'string'\n\t\t\t\t\t\t\t? ssr.head\n\t\t\t\t\t\t\t: Array.isArray(ssr.head)\n\t\t\t\t\t\t\t\t? String((ssr.head as unknown[]).join('\\n'))\n\t\t\t\t\t\t\t\t: '';\n\t\t\t\t\tif (ssrHead) perPageHead += `\\n${ssrHead}`;\n\t\t\t\t\tif (typeof ssr.lang === 'string' && ssr.lang.trim()) {\n\t\t\t\t\t\tpageLang = ssr.lang.trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t\t// If route matched but we will render a custom 404 (e.g., content missing),\n\t\t\t// try to also apply the closest notFound meta if available.\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst list = (m as Doc)?.notFoundRoutes as Doc[] | undefined;\n\t\t\t\tif (Array.isArray(list)) {\n\t\t\t\t\t// choose most specific by longest pattern prefix\n\t\t\t\t\tlet chosen: Doc | undefined;\n\t\t\t\t\tlet bestLen = -1;\n\t\t\t\t\tfor (const nf of list) {\n\t\t\t\t\t\tconst pat = String((nf as Doc)?.pattern || '/');\n\t\t\t\t\t\tif (!pathname.startsWith(pat)) continue;\n\t\t\t\t\t\tconst len = pat.split('/').filter(Boolean).length;\n\t\t\t\t\t\tif (len >= bestLen) {\n\t\t\t\t\t\t\tbestLen = len;\n\t\t\t\t\t\t\tchosen = nf;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (chosen && typeof (chosen as Doc).path === 'string') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst abs = join(\n\t\t\t\t\t\t\t\tclientDir,\n\t\t\t\t\t\t\t\t'routes',\n\t\t\t\t\t\t\t\tString((chosen as Doc).path),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst mod = (await import(\n\t\t\t\t\t\t\t\tpathToFileURL(abs).href +\n\t\t\t\t\t\t\t\t\t(isWatchMode ? `?t=${Date.now()}` : '')\n\t\t\t\t\t\t\t)) as Doc;\n\t\t\t\t\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\t\t\t\t\tconst ssr = (mod as Doc)?.ssr as Doc | undefined;\n\t\t\t\t\t\t\tif (meta) perPageHead += buildHeadFromMeta(meta);\n\t\t\t\t\t\t\tconst ssrHead =\n\t\t\t\t\t\t\t\ttypeof ssr?.head === 'string'\n\t\t\t\t\t\t\t\t\t? ssr.head\n\t\t\t\t\t\t\t\t\t: Array.isArray(ssr?.head)\n\t\t\t\t\t\t\t\t\t\t? String((ssr.head as unknown[]).join('\\n'))\n\t\t\t\t\t\t\t\t\t\t: '';\n\t\t\t\t\t\t\tif (ssrHead) perPageHead += `\\n${ssrHead}`;\n\t\t\t\t\t\t\tif (typeof ssr?.lang === 'string' && ssr.lang?.trim()) {\n\t\t\t\t\t\t\t\tpageLang = String(ssr.lang).trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t} catch {}\n\n\tconst combinedHead = dedent(\n\t\t[dedent(head) || '', dedent(extraHead), dedent(perPageHead)]\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n'),\n\t);\n\tconst html = applyIndexTemplate(baseTemplate, appHtml, {\n\t\thead: [inlineStyleTag, combinedHead].filter(Boolean).join('\\n'),\n\t\thydrationScript,\n\t\tlang: pageLang || lang,\n\t\tappId,\n\t});\n\n\treturn {\n\t\thtml,\n\t\tstatus: statusOverride || 200,\n\t};\n}\n\nexport { renderSSRDocument, type SSRRenderOptions, type SSRRenderResult };\n",
16
+ "export * from './data';\nexport * from './render';\nexport * from './seed';\n",
17
+ "import type { ChildProcess } from 'node:child_process';\nimport { spawn } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport interface TailwindProcess {\n\tprocess: ChildProcess;\n\tstop: () => void;\n}\n\nexport function isTailwindAvailable(cwd: string): boolean {\n\tconst packageJsonPath = join(cwd, 'package.json');\n\tif (!existsSync(packageJsonPath)) return false;\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n\t\t\tdependencies?: Record<string, string>;\n\t\t\tdevDependencies?: Record<string, string>;\n\t\t};\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\t\treturn !!deps && '@tailwindcss/cli' in deps;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getTailwindPaths(cwd: string) {\n\tconst input = join(cwd, 'src/client/theme.css');\n\tconst output = join(cwd, '.reroute/theme.css');\n\treturn { input, output };\n}\n\nexport function hasTailwindInput(cwd: string): boolean {\n\tconst { input } = getTailwindPaths(cwd);\n\tif (!existsSync(input)) return false;\n\ttry {\n\t\tconst content = readFileSync(input, 'utf-8');\n\t\treturn content.includes('@import \"tailwindcss\"');\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function resolveTailwindBin(cwd: string): string {\n\tconst pathsToTry = [\n\t\tjoin(cwd, 'node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../../node_modules/.bin/tailwindcss'),\n\t\tjoin(cwd, '../../../node_modules/.bin/tailwindcss'),\n\t];\n\tfor (const binPath of pathsToTry) if (existsSync(binPath)) return binPath;\n\treturn join(cwd, 'node_modules/.bin/tailwindcss');\n}\n\nexport async function buildTailwind(cwd: string): Promise<void> {\n\tconst { input, output } = getTailwindPaths(cwd);\n\tif (!isTailwindAvailable(cwd) || !hasTailwindInput(cwd)) return;\n\tawait new Promise<void>((resolve, reject) => {\n\t\tconst tailwindBin = resolveTailwindBin(cwd);\n\t\tconst args = ['-i', input, '-o', output];\n\t\tconst tailwind = spawn(tailwindBin, args, { cwd, stdio: 'inherit' });\n\t\ttailwind.on('close', (code) =>\n\t\t\tcode === 0\n\t\t\t\t? resolve()\n\t\t\t\t: reject(new Error(`Tailwind CSS build failed with code ${code}`)),\n\t\t);\n\t\ttailwind.on('error', (error) => reject(error));\n\t});\n}\n\nexport function watchTailwind(cwd: string): TailwindProcess | null {\n\tif (!isTailwindAvailable(cwd) || !hasTailwindInput(cwd)) return null;\n\tconst { input, output } = getTailwindPaths(cwd);\n\tconst tailwindBin = resolveTailwindBin(cwd);\n\tconst args = ['-i', input, '-o', output, '--watch'];\n\tconsole.log('[reroute/tailwind] Starting Tailwind CSS v4 in watch mode...');\n\tconst child = spawn(tailwindBin, args, { cwd, stdio: 'inherit' });\n\tchild.on('error', (e) => console.error('[reroute/tailwind] Error:', e));\n\tconst stop = () => {\n\t\ttry {\n\t\t\tconsole.log('[reroute/tailwind] Stopping Tailwind CSS...');\n\t\t\tchild.kill();\n\t\t} catch {}\n\t};\n\treturn { process: child, stop };\n}\n",
18
+ "export * from './cache';\nexport * from './compression';\nexport * from './mime';\nexport * from './path';\n",
19
+ "// Bundler\nexport * from './bundler';\n// Content\nexport * from './content';\n// SSR\nexport * from './ssr';\n// Tailwind helpers\nexport * from './tailwind';\n// Template\nexport * from './template';\nexport * from './types';\n// Utils\nexport * from './utils';\n",
20
+ "export * from './src';\n",
21
+ "#!/usr/bin/env bun\n\n/**\n * Tailwind CSS v4 integration utility\n *\n * Manages Tailwind CLI integration for the Reroute framework\n */\n\nimport type { ChildProcess } from 'node:child_process';\n//\nimport {\n\tbuildTailwind,\n\tgetTailwindPaths,\n\thasTailwindInput,\n\tisTailwindAvailable,\n\tresolveTailwindBin,\n} from 'reroute-js/core';\n\ninterface TailwindProcess {\n\tprocess: ChildProcess;\n\tstop: () => void;\n}\n\n// Paths, availability and input checks are imported from core\n\n/**\n * Start Tailwind CSS in watch mode\n */\nfunction watchTailwind(cwd: string): TailwindProcess {\n\tconst { input, output } = getTailwindPaths(cwd);\n\n\tconst tailwindBin = resolveTailwindBin(cwd);\n\tconst args = ['-i', input, '-o', output, '--watch'];\n\n\tconsole.log('[reroute/tailwind] Starting Tailwind CSS v4 in watch mode...');\n\n\tconst { spawn } = require('node:child_process');\n\tconst tailwind = spawn(tailwindBin, args, { cwd, stdio: 'inherit' });\n\n\ttailwind.on('error', (error: unknown) => {\n\t\tconsole.error('[reroute/tailwind] Error:', error);\n\t});\n\n\tconst stop = () => {\n\t\tconsole.log('[reroute/tailwind] Stopping Tailwind CSS...');\n\t\ttailwind.kill();\n\t};\n\n\treturn {\n\t\tprocess: tailwind,\n\t\tstop,\n\t};\n}\n\n/**\n * Initialize Tailwind CSS integration\n * Returns null if Tailwind is not available or configured\n */\nexport function initTailwind(\n\tcwd: string,\n\twatch = false,\n): TailwindProcess | null {\n\t// Check if Tailwind is installed\n\tif (!isTailwindAvailable(cwd)) {\n\t\treturn null;\n\t}\n\n\t// Check if input file exists and uses v4 format\n\tif (!hasTailwindInput(cwd)) {\n\t\tconsole.log(\n\t\t\t'[reroute/tailwind] theme.css not found or missing @import \"tailwindcss\", skipping...',\n\t\t);\n\t\treturn null;\n\t}\n\n\tconsole.log('[reroute/tailwind] Detected Tailwind CSS v4');\n\n\tif (watch) {\n\t\treturn watchTailwind(cwd);\n\t}\n\n\t// For non-watch mode, build once and return null\n\tbuildTailwind(cwd)\n\t\t.then(() => {\n\t\t\tconsole.log('[reroute/tailwind] Built successfully');\n\t\t})\n\t\t.catch((error) => {\n\t\t\tconsole.error('[reroute/tailwind] Build failed:', error);\n\t\t});\n\n\treturn null;\n}\n",
22
+ "#!/usr/bin/env bun\nimport { watch } from 'node:fs';\nimport { mkdir, readdir, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { buildTailwind } from 'reroute-js/core';\nimport { initTailwind } from '../libs/tailwind';\n\n// biome-ignore lint/suspicious/noExplicitAny: flexible content meta type\ntype Doc = any;\n\ninterface RouteFile {\n\tpath: string;\n\tpattern: string;\n\tfilePath: string;\n\tisLayout: boolean;\n\tisDynamic: boolean;\n\tparams: string[];\n\t/** special case for [404].tsx */\n\tisNotFound?: boolean;\n\t/** when isNotFound, this is the base pattern to match as a prefix */\n\tnotFoundBasePattern?: string;\n}\n\ninterface RouteTree {\n\troutes: RouteFile[];\n\tlayouts: RouteFile[];\n\tnotFoundRoutes: RouteFile[];\n}\n\nconst ROUTES_DIR = 'src/client/routes';\nconst OUTPUT_DIR = '.reroute';\nconst OUTPUT_ROUTES = '.reroute/routes.ts';\nconst OUTPUT_CONTENT_TS = '.reroute/content.ts';\nconst OUTPUT_COLLECTIONS_DIR = '.reroute/collections';\nconst OUTPUT_INDEX = '.reroute/index.ts';\n\nasync function cleanupOutputDir(cwd: string) {\n\ttry {\n\t\t// Remove generated files\n\t\tawait rm(join(cwd, OUTPUT_DIR), { force: true });\n\t\t// Ensure .reroute exists for subsequent writes\n\t\tawait mkdir(join(cwd, OUTPUT_DIR), { recursive: true });\n\t\tconsole.log('[reroute/gen] Cleaned up generated artifacts in .reroute');\n\t} catch {\n\t\t// Ignore cleanup errors\n\t}\n}\n\nasync function scanDirectory(dir: string, base = ''): Promise<string[]> {\n\tconst files: string[] = [];\n\tconst entries = await readdir(dir, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tconst fullPath = join(dir, entry.name);\n\t\tconst relativePath = join(base, entry.name);\n\n\t\tif (entry.isDirectory()) {\n\t\t\t// Skip content directories; those are not routes\n\t\t\tif (entry.name === 'content') continue;\n\t\t\tconst nested = await scanDirectory(fullPath, relativePath);\n\t\t\tfiles.push(...nested);\n\t\t} else if (\n\t\t\tentry.isFile() &&\n\t\t\t(entry.name.endsWith('.tsx') || entry.name.endsWith('.ts'))\n\t\t) {\n\t\t\t// Skip non-route files and any files under a content/ segment\n\t\t\tif (\n\t\t\t\trelativePath.includes('/content/') ||\n\t\t\t\trelativePath.startsWith('content/')\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.name.startsWith('_') || entry.name === '[layout].tsx') {\n\t\t\t\tfiles.push(relativePath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn files;\n}\n\n// Recursively scan for [404].tsx or [404].ts anywhere under routes, including content dirs\nasync function scan404Files(dir: string, base = ''): Promise<string[]> {\n\tconst files: string[] = [];\n\tconst entries = await readdir(dir, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tconst fullPath = join(dir, entry.name);\n\t\tconst relativePath = join(base, entry.name);\n\t\tif (entry.isDirectory()) {\n\t\t\tconst nested = await scan404Files(fullPath, relativePath);\n\t\t\tfiles.push(...nested);\n\t\t} else if (entry.isFile()) {\n\t\t\tif (/^\\[404]\\.(tsx|ts)$/.test(entry.name)) files.push(relativePath);\n\t\t}\n\t}\n\treturn files;\n}\n\nfunction fileToRoute(filePath: string): RouteFile {\n\tconst isLayout =\n\t\tfilePath.endsWith('[layout].tsx') || filePath.endsWith('[layout].ts');\n\n\t// Remove extension\n\tlet routePath = filePath.replace(/\\.(tsx|ts)$/, '');\n\n\t// Handle layouts\n\tif (isLayout) {\n\t\troutePath = routePath.replace(/[layout]$/, '').replace(/\\/$/, '');\n\t}\n\n\t// Convert index to /\n\troutePath = routePath.replace(/\\/index$/, '').replace(/^index$/, '');\n\n\t// Extract params from [param] syntax\n\tconst params: string[] = [];\n\tconst pattern = routePath.replace(/\\[([^\\]]+)\\]/g, (_, param) => {\n\t\tparams.push(param);\n\t\treturn `:${param}`;\n\t});\n\n\t// Ensure leading slash\n\tconst normalizedPattern = pattern === '' ? '/' : `/${pattern}`;\n\n\t// Special case: [404].tsx files act as NotFound entries for their directory\n\tconst isNotFound = /(^|\\/)\\[404\\]$/.test(routePath);\n\tlet notFoundBasePattern: string | undefined;\n\tif (isNotFound) {\n\t\tconst base = routePath.replace(/(^|\\/)\\[404\\]$/, '').replace(/\\/$/, '');\n\t\tnotFoundBasePattern = base ? `/${base}` : '/';\n\t}\n\n\treturn {\n\t\tpath: routePath,\n\t\tpattern: normalizedPattern,\n\t\tfilePath,\n\t\tisLayout,\n\t\tisDynamic: params.length > 0,\n\t\tparams,\n\t\tisNotFound,\n\t\tnotFoundBasePattern,\n\t};\n}\n\nfunction sortRoutes(routes: RouteFile[]): RouteFile[] {\n\t// Sort by specificity: static routes first, then dynamic, then catch-all\n\treturn routes.sort((a, b) => {\n\t\tconst aDepth = a.pattern.split('/').length;\n\t\tconst bDepth = b.pattern.split('/').length;\n\n\t\t// Deeper routes first\n\t\tif (aDepth !== bDepth) return bDepth - aDepth;\n\n\t\t// Static before dynamic\n\t\tif (!a.isDynamic && b.isDynamic) return -1;\n\t\tif (a.isDynamic && !b.isDynamic) return 1;\n\n\t\t// Alphabetical\n\t\treturn a.pattern.localeCompare(b.pattern);\n\t});\n}\n\nfunction generateRouteTree(files: string[]): RouteTree {\n\tconst routes: RouteFile[] = [];\n\tconst layouts: RouteFile[] = [];\n\tconst notFoundRoutes: RouteFile[] = [];\n\n\tfor (const file of files) {\n\t\tconst route = fileToRoute(file);\n\t\tif (route.isLayout) {\n\t\t\tlayouts.push(route);\n\t\t} else if (route.isNotFound) {\n\t\t\t// Do not include [404] as a normal route; store separately\n\t\t\tnotFoundRoutes.push(route);\n\t\t} else {\n\t\t\troutes.push(route);\n\t\t}\n\t}\n\n\treturn {\n\t\troutes: sortRoutes(routes),\n\t\tlayouts,\n\t\tnotFoundRoutes: notFoundRoutes,\n\t};\n}\n\nfunction generateTypeScript(tree: RouteTree): string {\n\t// Import only default exports so optional named exports like\n\t// `ssr` and `meta` can be tree-shaken from the client bundle.\n\tconst imports = [\n\t\t...tree.routes.map(\n\t\t\t(r, i) =>\n\t\t\t\t`import Route${i} from '../src/client/routes/${r.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t\t...tree.layouts.map(\n\t\t\t(l, i) =>\n\t\t\t\t`import Layout${i} from '../src/client/routes/${l.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t\t...tree.notFoundRoutes.map(\n\t\t\t(nf, i) =>\n\t\t\t\t`import NotFound${i} from '../src/client/routes/${nf.filePath.replace(/\\.(tsx|ts)$/, '')}';`,\n\t\t),\n\t].join('\\n');\n\n\tconst routesArray = tree.routes\n\t\t.map((r, i) => {\n\t\t\treturn ` {\n pattern: \"${r.pattern}\",\n path: \"${r.path}\",\n component: Route${i},\n params: ${JSON.stringify(r.params)},\n isDynamic: ${r.isDynamic},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\tconst routePatterns = tree.routes.map((r) => ` | \"${r.pattern}\"`).join('\\n');\n\n\tconst routeParamsUnion = tree.routes\n\t\t.filter((r) => r.isDynamic)\n\t\t.map((r) => {\n\t\t\tconst params = r.params.map((p) => `${p}: string`).join('; ');\n\t\t\treturn ` T extends \"${r.pattern}\" ? { ${params} } :`;\n\t\t})\n\t\t.join('\\n');\n\n\tconst layoutsArray = tree.layouts\n\t\t.map((l, i) => {\n\t\t\treturn ` {\n pattern: \"${l.pattern}\",\n path: \"${l.path}\",\n component: Layout${i},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\tconst notFoundRoutesArray = tree.notFoundRoutes\n\t\t.map((nf, i) => {\n\t\t\treturn ` {\n pattern: \"${nf.notFoundBasePattern || '/'}\",\n path: \"${nf.path}\",\n component: NotFound${i},\n } as const`;\n\t\t})\n\t\t.join(',\\n');\n\n\treturn `// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨\n/* eslint-disable */\n// @ts-nocheck\n\n${imports}\n\nexport const routes: RouteInfo = [\n${routesArray}\n] as const;\n\nexport const layouts = [\n${layoutsArray || ''}\n] as const;\n\nexport const notFoundRoutes = [\n${notFoundRoutesArray || ''}\n] as const;\n\nexport type RoutePath =\n${routePatterns || ' | \"/\"'};\n\nexport type RouteParams<T extends RoutePath> = ${\n\t\trouteParamsUnion\n\t\t\t? `\\n${routeParamsUnion}\\n Record<string, never>;`\n\t\t\t: 'Record<string, never>;'\n\t}\n\nexport interface Route {\n pattern: string;\n path: string;\n component: any;\n params: string[];\n isDynamic: boolean;\n}\n\nexport function matchRoute(pathname: string): { route: Route; params: Record<string, string> } | null {\n for (const route of routes) {\n const match = matchPattern(route.pattern, pathname);\n if (match) {\n return { route, params: match };\n }\n }\n return null;\n}\n\nfunction matchPattern(pattern: string, pathname: string): Record<string, string> | null {\n const patternParts = pattern.split('/').filter(Boolean);\n const pathnameParts = pathname.split('/').filter(Boolean);\n\n if (patternParts.length !== pathnameParts.length) {\n return null;\n }\n\n const params: Record<string, string> = {};\n\n for (let i = 0; i < patternParts.length; i++) {\n const patternPart = patternParts[i];\n const pathnamePart = pathnameParts[i];\n\n if (patternPart.startsWith(':')) {\n params[patternPart.slice(1)] = pathnamePart;\n } else if (patternPart !== pathnamePart) {\n return null;\n }\n }\n\n return params;\n}\n`;\n}\n\nasync function listContentFiles(collectionDir: string): Promise<string[]> {\n\ttry {\n\t\tconst entries = await readdir(collectionDir, { withFileTypes: true });\n\t\treturn entries\n\t\t\t.filter(\n\t\t\t\t(e) =>\n\t\t\t\t\te.isFile() && /\\.(tsx|ts)$/.test(e.name) && !e.name.startsWith('_'),\n\t\t\t)\n\t\t\t.map((e) => e.name);\n\t} catch {\n\t\treturn [];\n\t}\n}\n\nasync function sha8(text: string): Promise<string> {\n\tconst data = new TextEncoder().encode(text);\n\tconst buf = await crypto.subtle.digest('SHA-256', data);\n\tlet hex = '';\n\tfor (const b of new Uint8Array(buf)) hex += b.toString(16).padStart(2, '0');\n\treturn hex.slice(0, 8);\n}\n\nasync function buildContentChunks(cwd: string) {\n\tconst routesRoot = join(cwd, ROUTES_DIR);\n\tconsole.log(`[reroute/content] scan ${routesRoot}`);\n\t// Find any '<collection>/content/*.(ts|tsx)'\n\tconst collections = await readdir(routesRoot, { withFileTypes: true });\n\tconst results: Array<{\n\t\tcollection: string;\n\t\tname: string;\n\t\tslug: string;\n\t\thref: string;\n\t\tmoduleUrl: string;\n\t\tmeta: Doc;\n\t}> = [];\n\n\tfor (const c of collections) {\n\t\tif (!c.isDirectory()) continue;\n\t\tconst collection = c.name;\n\t\tconst contentDir = join(routesRoot, collection, 'content');\n\t\tconsole.log(`[reroute/content] collection ${collection} dir ${contentDir}`);\n\t\tconst files = await listContentFiles(contentDir);\n\t\tconsole.log(`[reroute/content] files ${files.join(',')}`);\n\t\tif (!files.length) continue;\n\n\t\tfor (const file of files) {\n\t\t\tconst name = file.replace(/\\.(tsx|ts)$/, '');\n\t\t\tconst absSrc = join(contentDir, file);\n\t\t\t// Build to JS once (no minify) for dev reliability\n\t\t\tlet code = '';\n\t\t\ttry {\n\t\t\t\tconsole.log(`[reroute/content] build ${absSrc}`);\n\t\t\t\tconst result = await Bun.build({\n\t\t\t\t\tentrypoints: [absSrc],\n\t\t\t\t\ttarget: 'browser',\n\t\t\t\t\tformat: 'esm',\n\t\t\t\t\tsplitting: false,\n\t\t\t\t\tsourcemap: 'none',\n\t\t\t\t\tminify: false,\n\t\t\t\t\tdefine: { 'process.env.NODE_ENV': '\"production\"' },\n\t\t\t\t});\n\t\t\t\tif (!result.success) throw new Error('build failed');\n\t\t\t\tcode = await result.outputs[0].text();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'[reroute/gen] Failed to build content chunk:',\n\t\t\t\t\tabsSrc,\n\t\t\t\t\te,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst hash = await sha8(code);\n\t\t\tconst chunkRelDir = join('.reroute', 'chunks', collection);\n\t\t\tconst chunkAbsDir = join(cwd, chunkRelDir);\n\t\t\tconst outFile = `${name}.${hash}.js`;\n\t\t\tconst absOut = join(chunkAbsDir, outFile);\n\t\t\tawait mkdir(chunkAbsDir, { recursive: true });\n\t\t\ttry {\n\t\t\t\tconst exists = await Bun.file(absOut).exists();\n\t\t\t\tif (!exists) await writeFile(absOut, code, 'utf-8');\n\t\t\t} catch {}\n\n\t\t\t// Meta via source import (not bundled)\n\t\t\tlet meta: Doc = {};\n\t\t\ttry {\n\t\t\t\tconsole.log(`[reroute/content] meta ${absSrc}`);\n\t\t\t\tconst url = `${pathToFileURL(absSrc).href}?t=${Date.now()}`;\n\t\t\t\tconst m = await import(url);\n\t\t\t\tmeta = (m as Doc).meta || {};\n\t\t\t} catch {}\n\n\t\t\tresults.push({\n\t\t\t\tcollection,\n\t\t\t\tname,\n\t\t\t\tslug: name,\n\t\t\t\thref: `/${collection}/${name}`,\n\t\t\t\tmoduleUrl: (\n\t\t\t\t\t'/' +\n\t\t\t\t\tchunkRelDir.replace(/\\\\/g, '/') +\n\t\t\t\t\t'/' +\n\t\t\t\t\toutFile\n\t\t\t\t).replace(/\\\\+/g, '/'),\n\t\t\t\tmeta,\n\t\t\t});\n\t\t}\n\t}\n\n\t// Write .reroute/content.ts (types for tooling only)\n\tconst lines: string[] = [];\n\tlines.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\tlines.push('/* eslint-disable */');\n\tlines.push('// @ts-nocheck');\n\tlines.push('');\n\tlines.push('export const contents = [');\n\tfor (const e of results) {\n\t\tlines.push(\n\t\t\t\" { collection: '\" +\n\t\t\t\te.collection +\n\t\t\t\t\"', slug: '\" +\n\t\t\t\te.slug +\n\t\t\t\t\"', name: '\" +\n\t\t\t\te.name +\n\t\t\t\t\"', href: '\" +\n\t\t\t\te.href +\n\t\t\t\t\"', module: '\" +\n\t\t\t\te.moduleUrl +\n\t\t\t\t\"', meta: \" +\n\t\t\t\tJSON.stringify(e.meta || {}) +\n\t\t\t\t' },',\n\t\t);\n\t}\n\tlines.push('] as const;');\n\tlines.push('');\n\tlines.push('export const byCollection: Record<string, any[]> = {};');\n\tlines.push(\n\t\t'for (const c of contents) { (byCollection[c.collection] ||= []).push(c as any); }',\n\t);\n\tlines.push('');\n\tlines.push(\n\t\t'export const byCollectionAndName: Record<string, Record<string, any>> = {};',\n\t);\n\tlines.push(\n\t\t'for (const c of contents) { ((byCollectionAndName[c.collection] ||= {})[c.name] = c as any); }',\n\t);\n\tlines.push('');\n\tlines.push('export type Collections = keyof typeof byCollection;');\n\tlines.push(\n\t\t'export type Names<C extends Collections> = keyof (typeof byCollectionAndName)[C];',\n\t);\n\tlines.push('export type ContentEntry = (typeof contents)[number];');\n\tlines.push('');\n\tlines.push(\n\t\t'export function getContentEntry<C extends string, N extends string>(collection: C, name: N) {',\n\t);\n\tlines.push(' const m = (byCollectionAndName as any)[collection];');\n\tlines.push(' return m ? (m as Record<string, any>)[name] : undefined;');\n\tlines.push('}');\n\tlines.push('');\n\n\tawait mkdir(join(cwd, '.reroute'), { recursive: true });\n\tawait writeFile(join(cwd, OUTPUT_CONTENT_TS), lines.join('\\n'), 'utf-8');\n\tconsole.log(`[reroute/content] wrote ${join(cwd, OUTPUT_CONTENT_TS)}`);\n\n\t// Write per-collection runtime ESM files under .reroute/collections/<collection>.js\n\tconst collectionsSet = new Set(results.map((r) => r.collection));\n\tawait mkdir(join(cwd, OUTPUT_COLLECTIONS_DIR), { recursive: true });\n\tfor (const collection of collectionsSet) {\n\t\tconst items = results.filter((r) => r.collection === collection);\n\t\tconst js: string[] = [];\n\t\tjs.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\t\tjs.push('');\n\t\tjs.push('export const items = [');\n\t\tfor (const e of items) {\n\t\t\tjs.push(\n\t\t\t\t` { collection: '${e.collection}', slug: '${e.slug}', name: '${e.name}', href: '${e.href}', module: '${e.moduleUrl}', meta: ${JSON.stringify(e.meta || {})} },`,\n\t\t\t);\n\t\t}\n\t\tjs.push('];');\n\t\tjs.push('');\n\t\tjs.push('export const byName = {};');\n\t\tjs.push('for (const it of items) { byName[it.name] = it; }');\n\t\tjs.push('');\n\t\tjs.push('export function get(collectionName, name) {');\n\t\tjs.push(` if (collectionName !== '${collection}') return undefined;`);\n\t\tjs.push(' return byName[name];');\n\t\tjs.push('}');\n\t\tjs.push('');\n\n\t\tawait writeFile(\n\t\t\tjoin(cwd, OUTPUT_COLLECTIONS_DIR, `${collection}.js`),\n\t\t\tjs.join('\\n'),\n\t\t\t'utf-8',\n\t\t);\n\t\tconsole.log(\n\t\t\t`[reroute/content] wrote ${join(cwd, OUTPUT_COLLECTIONS_DIR, `${collection}.js`)}`,\n\t\t);\n\t}\n}\n\nasync function generate(cwd: string) {\n\tconsole.log('[reroute/gen] Starting generation...');\n\n\t// Cleanup old generated files due to SSR issues for non-watch mode\n\tawait cleanupOutputDir(cwd);\n\n\t// Routes\n\tconst routesPath = join(cwd, ROUTES_DIR);\n\ttry {\n\t\tconst files = await scanDirectory(routesPath);\n\t\tconst nfFiles = await scan404Files(routesPath);\n\t\tconst all = Array.from(new Set([...files, ...nfFiles]));\n\t\tconst tree = generateRouteTree(all.map((f) => f.replace(/\\\\/g, '/')));\n\t\tconst ts = generateTypeScript(tree);\n\t\tawait mkdir(join(cwd, '.reroute'), { recursive: true });\n\t\tawait writeFile(join(cwd, OUTPUT_ROUTES), ts, 'utf-8');\n\t\tconsole.log(`[reroute/gen] Generated routes: ${join(cwd, OUTPUT_ROUTES)}`);\n\t} catch (error) {\n\t\tconsole.error('[reroute/gen] Failed to generate routes:', error);\n\t\tthrow error;\n\t}\n\n\t// Content\n\ttry {\n\t\tawait buildContentChunks(cwd);\n\t\tconsole.log(\n\t\t\t`[reroute/gen] Generated content: ${join(cwd, OUTPUT_CONTENT_TS)} + collections/*.js`,\n\t\t);\n\t} catch (error) {\n\t\tconsole.error('[reroute/gen] Failed to generate content:', error);\n\t\tthrow error;\n\t}\n\n\t// Write .reroute/index.ts aggregator\n\tconst indexLines: string[] = [];\n\tindexLines.push('// 🚨 Auto-generated by Reroute - DO NOT EDIT 🚨');\n\tindexLines.push('/* eslint-disable */');\n\tindexLines.push('// @ts-nocheck');\n\tindexLines.push('');\n\tindexLines.push(\n\t\t\"import { layouts, matchRoute, notFoundRoutes } from './routes';\",\n\t);\n\tindexLines.push('');\n\tindexLines.push('export const artifacts = {');\n\tindexLines.push(' layouts,');\n\tindexLines.push(' matchRoute,');\n\tindexLines.push(' notFoundRoutes,');\n\tindexLines.push(\" contentBaseUrl: '/.reroute/collections'\");\n\tindexLines.push('} as const;');\n\tindexLines.push('');\n\tindexLines.push('export type RerouteArtifacts = typeof artifacts;');\n\tawait writeFile(join(cwd, OUTPUT_INDEX), indexLines.join('\\n'), 'utf-8');\n\tconsole.log(`[reroute/gen] Generated index: ${join(cwd, OUTPUT_INDEX)}`);\n\n\tconsole.log('[reroute/gen] āœ… Generation complete!');\n}\n\nexport default async function gen(args: string[]) {\n\tconst watchMode = args.includes('--watch') || args.includes('-w');\n\tconst cwd = process.cwd();\n\n\tif (watchMode) {\n\t\tconsole.log('[reroute/gen] Watch mode enabled');\n\t\tconsole.log('[reroute/gen] Initial generation...');\n\t\tawait generate(cwd);\n\n\t\t// Initial Tailwind build (ignore if Tailwind is not configured)\n\t\ttry {\n\t\t\tawait buildTailwind(cwd);\n\t\t} catch {}\n\n\t\t// Watch for file changes\n\t\tconst routesPath = join(cwd, ROUTES_DIR);\n\t\tconsole.log(`[reroute/gen] Watching ${routesPath} for changes...`);\n\n\t\tlet timeout: NodeJS.Timeout | null = null;\n\n\t\t// Use fs.watch for cross-platform compatibility\n\t\tconst watcher = watch(\n\t\t\troutesPath,\n\t\t\t{ recursive: true },\n\t\t\t(_eventType, filename) => {\n\t\t\t\tif (!filename) return;\n\n\t\t\t\t// Debounce: wait 300ms after last change\n\t\t\t\tif (timeout) clearTimeout(timeout);\n\t\t\t\ttimeout = setTimeout(async () => {\n\t\t\t\t\tconsole.log('[reroute/gen] Change detected, regenerating...');\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait generate(cwd);\n\t\t\t\t\t\t// Rebuild Tailwind to capture class changes in routes\n\t\t\t\t\t\tawait buildTailwind(cwd);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error('[reroute/gen] Error during regeneration:', error);\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t},\n\t\t);\n\n\t\t// Also watch src/client for component/template changes and rebuild Tailwind\n\t\tconst clientPath = join(cwd, 'src', 'client');\n\t\tconsole.log(\n\t\t\t`[reroute/gen] Watching ${clientPath} for Tailwind class changes...`,\n\t\t);\n\t\tlet twTimeout: NodeJS.Timeout | null = null;\n\t\tconst twWatcher = watch(\n\t\t\tclientPath,\n\t\t\t{ recursive: true },\n\t\t\t(_eventType, filename) => {\n\t\t\t\tif (!filename) return;\n\t\t\t\t// Skip generated, node_modules and route files (handled by routes watcher)\n\t\t\t\tif (filename.includes('.reroute') || filename.includes('node_modules'))\n\t\t\t\t\treturn;\n\t\t\t\tif (filename.includes('routes/') || filename.includes('routes\\\\'))\n\t\t\t\t\treturn;\n\t\t\t\tif (!/\\.(tsx|ts|jsx|js|html|md|mdx|css)$/.test(filename)) return;\n\n\t\t\t\tif (twTimeout) clearTimeout(twTimeout);\n\t\t\t\ttwTimeout = setTimeout(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait buildTailwind(cwd);\n\t\t\t\t\t} catch {}\n\t\t\t\t}, 200);\n\t\t\t},\n\t\t);\n\n\t\t// Keep the process running\n\t\tprocess.on('SIGINT', () => {\n\t\t\tconsole.log('\\n[reroute/gen] Stopping watch mode...');\n\t\t\twatcher.close();\n\t\t\ttwWatcher.close();\n\t\t\tprocess.exit(0);\n\t\t});\n\t} else {\n\t\tawait generate(cwd);\n\n\t\t// Build Tailwind CSS once in non-watch mode\n\t\tinitTailwind(cwd, false);\n\t}\n}\n",
10
23
  "#!/usr/bin/env bun\n\n/**\n * Reroute CLI\n *\n * Command-line interface for Reroute framework operations.\n */\n\nconst commands = {\n\tinit: () => import('./commands/init'),\n\tbuild: () => import('./commands/build'),\n\tdev: () => import('./commands/dev'),\n\tgen: () => import('./commands/gen'),\n};\n\ntype Command = keyof typeof commands;\n\nasync function main() {\n\tconst args = process.argv.slice(2);\n\n\tif (args.length === 0 || args[0] === '--help' || args[0] === '-h') {\n\t\tprintHelp();\n\t\tprocess.exit(0);\n\t}\n\n\tconst command = args[0] as Command;\n\n\tif (!commands[command]) {\n\t\tconsole.error(`Unknown command: ${command}`);\n\t\tconsole.error('');\n\t\tprintHelp();\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tconst module = await commands[command]();\n\t\tawait module.default(args.slice(1));\n\t} catch (error) {\n\t\tconsole.error('Error executing command:', error);\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction printHelp() {\n\tconsole.log('Reroute CLI - File-based routing framework');\n\tconsole.log('');\n\tconsole.log('Usage:');\n\tconsole.log(' reroute <command> [options]');\n\tconsole.log('');\n\tconsole.log('Commands:');\n\tconsole.log(' gen Generate content registry and static assets');\n\tconsole.log(' init Scaffold a new Reroute project');\n\tconsole.log(' build Build for production');\n\tconsole.log(' dev Start development server');\n\tconsole.log('');\n\tconsole.log('Options:');\n\tconsole.log(' -h, --help Show help');\n\tconsole.log('');\n\tconsole.log('Examples:');\n\tconsole.log(' reroute gen');\n\tconsole.log(' reroute gen --watch');\n\tconsole.log(' reroute init my-app');\n\tconsole.log(' reroute build --minify');\n\tconsole.log(' reroute dev --port 3000');\n}\n\nmain();\n\nexport {};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QAAQ,IAAI,eAAe;AAAA,EAC3B,QAAQ,IAAI,uBAAuB;AAAA,EACnC,QAAQ,IAAI,uBAAuB;AAAA,EACnC,QAAQ,IAAI,0BAA0B;AAAA,EACtC,QAAQ,IAAI,2BAA2B;AAAA;AAGxC,KAAK;",
26
+ "debugId": "D904E39CF66BD8B664756E2164756E21",
14
27
  "names": []
15
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gen.d.ts","sourceRoot":"","sources":["../../../../../../packages/cli/src/commands/gen.ts"],"names":[],"mappings":";AA2jBA,wBAA8B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBAkF/C"}
1
+ {"version":3,"file":"gen.d.ts","sourceRoot":"","sources":["../../../../../../packages/cli/src/commands/gen.ts"],"names":[],"mappings":";AA8jBA,wBAA8B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBAkF/C"}
@@ -9,10 +9,6 @@ interface TailwindProcess {
9
9
  process: ChildProcess;
10
10
  stop: () => void;
11
11
  }
12
- /**
13
- * Build Tailwind CSS using the Tailwind CLI
14
- */
15
- export declare function buildTailwind(cwd: string): Promise<void>;
16
12
  /**
17
13
  * Initialize Tailwind CSS integration
18
14
  * Returns null if Tailwind is not available or configured
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/cli/src/libs/tailwind.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,UAAU,eAAe;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,IAAI,CAAC;CACjB;AAyED;;GAEG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB9D;AAiCD;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,GAAG,EAAE,MAAM,EACX,KAAK,UAAQ,GACX,eAAe,GAAG,IAAI,CA8BxB"}
1
+ {"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/cli/src/libs/tailwind.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAUvD,UAAU,eAAe;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,IAAI,CAAC;CACjB;AAiCD;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,GAAG,EAAE,MAAM,EACX,KAAK,UAAQ,GACX,eAAe,GAAG,IAAI,CA8BxB"}
package/core/index.js CHANGED
@@ -69,10 +69,6 @@ async function transpileFile(filePath, originalPath, options, bundleCache) {
69
69
  let result;
70
70
  try {
71
71
  result = await doBuild(options.sourcemap ? "external" : "none");
72
- if (!result.success) {
73
- console.warn(`[reroute] Build failed for ${originalPath}, retrying without sourcemap...`);
74
- result = await doBuild("none");
75
- }
76
72
  } catch (error) {
77
73
  console.warn(`[reroute] Build errored for ${originalPath} (sourcemap external). Retrying without sourcemap...`, error);
78
74
  result = await doBuild("none");
@@ -1058,6 +1054,82 @@ ${ssrHead}`;
1058
1054
  status: statusOverride || 200
1059
1055
  };
1060
1056
  }
1057
+ // packages/core/src/tailwind.ts
1058
+ import { spawn } from "node:child_process";
1059
+ import { existsSync, readFileSync } from "node:fs";
1060
+ import { join as join2 } from "node:path";
1061
+ function isTailwindAvailable(cwd) {
1062
+ const packageJsonPath = join2(cwd, "package.json");
1063
+ if (!existsSync(packageJsonPath))
1064
+ return false;
1065
+ try {
1066
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
1067
+ const deps = {
1068
+ ...packageJson.dependencies,
1069
+ ...packageJson.devDependencies
1070
+ };
1071
+ return !!deps && "@tailwindcss/cli" in deps;
1072
+ } catch {
1073
+ return false;
1074
+ }
1075
+ }
1076
+ function getTailwindPaths(cwd) {
1077
+ const input = join2(cwd, "src/client/theme.css");
1078
+ const output = join2(cwd, ".reroute/theme.css");
1079
+ return { input, output };
1080
+ }
1081
+ function hasTailwindInput(cwd) {
1082
+ const { input } = getTailwindPaths(cwd);
1083
+ if (!existsSync(input))
1084
+ return false;
1085
+ try {
1086
+ const content = readFileSync(input, "utf-8");
1087
+ return content.includes('@import "tailwindcss"');
1088
+ } catch {
1089
+ return false;
1090
+ }
1091
+ }
1092
+ function resolveTailwindBin(cwd) {
1093
+ const pathsToTry = [
1094
+ join2(cwd, "node_modules/.bin/tailwindcss"),
1095
+ join2(cwd, "../node_modules/.bin/tailwindcss"),
1096
+ join2(cwd, "../../node_modules/.bin/tailwindcss"),
1097
+ join2(cwd, "../../../node_modules/.bin/tailwindcss")
1098
+ ];
1099
+ for (const binPath of pathsToTry)
1100
+ if (existsSync(binPath))
1101
+ return binPath;
1102
+ return join2(cwd, "node_modules/.bin/tailwindcss");
1103
+ }
1104
+ async function buildTailwind(cwd) {
1105
+ const { input, output } = getTailwindPaths(cwd);
1106
+ if (!isTailwindAvailable(cwd) || !hasTailwindInput(cwd))
1107
+ return;
1108
+ await new Promise((resolve, reject) => {
1109
+ const tailwindBin = resolveTailwindBin(cwd);
1110
+ const args = ["-i", input, "-o", output];
1111
+ const tailwind = spawn(tailwindBin, args, { cwd, stdio: "inherit" });
1112
+ tailwind.on("close", (code) => code === 0 ? resolve() : reject(new Error(`Tailwind CSS build failed with code ${code}`)));
1113
+ tailwind.on("error", (error) => reject(error));
1114
+ });
1115
+ }
1116
+ function watchTailwind(cwd) {
1117
+ if (!isTailwindAvailable(cwd) || !hasTailwindInput(cwd))
1118
+ return null;
1119
+ const { input, output } = getTailwindPaths(cwd);
1120
+ const tailwindBin = resolveTailwindBin(cwd);
1121
+ const args = ["-i", input, "-o", output, "--watch"];
1122
+ console.log("[reroute/tailwind] Starting Tailwind CSS v4 in watch mode...");
1123
+ const child = spawn(tailwindBin, args, { cwd, stdio: "inherit" });
1124
+ child.on("error", (e) => console.error("[reroute/tailwind] Error:", e));
1125
+ const stop = () => {
1126
+ try {
1127
+ console.log("[reroute/tailwind] Stopping Tailwind CSS...");
1128
+ child.kill();
1129
+ } catch {}
1130
+ };
1131
+ return { process: child, stop };
1132
+ }
1061
1133
  // packages/core/src/utils/cache.ts
1062
1134
  class LRUCache {
1063
1135
  cache;
@@ -1143,18 +1215,23 @@ function gzipIfAccepted(body, contentType, acceptEncoding) {
1143
1215
  return { body, extraHeaders };
1144
1216
  }
1145
1217
  export {
1218
+ watchTailwind,
1146
1219
  transpileFile,
1147
1220
  toBytes,
1148
1221
  stripStart,
1149
1222
  stripEnd,
1150
1223
  seedSSRModuleForPath,
1224
+ resolveTailwindBin,
1151
1225
  renderSSRDocument,
1152
1226
  rebuildContentArtifacts,
1153
1227
  loadIndexHtml,
1154
1228
  listContentFiles,
1155
1229
  join,
1230
+ isTailwindAvailable,
1156
1231
  isCompressible,
1232
+ hasTailwindInput,
1157
1233
  gzipIfAccepted,
1234
+ getTailwindPaths,
1158
1235
  getMimeType,
1159
1236
  getContentMeta,
1160
1237
  getBundleUrlsFor,
@@ -1163,6 +1240,7 @@ export {
1163
1240
  extname,
1164
1241
  discoverCollections,
1165
1242
  computeSSRDataForPath,
1243
+ buildTailwind,
1166
1244
  buildHeadFromMeta,
1167
1245
  buildContentDTOs,
1168
1246
  basename,
@@ -1171,4 +1249,4 @@ export {
1171
1249
  LRUCache
1172
1250
  };
1173
1251
 
1174
- //# debugId=3C32F25BA85F27F764756E2164756E21
1252
+ //# debugId=1CB13E5E79EA18C464756E2164756E21