feat: add metadata registry for buckets #1249
Open
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.
Problem
Bucket types (json, yaml, markdown, etc.) have different capabilities, but there was no programmatic way to query these capabilities. Questions like "which buckets support the
[locale]placeholder?" or "which buckets support locked keys?" required manually reviewing loader implementations.This made it difficult to:
Solution
Added a metadata registry that explicitly declares capabilities for all 29 bucket types.
New
BucketTypeEach bucket now includes:
displayName- Human-readable label (e.g., "JSON", "Xcode XCStrings")supportsFormatter- Can use code formatters (Prettier, etc.)supportsInjectLocale- Can inject locale code into contentsupportsLockedKeys- Supports locking specific translation keyssupportsIgnoredKeys- Supports ignoring specific keyssupportsLockedPatterns- Supports pattern-based locking (MDX only)supportsLocalePlaceholder- Supports[locale]placeholder in file pathscreateLoader()- Factory function to create the loaderArchitecture
Moved from a large switch statement to a standalone registry approach:
This approach was chosen because:
Public API
BUCKETS- Complete registry of all bucket typesgetBucket(type)- Helper to lookup a bucket by typeBuckettype - For consumers who need the type definitionImpact
createBucketLoader()signature unchanged🤖 Generated with Claude Code