@bufbuild/protoplugin
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -121,5 +121,30 @@ "use strict"; | ||
if (result.emitSkipped) { | ||
throw Error("A problem occurred during transpilation and files were not generated. Contact the plugin author for support."); | ||
// When compilation fails, this error message is printed to stderr. | ||
const diagnostics = formatDiagnostics(result.diagnostics); | ||
throw Error(`A problem occurred during transpilation and files were not generated. Contact the plugin author for support.\n\n${diagnostics}`); | ||
} | ||
return results; | ||
} | ||
function formatDiagnostics(diagnostics) { | ||
const sorted = typescript_1.default.sortAndDeduplicateDiagnostics(diagnostics); | ||
if (sorted.length == 0) { | ||
return ""; | ||
} | ||
const first = sorted.slice(0, 3); | ||
const formatHost = { | ||
getCanonicalFileName(fileName) { | ||
return fileName; | ||
}, | ||
getCurrentDirectory() { | ||
return "."; | ||
}, | ||
getNewLine() { | ||
return "\n"; | ||
}, | ||
}; | ||
let out = typescript_1.default.formatDiagnostics(first, formatHost).trim(); | ||
if (first.length < sorted.length) { | ||
out += `\n${sorted.length - first.length} more diagnostics elided`; | ||
} | ||
return out; | ||
} |
@@ -115,5 +115,30 @@ // Copyright 2021-2024 Buf Technologies, Inc. | ||
if (result.emitSkipped) { | ||
throw Error("A problem occurred during transpilation and files were not generated. Contact the plugin author for support."); | ||
// When compilation fails, this error message is printed to stderr. | ||
const diagnostics = formatDiagnostics(result.diagnostics); | ||
throw Error(`A problem occurred during transpilation and files were not generated. Contact the plugin author for support.\n\n${diagnostics}`); | ||
} | ||
return results; | ||
} | ||
function formatDiagnostics(diagnostics) { | ||
const sorted = ts.sortAndDeduplicateDiagnostics(diagnostics); | ||
if (sorted.length == 0) { | ||
return ""; | ||
} | ||
const first = sorted.slice(0, 3); | ||
const formatHost = { | ||
getCanonicalFileName(fileName) { | ||
return fileName; | ||
}, | ||
getCurrentDirectory() { | ||
return "."; | ||
}, | ||
getNewLine() { | ||
return "\n"; | ||
}, | ||
}; | ||
let out = ts.formatDiagnostics(first, formatHost).trim(); | ||
if (first.length < sorted.length) { | ||
out += `\n${sorted.length - first.length} more diagnostics elided`; | ||
} | ||
return out; | ||
} |
{ | ||
"name": "@bufbuild/protoplugin", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "Apache-2.0", | ||
@@ -38,3 +38,3 @@ "description": "Helps to create your own Protocol Buffers code generators.", | ||
"dependencies": { | ||
"@bufbuild/protobuf": "2.2.1", | ||
"@bufbuild/protobuf": "2.2.2", | ||
"@typescript/vfs": "^1.5.2", | ||
@@ -41,0 +41,0 @@ "typescript": "5.4.5" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
209724
5400
+ Added@bufbuild/protobuf@2.2.2(transitive)
- Removed@bufbuild/protobuf@2.2.1(transitive)
Updated@bufbuild/protobuf@2.2.2