Repository navigation
feat(proto): ts_proto_closure generates a proto graph as one library - #380
Merged
Merged
Conversation
ts_proto_library generates one proto_library's direct sources, so a caller that wants a whole schema tree mirrors the proto import graph in deps by hand. ts_proto_closure takes protos, walks deps, exports and aliases with an aspect, runs the same per-library protoc action for every proto_library it reaches but the protobuf module's own (protobuf-es imports those from its runtime), and compiles the result as one source-mode ts_compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 2026-10-29, a caller that generates a whole schema tree with
ts_proto_librarycopies the proto import graph intodepsby hand. The Lovable monorepo keeps a generated per-proto deps map and a hand-kept googleapis import list for its six TypeScript trees, and a missed entry breaks that tree's build.ts_proto_closuretakesprotos, finds everyproto_librarythey reach (throughdeps,exportsand aliases), generates each one with the same protoc actionts_proto_libraryuses, and compiles the result as one source-modets_compile.depsnames only the protobuf runtime.//tests/proto:closure_files_testbuilds a closure over a source-less root (which exportsmessage_proto) andservice_proto, and asserts it generates exactlycommon_pb.ts,message_pb.tsandservice_pb.ts: nodescriptor_pb.ts, a well-known type protobuf-es imports from@bufbuild/protobuf/wkt; the closure's own type check fails if an imported file is missing.ts_proto_librarykeeps its API, rule shape and output; both rules share one protoc helper. Revert the commit to roll back.ts_proto_closure; its six committed trees stay byte-identical.Scope
The well-known types are skipped by repository: every
proto_libraryin theprotobufmodule. That matches protobuf-es 2.12.0's runtime list (wktPublicImportPaths) for every target the module exports; a schema that imports a non-WKT test proto from that module would fail to compile, loudly.bootstrap_wkt=trueis refused in a closure. Gazelle's generated per-protots_proto_librarywrappers are unchanged, and Gazelle neither writes nor indexests_proto_closure.🤖 Generated with Claude Code