Skip to content

Commit

Permalink
Only generate base instance factory when required
Browse files Browse the repository at this point in the history
  • Loading branch information
akrennmair committed Dec 2, 2024
1 parent 6c8c10f commit 1a15e45
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 61 deletions.
4 changes: 0 additions & 4 deletions integration/output-decode-include-types/encode.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions integration/output-encode-include-types/encode.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions integration/output-encode-only/encode.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 0 additions & 36 deletions integration/output-encode-only/google/protobuf/wrappers.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ export function generateFile(ctx: Context, fileDesc: FileDescriptorProto): [stri

// Only decode, fromPartial, and wrap use the createBase method
if (
(options.outputEncodeMethods && options.outputEncodeMethods !== "encode-no-creation") ||
(
options.outputEncodeMethods &&
options.outputEncodeMethods !== "encode-no-creation" &&
options.outputEncodeMethods !== "encode-only" &&
(options.outputDecodeIncludeTypes === "" || new RegExp(options.outputDecodeIncludeTypes).test(fullTypeName))
) ||
options.outputPartialMethods ||
outputWrapAndUnwrap
) {
Expand Down

0 comments on commit 1a15e45

Please sign in to comment.