Merge pull request #2946 from murgatroid99/proto-loader_root_file_extension

proto-loader: Apply targetFileExtension to root files
This commit is contained in:
Michael Lumish 2025-04-18 13:59:49 -07:00 committed by GitHub
commit 537b32f116
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -47,8 +47,8 @@ type GeneratorOptions = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
outputTemplate: string;
inputBranded: boolean;
outputBranded: boolean;
targetFileExtension?: string;
importFileExtension?: string;
targetFileExtension: string;
importFileExtension: string;
}
class TextFormatter {
@ -832,7 +832,7 @@ async function writeAllFiles(protoFiles: string[], options: GeneratorOptions) {
await fs.promises.mkdir(options.outDir, {recursive: true});
const basenameMap = new Map<string, string[]>();
for (const filename of protoFiles) {
const basename = path.basename(filename).replace(/\.proto$/, '.ts');
const basename = path.basename(filename).replace(/\.proto$/, options.targetFileExtension);
if (basenameMap.has(basename)) {
basenameMap.get(basename)!.push(filename);
} else {

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/proto-loader",
"version": "0.7.14",
"version": "0.7.15",
"author": "Google Inc.",
"contributors": [
{