| 1421 | } |
| 1422 | |
| 1423 | function syntaxErrorFactory(error) { |
| 1424 | let message = "\nSyntaxError\n\n"; |
| 1425 | |
| 1426 | if (typeof error.line !== "undefined") { |
| 1427 | message += `(${error.line}:${error.column}) `; |
| 1428 | } |
| 1429 | |
| 1430 | if (typeof error.plugin !== "undefined") { |
| 1431 | message += `from "${error.plugin}" plugin: `; |
| 1432 | } |
| 1433 | |
| 1434 | message += error.file ? `${error.file} ` : "<css input> "; |
| 1435 | message += `${error.reason}`; |
| 1436 | |
| 1437 | const code = error.showSourceCode(); |
| 1438 | |
| 1439 | if (code) { |
| 1440 | message += `\n\n${code}\n`; |
| 1441 | } |
| 1442 | |
| 1443 | const obj = new Error(message, { cause: error }); |
| 1444 | |
| 1445 | obj.stack = null; |
| 1446 | |
| 1447 | return obj; |
| 1448 | } |
| 1449 | |
| 1450 | function supportTemplateLiteral(loaderContext) { |
| 1451 | if (loaderContext.environment && loaderContext.environment.templateLiteral) { |