Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
No EOL
7.9 KiB
Text
1 line
No EOL
7.9 KiB
Text
{"version":3,"sources":["../../src/lib/resolve-build-paths.ts"],"sourcesContent":["import { promisify } from 'util'\nimport globOriginal from 'next/dist/compiled/glob'\nimport * as Log from '../build/output/log'\nimport path from 'path'\nimport fs from 'fs'\nimport isError from './is-error'\n\nconst glob = promisify(globOriginal)\n\ninterface ResolvedBuildPaths {\n appPaths: string[]\n pagePaths: string[]\n}\n\n/**\n * Resolves glob patterns and explicit paths to actual file paths\n * Categorizes them into App Router and Pages Router paths\n *\n * @param patterns - Array of glob patterns or explicit paths\n * @param projectDir - Root project directory\n * @returns Object with categorized app and page paths\n */\nexport async function resolveBuildPaths(\n patterns: string[],\n projectDir: string\n): Promise<ResolvedBuildPaths> {\n const appPaths: Set<string> = new Set()\n const pagePaths: Set<string> = new Set()\n\n for (const pattern of patterns) {\n const trimmed = pattern.trim()\n\n if (!trimmed) {\n continue\n }\n\n // Detect if pattern is glob pattern (contains glob special chars)\n const isGlobPattern = /[*?[\\]{}!]/.test(trimmed)\n\n if (isGlobPattern) {\n try {\n // Resolve glob pattern\n const matches = (await glob(trimmed, {\n cwd: projectDir,\n })) as string[]\n\n if (matches.length === 0) {\n Log.warn(`Glob pattern \"${trimmed}\" did not match any files`)\n }\n\n for (const file of matches) {\n // Skip directories, only process files\n if (!fs.statSync(path.join(projectDir, file)).isDirectory()) {\n categorizeAndAddPath(file, appPaths, pagePaths)\n }\n }\n } catch (error) {\n throw new Error(\n `Failed to resolve glob pattern \"${trimmed}\": ${\n isError(error) ? error.message : String(error)\n }`\n )\n }\n } else {\n // Explicit path - categorize based on prefix\n categorizeAndAddPath(trimmed, appPaths, pagePaths, projectDir)\n }\n }\n\n return {\n appPaths: Array.from(appPaths).sort(),\n pagePaths: Array.from(pagePaths).sort(),\n }\n}\n\n/**\n * Categorizes a file path to either app or pages router based on its prefix,\n * and normalizes it to the format expected by Next.js internal build system.\n *\n * The internal build system expects:\n * - App router: paths with leading slash (e.g., \"/page.tsx\", \"/dashboard/page.tsx\")\n * - Pages router: paths with leading slash (e.g., \"/index.tsx\", \"/about.tsx\")\n *\n * Examples:\n * - \"app/page.tsx\" → appPaths.add(\"/page.tsx\")\n * - \"app/dashboard/page.tsx\" → appPaths.add(\"/dashboard/page.tsx\")\n * - \"pages/index.tsx\" → pagePaths.add(\"/index.tsx\")\n * - \"pages/about.tsx\" → pagePaths.add(\"/about.tsx\")\n * - \"/page.tsx\" → appPaths.add(\"/page.tsx\") (already in app router format)\n */\nfunction categorizeAndAddPath(\n filePath: string,\n appPaths: Set<string>,\n pagePaths: Set<string>,\n projectDir?: string\n): void {\n // Normalize path separators to forward slashes (Windows compatibility)\n const normalized = filePath.replace(/\\\\/g, '/')\n\n // Skip non-file entries (like directories without extensions)\n if (normalized.endsWith('/')) {\n return\n }\n\n if (normalized.startsWith('app/')) {\n // App router path: remove 'app/' prefix and ensure leading slash\n // \"app/page.tsx\" → \"/page.tsx\"\n // \"app/dashboard/page.tsx\" → \"/dashboard/page.tsx\"\n const withoutPrefix = normalized.slice(4) // Remove \"app/\"\n appPaths.add('/' + withoutPrefix)\n } else if (normalized.startsWith('pages/')) {\n // Pages router path: remove 'pages/' prefix and add leading slash\n // \"pages/index.tsx\" → \"/index.tsx\"\n // \"pages/about.tsx\" → \"/about.tsx\"\n const withoutPrefix = normalized.slice(6) // Remove \"pages/\"\n pagePaths.add('/' + withoutPrefix)\n } else if (normalized.startsWith('/')) {\n // Leading slash suggests app router format (already in correct format)\n // \"/page.tsx\" → \"/page.tsx\" (no change needed)\n appPaths.add(normalized)\n } else {\n // No obvious prefix - try to detect based on file existence\n if (projectDir) {\n const appPath = path.join(projectDir, 'app', normalized)\n const pagesPath = path.join(projectDir, 'pages', normalized)\n\n if (fs.existsSync(appPath)) {\n appPaths.add('/' + normalized)\n } else if (fs.existsSync(pagesPath)) {\n pagePaths.add('/' + normalized)\n } else {\n // Default to pages router for paths without clear indicator\n pagePaths.add('/' + normalized)\n }\n } else {\n // Without projectDir context, default to pages router\n pagePaths.add('/' + normalized)\n }\n }\n}\n\n/**\n * Parse build paths from comma-separated format\n * Supports:\n * - Comma-separated values: \"app/page.tsx,app/about/page.tsx\"\n *\n * @param input - String input to parse\n * @returns Array of path patterns\n */\nexport function parseBuildPathsInput(input: string): string[] {\n // Comma-separated values\n return input\n .split(',')\n .map((p) => p.trim())\n .filter((p) => p.length > 0)\n}\n"],"names":["parseBuildPathsInput","resolveBuildPaths","glob","promisify","globOriginal","patterns","projectDir","appPaths","Set","pagePaths","pattern","trimmed","trim","isGlobPattern","test","matches","cwd","length","Log","warn","file","fs","statSync","path","join","isDirectory","categorizeAndAddPath","error","Error","isError","message","String","Array","from","sort","filePath","normalized","replace","endsWith","startsWith","withoutPrefix","slice","add","appPath","pagesPath","existsSync","input","split","map","p","filter"],"mappings":";;;;;;;;;;;;;;;IAqJgBA,oBAAoB;eAApBA;;IA/HMC,iBAAiB;eAAjBA;;;sBAtBI;6DACD;6DACJ;6DACJ;2DACF;gEACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,MAAMC,OAAOC,IAAAA,eAAS,EAACC,aAAY;AAe5B,eAAeH,kBACpBI,QAAkB,EAClBC,UAAkB;IAElB,MAAMC,WAAwB,IAAIC;IAClC,MAAMC,YAAyB,IAAID;IAEnC,KAAK,MAAME,WAAWL,SAAU;QAC9B,MAAMM,UAAUD,QAAQE,IAAI;QAE5B,IAAI,CAACD,SAAS;YACZ;QACF;QAEA,kEAAkE;QAClE,MAAME,gBAAgB,aAAaC,IAAI,CAACH;QAExC,IAAIE,eAAe;YACjB,IAAI;gBACF,uBAAuB;gBACvB,MAAME,UAAW,MAAMb,KAAKS,SAAS;oBACnCK,KAAKV;gBACP;gBAEA,IAAI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