Duffer Derek
{"version":3,"sources":["../../src/build/print-build-errors.ts"],"sourcesContent":["import { formatIssue, isRelevantWarning } from '../shared/lib/turbopack/utils'\nimport type { TurbopackResult } from './swc/types'\n\n/**\n * Processes and reports build issues from Turbopack entrypoints.\n *\n * @param entrypoints - The result object containing build issues to process.\n * @param isDev - A flag indicating if the build is running in development mode.\n * @return This function does not return a value but logs or throws errors based on the issues.\n * @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on\n * 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.\n */\nexport function printBuildErrors(\n entrypoints: TurbopackResult,\n isDev: boolean\n): void {\n // Issues that we want to stop the server from executing\n const topLevelFatalIssues = []\n // Issues that are true errors, but we believe we can keep running and allow the user to address the issue\n const topLevelErrors = []\n // Issues that are warnings but should not affect the running of the build\n const topLevelWarnings = []\n\n // Track seen formatted error messages to avoid duplicates\n const seenFatalIssues = new Set<string>()\n const seenErrors = new Set<string>()\n const seenWarnings = new Set<string>()\n\n for (const issue of entrypoints.issues) {\n // We only want to completely shut down the server\n if (issue.severity === 'fatal' || issue.severity === 'bug') {\n const formatted = formatIssue(issue)\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n } else if (isRelevantWarning(issue)) {\n const formatted = formatIssue(issue)\n if (!seenWarnings.has(formatted)) {\n seenWarnings.add(formatted)\n topLevelWarnings.push(formatted)\n }\n } else if (issue.severity === 'error') {\n const formatted = formatIssue(issue)\n if (isDev) {\n // We want to treat errors as recoverable in development\n // so that we can show the errors in the site and allow users\n // to respond to the errors when necessary. In production builds\n // though we want to error out and stop the build process.\n if (!seenErrors.has(formatted)) {\n seenErrors.add(formatted)\n topLevelErrors.push(formatted)\n }\n } else {\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n }\n }\n }\n // TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors\n if (topLevelWarnings.length > 0) {\n console.warn(\n `Turbopack build encountered ${\n topLevelWarnings.length\n } warnings:\\n${topLevelWarnings.join('\\n')}`\n )\n }\n\n if (topLevelErrors.length > 0) {\n console.error(\n `Turbopack build encountered ${\n topLevelErrors.length\n } errors:\\n${topLevelErrors.join('\\n')}`\n )\n }\n\n if (topLevelFatalIssues.length > 0) {\n throw new Error(\n `Turbopack build failed with ${\n topLevelFatalIssues.length\n } errors:\\n${topLevelFatalIssues.join('\\n')}`\n )\n }\n}\n"],"names":["printBuildErrors","entrypoints","isDev","topLevelFatalIssues","topLevelErrors","topLevelWarnings","seenFatalIssues","Set","seenErrors","seenWarnings","issue","issues","severity","formatted","formatIssue","has","add","push","isRelevantWarning","length","console","warn","join","error","Error"],"mappings":";;;;+BAYgBA;;;eAAAA;;;uBAZ+B;AAYxC,SAASA,iBACdC,WAA4B,EAC5BC,KAAc;IAEd,wDAAwD;IACxD,MAAMC,sBAAsB,EAAE;IAC9B,0GAA0G;IAC1G,MAAMC,iBAAiB,EAAE;IACzB,0EAA0E;IAC1E,MAAMC,mBAAmB,EAAE;IAE3B,0DAA0D;IAC1D,MAAMC,kBAAkB,IAAIC;IAC5B,MAAMC,aAAa,IAAID;IACvB,MAAME,eAAe,IAAIF;IAEzB,KAAK,MAAMG,SAAST,YAAYU,MAAM,CAAE;QACtC,kDAAkD;QAClD,IAAID,MAAME,QAAQ,KAAK,WAAWF,MAAME,QAAQ,KAAK,OAAO;YAC1D,MAAMC,YAAYC,IAAAA,kBAAW,EAACJ;YAC9B,IAAI,CAACJ,gBAAgBS,GAAG,CAACF,YAAY;gBACnCP,gBAAgBU,GAAG,CAACH;gBACpBV,oBAAoBc,IAAI,CAACJ;YAC3B;QACF,OAAO,IAAIK,IAAAA,wBAAiB,EAACR,QAAQ;YACnC,MAAMG,YAAYC,IAAAA,kBAAW,EAACJ;YAC9B,IAAI,CAACD,aAAaM,GAAG,CAACF,YAAY;gBAChCJ,aAAaO,GAAG,CAACH;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