Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output_javascript no longer emits .d.ts files #643

Closed
sourishkrout opened this issue Apr 6, 2024 · 6 comments
Closed

output_javascript no longer emits .d.ts files #643

sourishkrout opened this issue Apr 6, 2024 · 6 comments

Comments

@sourishkrout
Copy link

sourishkrout commented Apr 6, 2024

Starting with v2.9.4 it appears that output_javascript no longer emits typescript definitions. Conversely, output_typescript won't emit any JS files and unfortunately won't play nicely with bundlers (when consumed through Buf via node_modules) either.

Here's the difference, 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
@timostamm
Copy link
Owner

Sebastian, are you sure this is related to https://github.com/timostamm/protobuf-ts/releases/tag/v2.9.4 ? The changes were minimal.

The version of TypeScript used by plugin-framework was not changed either (it would be the most likely cuprit).

@sourishkrout
Copy link
Author

@timostamm looking at the diff I'm a bit puzzled myself but A/B testing the two versions side-by-side with nothing else changing, I can reliably reproduce the results from above.

I can try to do more digging. Would you have any pointers where to look @timostamm? The only other place I can think of is https://github.com/bufbuild/protobuf-es but I'm somewhat unfamiliar with both projects.

@sourishkrout
Copy link
Author

Actually, never mind my comment about:

The only other place I can think of is https://github.com/bufbuild/protobuf-es but I'm somewhat unfamiliar with both projects.

Realized https://github.com/bufbuild/protobuf-es is not involved here at all.

@sourishkrout
Copy link
Author

Update: I just ran protobuf-ts locally instead of as Buf plugin and the ts compiler in v2.9.4 appears to produce the desired result.

@timostamm any chance you could point me at where I can file an issue for Buf? Thank you! And thanks for maintaining this project!

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

2 directories, 4 files

sourishkrout added a commit to stateful/runme that referenced this issue Apr 8, 2024
@timostamm
Copy link
Owner

That's right, both projects are completely independent of each other right now. The plan is to gradually change that to keep maintenance manageable, with the first step switching to @bufbuild/protoplugin as the plugin framework. But that has not happened yet.

Thanks for the investigation! I think this is due to a recent optimization for the remote plugins. They use exactly the same code, but the Docker image build recently changed.

Can you file an issue on https://github.com/bufbuild/plugins and reference https://github.com/bufbuild/plugins/tree/main/plugins/community/timostamm-protobuf-ts?

It will be extremely helpful to include a proto file that demonstrates the issue. The problem most likely does not show for every proto input, and may only show under rare circumstances. So you'll save the folks a lot of trial an error if you include an example.

@sourishkrout
Copy link
Author

Filed bufbuild/plugins#1162 in this issues place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants