feat(editions): support editions in plugin#1234
Conversation
|
I felt like this is kind of a misuse of the intent behind the isProto3Syntax flag, but I wanted to make as minimal edits as possible for the first pass. Could possibly have changed that field to something like isProto3Semantics to be more appropriate, but that would have involved modifying a lot more files and doesn't really solve the problem. This works as of now since edition syntax for 2023/2024 has not deviated from the proto3 syntax. |
## Overview Update descriptor/compiler protos to match protoc version v6.33.2 and publish ts-proto-descriptors 2.1.0. ## Related PRs - #1234
|
Hello @kellen-miller ! Thank you for these PRs! I just merged #1233 and then manually ran Also because we update that so infrequently, it's kinda an adhoc/janky process, so I would not be surprised if things don't "just work". 😬 But would be really amazing if you could pull those into this PR and see if it does! 🤞 Let me know if you need another |
[WHY] align ts-proto behavior with protobuf editions [WHAT] use Edition enum and supports-editions feature flag; add context test [HOW] derive proto3 syntax from edition in FileDescriptorProto [TEST] yarn test tests/context-test.ts [RISK] temp file:protos dependency until descriptors are published [RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto, ts-proto:protos/google/protobuf/compiler/plugin.proto#feature-enum
926d366 to
37adfae
Compare
…based dependency
|
sure thing let me sync and rebase |
|
should be good for review now @stephenh! |
|
@kellen-miller ty! Looks like our CI check is failing just b/c of all the codegen churn caused by the protobuf bump -- can you run the codegen step locally and just push up all the changes? |
[WHY] fix tsc checks after descriptor updates [WHAT] add FileContext fields and enum visibility in tests [HOW] use SymbolVisibility enum and edition defaults [TEST] yarn tsc:check [RISK] low; test-only changes [RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto
[WHY] satisfy prettier format check [WHAT] reformat isProto3Edition boolean expression [HOW] apply prettier to src/context.ts [TEST] not run (format-only change) [RISK] none [RAG] ts-proto:src/context.ts#proto3-syntax
[WHY] descriptor updates add new fields to snapshots [WHAT] refresh inline/meta-typings and options snapshots [HOW] update jest snapshots using a temporary formatter shim [TEST] yarn test integration/meta-typings/meta-typings-test.ts integration/options/options-test.ts [RISK] low; snapshot-only changes [RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto
…nfig requirements
|
Seems like Jest’s inline snapshot updater calls Prettier v2 sync APIs (resolveConfig.sync / getFileInfo.sync). Prettier v3 removed those, so jest -u (and inline snapshot updates) break unless you provide a compatible Prettier. I had to use a temp local prettier v2 to update those files and get around I've added a more permanent fix to pin the jest snapshotter to use prettier v2 in this commit ee5ba50 so it doesn't fail in the future. I can revert that change if you don't want to keep that in. |
|
Ah shoot, yeah sorry about that prettier snapshot thing -- pinning to v2 is a pretty great work around for me 😅 , ty! This PR is really great; any others you'd like to submit are super welcome! I could use any/all help staying on top of the latest protobuf updates, as I'm personally not using them day-to-day atm, so can only help triage/land PRs from intrepid folks like yourself. :-) |
# [2.9.0](v2.8.3...v2.9.0) (2025-12-20) ### Features * **editions:** support editions in plugin ([#1234](#1234)) ([19ce1e3](19ce1e3))
|
🎉 This PR is included in version 2.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
Implements #1165
Enable edition-aware behavior in ts-proto and advertise edition support to protoc. Uses Edition enum from ts-proto-descriptors to derive proto3 syntax when syntax != proto2 and edition is 2023/2024.
Note
The
package.jsontemporarily usests-proto-descriptors: "file:protos"for testing, will set it to the published2.1.0after the related protos PR is merged/released.All the changes under
protos/google/protobufcan be ignored, they are a part of the preliminary PR below. I just needed them here for testing.Related PRs