1 line
12 KiB
JSON
1 line
12 KiB
JSON
|
{"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\nvar _slicedToArray = require(\"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/slicedToArray\");\n\nvar chalk = require('chalk');\n\nvar 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 var 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(function (line) {\n return !/Module [A-z ]+\\(from/.test(line);\n }); // Transform parsing error into syntax error\n // TODO: move this to our ESLint formatter?\n\n lines = lines.map(function (line) {\n var parsingError = /Line (\\d+):(?:(\\d+):)?\\s*Parsing error: (.+)$/.exec(line);\n\n if (!parsingError) {\n return line;\n }\n\n var _parsingError = _slicedToArray(parsingError, 4),\n errorLine = _parsingError[1],\n errorColumn = _parsingError[2],\n errorMessage = _parsingError[3];\n\n return \"\".concat(friendlySyntaxErrorLabel, \" \").concat(errorMessage, \" (\").concat(errorLine, \":\").concat(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, \"\".concat(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 lines[0] = chalk.inverse(lines[0]);\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<anonymous>(\\n|$)/gm, ''); // at <anonymous>\n\n lines = message.split('\\n'); // Remove duplicated newlines\n\n lines = lines.filter(function (line, index, arr) {\n return index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim();\n }); // Reassemble the message\n\n message = lines.join('\\n');\n return message.trim();\n}\n\nfunction formatWebpackMessages(json) {\n var formattedErrors = json.errors.map(f
|