bufbuild/plugins

Starting with timostamm-protobuf-ts@v2.9.4 the "output_javascript" option no longer emits .d.ts files

Closed this issue · 4 comments

Superseding timostamm/protobuf-ts#643 (comment) since the issue does not occur in the upstream project.

Starting with https://github.com/bufbuild/plugins/tree/main/plugins/community/timostamm-protobuf-ts/v2.9.4 when I generate code for the protos here: https://github.com/stateful/runme/tree/main/internal/api important *.d.ts files are being omitted. A downgrade to v2.9.3 solves the issue. Please note, if I use the upstream project directly (outside of Buf), I can not reproduce the issue.

Happy to refactor my proto files if that will fix the issue but I don't have an inclination how to do that. Please advise! Thank you.

Here's one of the key differences, v2.9.4; please note how the parser_pb.d.ts is absent:

internal/gen/proto/ts/runme/parser
└── v1
    ├── parser_pb.client.d.ts
    ├── parser_pb.client.js
    └── parser_pb.js

2 directories, 3 files

And here's v2.9.3:

internal/gen/proto/ts/runme/parser
└── v1
    ├── parser_pb.client.d.ts
    ├── parser_pb.client.js
    ├── parser_pb.d.ts
    └── parser_pb.js

2 directories, 4 files

I was not able to reproduce the same behavior with the buf.build/connectrpc/eliza module - it generates .d.ts files for each input file properly:

buf.gen.yaml:

version: v1
managed:
  enabled: true
plugins:
  - plugin: buf.build/community/timostamm-protobuf-ts
    out: gen/timo-ts
  - plugin: buf.build/community/timostamm-protobuf-ts
    out: gen/timo-js
    opt: output_javascript

Output:

$ tree gen 
gen
├── timo-js
│   └── connectrpc
│       └── eliza
│           └── v1
│               ├── eliza.client.d.ts
│               ├── eliza.client.js
│               ├── eliza.d.ts
│               └── eliza.js
└── timo-ts
    └── connectrpc
        └── eliza
            └── v1
                ├── eliza.client.ts
                └── eliza.ts

I'm interested to know if you can reproduce this behavior with a public module on the BSR. In the meantime I've opened #1163 to revert a recent change we made to the plugin to reduce its size.

@pkwarren yes, the public BSR would be https://buf.build/stateful/runme/activity/

Namely: npm install @buf/stateful_runme.community_timostamm-protobuf-ts@latest will pull in a v2.9.4 bundled version without *.d.ts whereas npm install @buf/stateful_runme.community_timostamm-protobuf-ts@2.9.3-20240406201323-8223854c0c39.1 continues to work and includes those files.

I can't seem to reopen this issue.

@sourishkrout - This should be resolved with version v2.9.4, revision 3 of the plugin. I've verified with code generation locally that these previously missing files are now found:

google/protobuf/descriptor.d.ts
google/protobuf/wrappers.d.ts
runme/parser/v1/parser.d.ts
runme/runner/v1/runner.d.ts
runme/runner/v2alpha1/runner.d.ts

Thank you! Much appreciated.