{"ast":null,"code":"/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nconst friendlySyntaxErrorLabel = 'Syntax error:';\n\nfunction isLikelyASyntaxError(message) {\n return message.indexOf(friendlySyntaxErrorLabel) !== -1;\n} // Cleans up webpack error messages.\n\n\nfunction formatMessage(message) {\n let lines = message.split('\\n'); // Strip webpack-added headers off errors/warnings\n // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js\n\n lines = lines.filter(line => !/Module [A-z ]+\\(from/.test(line)); // Transform parsing error into syntax error\n // TODO: move this to our ESLint formatter?\n\n lines = lines.map(line => {\n const parsingError = /Line (\\d+):(?:(\\d+):)?\\s*Parsing error: (.+)$/.exec(line);\n\n if (!parsingError) {\n return line;\n }\n\n const [, errorLine, errorColumn, errorMessage] = parsingError;\n return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;\n });\n message = lines.join('\\n'); // Smoosh syntax errors (commonly found in CSS)\n\n message = message.replace(/SyntaxError\\s+\\((\\d+):(\\d+)\\)\\s*(.+?)\\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\\n`); // Clean up export errors\n\n message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`);\n message = message.replace(/^.*export 'default' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`);\n message = message.replace(/^.*export '(.+?)' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);\n lines = message.split('\\n'); // Remove leading newline\n\n if (lines.length > 2 && lines[1].trim() === '') {\n lines.splice(1, 1);\n } // Clean up file name\n\n\n lines[0] = lines[0].replace(/^(.*) \\d+:\\d+-\\d+$/, '$1'); // Cleans up verbose \"module not found\" messages for files and packages.\n\n if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {\n lines = [lines[0], lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:')];\n } // Add helpful message for users trying to use Sass for the first time\n\n\n if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) {\n lines[1] = 'To import Sass files, you first need to install node-sass.\\n';\n lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';\n }\n\n message = lines.join('\\n'); // Internal stacks are generally useless so we strip them... with the\n // exception of stacks containing `webpack:` because they're normally\n // from user code generated by webpack. For more information see\n // https://github.com/facebook/create-react-app/pull/1050\n\n message = message.replace(/^\\s*at\\s((?!webpack:).)*:\\d+:\\d+[\\s)]*(\\n|$)/gm, ''); // at ... ...:x:y\n\n message = message.replace(/^\\s*at\\s(\\n|$)/gm, ''); // at \n\n lines = message.split('\\n'); // Remove duplicated newlines\n\n lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()); // Reassemble the message\n\n message = lines.join('\\n');\n return message.trim();\n}\n\nfunction formatWebpackMessages(json) {\n const formattedErrors = json.errors.map(formatMessage);\n const formattedWarnings = json.warnings.map(formatMessage);\n const result = {\n errors: formattedErrors,\n warnings: formattedWarnings\n };\n\n if (result.errors.some(isLikelyASyntaxError)) {\n // If there are any syntax errors, show just them.\n result.errors = result.errors.filter(isLikelyASyntaxError);\n }\n\n return result;\n}\n\nmodule.exports = formatWebpackMessages;","map":{"version":3,"sources":["/app/node_modules/react-dev-utils/formatWebpackMessages.js"],"names":["friendlySyntaxErrorLabel","isLikelyASyntaxError","message","indexOf","formatMessage","lines","split","filter","line","test","map","parsingError","exec","errorLine","errorColumn","errorMessage","join","replace","length","trim","splice","match","index","arr","formatWebpackMessages","json","formattedErrors","errors","formattedWarnings","warnings","result","some","module","exports"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;;AAEA,MAAMA,wBAAwB,GAAG,eAAjC;;AAEA,SAASC,oBAAT,CAA8BC,OAA9B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AK,CAACE,MAAN,CACN,CAACC,IAAD,EAAOc,KAAP,EAAcC,GAAd,KACED,KAAK,KAAK,CAAV,IAAed,IAAI,CAACW,IAAL,OAAgB,EAA/B,IAAqCX,IAAI,CAACW,IAAL,OAAgBI,GAAG,CAACD,KAAK,GAAG,CAAT,CAAH,CAAeH,IAAf,EAFjD,CAAR,CA9E8B,CAmF9B;;AACAjB,EAAAA,OAAO,GAAGG,KAAK,CAACW,IAAN,CAAW,IAAX,CAAV;AACA,SAAOd,OAAO,CAACiB,IAAR,EAAP;AACD;;AAED,SAASK,qBAAT,CAA+BC,IAA/B,EAAqC;AACnC,QAAMC,eAAe,GAAGD,IAAI,CAACE,MAAL,CAAYjB,GAAZ,CAAgBN,aAAhB,CAAxB;AACA,QAAMwB,iBAAiB,GAAGH,IAAI,CAACI,QAAL,CAAcnB,GAAd,CAAkBN,aAAlB,CAA1B;AACA,QAAM0B,MAAM,GAAG;AAAEH,IAAAA,MAAM,EAAED,eAAV;AAA2BG,IAAAA,QAAQ,EAAED;AAArC,GAAf;;AACA,MAAIE,MAAM,CAACH,MAAP,CAAcI,IAAd,CAAmB9B,oBAAnB,CAAJ,EAA8C;AAC5C;AACA6B,IAAAA,MAAM,CAACH,MAAP,GAAgBG,MAAM,CAACH,MAAP,CAAcpB,MAAd,CAAqBN,oBAArB,CAAhB;AACD;;AACD,SAAO6B,MAAP;AACD;;AAEDE,MAAM,CAACC,OAAP,GAAiBT,qBAAjB","sourcesContent":["/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nconst friendlySyntaxErrorLabel = 'Syntax error:';\n\nfunction isLikelyASyntaxError(message) {\n return message.indexOf(friendlySyntaxErrorLabel) !== -1;\n}\n\n// Cleans up webpack error messages.\nfunction formatMessage(message) {\n let lines = message.split('\\n');\n\n // Strip webpack-added headers off errors/warnings\n // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js\n lines = lines.filter(line => !/Module [A-z ]+\\(from/.test(line));\n\n // Transform parsing error into syntax error\n // TODO: move this to our ESLint formatter?\n lines = lines.map(line => {\n const parsingError = /Line (\\d+):(?:(\\d+):)?\\s*Parsing error: (.+)$/.exec(\n line\n );\n if (!parsingError) {\n return line;\n }\n const [, errorLine, errorColumn, errorMessage] = parsingError;\n return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;\n });\n\n message = lines.join('\\n');\n // Smoosh syntax errors (commonly found in CSS)\n message = message.replace(\n /SyntaxError\\s+\\((\\d+):(\\d+)\\)\\s*(.+?)\\n/g,\n `${friendlySyntaxErrorLabel} $3 ($1:$2)\\n`\n );\n // Clean up export errors\n message = message.replace(\n /^.*export '(.+?)' was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$1' is not exported from '$2'.`\n );\n message = message.replace(\n /^.*export 'default' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$2' does not contain a default export (imported as '$1').`\n );\n message = message.replace(\n /^.*export '(.+?)' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`\n );\n lines = message.split('\\n');\n\n // Remove leading newline\n if (lines.length > 2 && lines[1].trim() === '') {\n lines.splice(1, 1);\n }\n // Clean up file name\n lines[0] = lines[0].replace(/^(.*) \\d+:\\d+-\\d+$/, '$1');\n\n // Cleans up verbose \"module not found\" messages for files and packages.\n if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {\n lines = [\n lines[0],\n lines[1]\n .replace('Error: ', '')\n .replace('Module not found: Cannot find file:', 'Cannot find file:'),\n ];\n }\n\n // Add helpful message for users trying to use Sass for the first time\n if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) {\n lines[1] = 'To import Sass files, you first need to install node-sass.\\n';\n lines[1] +=\n 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';\n }\n\n message = lines.join('\\n');\n // Internal stacks are generally useless so we strip them... with the\n // exception of stacks containing `webpack:` because they're normally\n // from user code generated by webpack. For more information see\n // https://github.com/facebook/create-react-app/pull/1050\n message = message.replace(\n /^\\s*at\\s((?!webpack:).)*:\\d+:\\d+[\\s)]*(\\n|$)/gm,\n ''\n ); // at ... ...:x:y\n message = message.replace(/^\\s*at\\s(\\n|$)/gm, ''); // at \n lines = message.split('\\n');\n\n // Remove duplicated newlines\n lines = lines.filter(\n (line, index, arr) =>\n index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()\n );\n\n // Reassemble the message\n message = lines.join('\\n');\n return message.trim();\n}\n\nfunction formatWebpackMessages(json) {\n const formattedErrors = json.errors.map(formatMessage);\n const formattedWarnings = json.warnings.map(formatMessage);\n const result = { errors: formattedErrors, warnings: formattedWarnings };\n if (result.errors.some(isLikelyASyntaxError)) {\n // If there are any syntax errors, show just them.\n result.errors = result.errors.filter(isLikelyASyntaxError);\n }\n return result;\n}\n\nmodule.exports = formatWebpackMessages;\n"]},"metadata":{},"sourceType":"script"}