Duffer Derek

Current Path : /var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/next/dist/lib/
Upload File :
Current File : /var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/next/dist/lib/resolve-build-paths.js.map

{"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 * Escapes Next.js dynamic route bracket expressions so glob treats them as\n * literal directory names rather than character classes.\n *\n * e.g., \"app/blog/[slug]/** /page.tsx\" → \"app/blog/\\[slug\\]/** /page.tsx\"\n */\nfunction escapeBrackets(pattern: string): string {\n  // Match Next.js dynamic route patterns: [name], [...name], [[...name]]\n  return pattern.replace(/\\[\\[?\\.\\.\\.[^\\]]+\\]?\\]|\\[[^\\]]+\\]/g, (match) =>\n    match.replace(/\\[/g, '\\\\[').replace(/\\]/g, '\\\\]')\n  )\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 * Supports negation patterns prefixed with \"!\" to exclude paths.\n * e.g., \"app/**,!app/[lang]/page.js\" includes all App Router paths except\n * app/[lang]/page.js\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  const includePatterns: string[] = []\n  const excludePatterns: string[] = []\n\n  for (const pattern of patterns) {\n    const trimmed = pattern.trim()\n    if (!trimmed) continue\n\n    if (trimmed.startsWith('!')) {\n      excludePatterns.push(escapeBrackets(trimmed.slice(1)))\n    } else {\n      includePatterns.push(escapeBrackets(trimmed))\n    }\n  }\n\n  // Default to matching all files when only negation patterns are provided.\n  if (includePatterns.length === 0 && excludePatterns.length > 0) {\n    includePatterns.push('**')\n  }\n\n  // Combine patterns using brace expansion: {pattern1,pattern2}\n  const combinedPattern =\n    includePatterns.length === 1\n      ? includePatterns[0]\n      : `{${includePatterns.join(',')}}`\n\n  try {\n    const matches = (await glob(combinedPattern, {\n      cwd: projectDir,\n      ignore: excludePatterns,\n    })) as string[]\n\n    if (matches.length === 0) {\n      Log.warn(`Pattern \"${patterns.join(',')}\" did not match any files`)\n    }\n\n    for (const file of matches) {\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 pattern \"${patterns.join(',')}\": ${\n        isError(error) ? error.message : String(error)\n      }`\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 * For app router, only route-defining files (page.*, route.*) are included.\n *\n * Examples:\n * - \"app/page.tsx\" → appPaths.add(\"/page.tsx\")\n * - \"app/layout.tsx\" → skipped (not a route file)\n * - \"pages/index.tsx\" → pagePaths.add(\"/index.tsx\")\n */\nfunction categorizeAndAddPath(\n  filePath: string,\n  appPaths: Set<string>,\n  pagePaths: Set<string>\n): void {\n  const normalized = filePath.replace(/\\\\/g, '/')\n\n  if (normalized.startsWith('app/')) {\n    // Only include route-defining files (page.* or route.*)\n    if (/\\/(page|route)\\.[^/]+$/.test(normalized)) {\n      appPaths.add('/' + normalized.slice(4))\n    }\n  } else if (normalized.startsWith('pages/')) {\n    pagePaths.add('/' + normalized.slice(6))\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","escapeBrackets","pattern","replace","match","patterns","projectDir","appPaths","Set","pagePaths","includePatterns","excludePatterns","trimmed","trim","startsWith","push","slice","length","combinedPattern","join","matches","cwd","ignore","Log","warn","file","fs","statSync","path","isDirectory","categorizeAndAddPath","error","Error","isError","message","String","Array","from","sort","filePath","normalized","test","add","input","split","map","p","filter"],"mappings":";;;;;;;;;;;;;;;IAkIgBA,oBAAoB;eAApBA;;IA/FMC,iBAAiB;eAAjBA;;;sBAnCI;6DACD;6DACJ;6DACJ;2DACF;gEACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,MAAMC,OAAOC,IAAAA,eAAS,EAACC,aAAY;AAOnC;;;;;CAKC,GACD,SAASC,eAAeC,OAAe;IACrC,uEAAuE;IACvE,OAAOA,QAAQC,OAAO,CAAC,sCAAsC,CAACC,QAC5DA,MAAMD,OAAO,CAAC,OAAO,OAAOA,OAAO,CAAC,OAAO;AAE/C;AAUO,eAAeN,kBACpBQ,QAAkB,EAClBC,UAAkB;IAElB,MAAMC,WAAwB,IAAIC;IAClC,MAAMC,YAAyB,IAAID;IAEnC,MAAME,kBAA4B,EAAE;IACpC,MAAMC,kBAA4B,EAAE;IAEpC,KAAK,MAAMT,WAAWG,SAAU;QAC9B,MAAMO,UAAUV,QAAQW,IAAI;QAC5B,IAAI,CAACD,SAAS;QAEd,IAAIA,QAAQE,UAAU,CAAC,MAAM;YAC3BH,gBAAgBI,IAAI,CAACd,eAAeW,QAAQI,KAAK,CAAC;QACpD,OAAO;YACLN,gBAAgBK,IAAI,CAACd,eAAeW;QACtC;IACF;IAEA,0EAA0E;IAC1E,IAAIF,gBAAgBO,MAAM,KAAK,KAAKN,gBAAgBM,MAAM,GAAG,GAAG;QAC9DP,gBAAgBK,IAAI,CAAC;IACvB;IAEA,8DAA8D;IAC9D,MAAMG,kBACJR,gBAAgBO,MAAM,KAAK,IACvB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