contentlayerdev / contentlayerdev/contentlayer
Attaching references after the build
- 主要言語
- TypeScript
- スター
- 3.5k
- フォーク
- 192
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
The simple version of this is that I have two document types and I want to cache some static field on a document _after_ the build has completed.
For example, let's say I have tags and posts, and I want a tag object to have a `postCount` attribute that caches the number of posts to which the tag was applied.
---
The more complex example is to be able to "hydrate" references without needing to write my own transformer function.
In the example above, posts would have a `tags` field reference. But I'd love if what were returned was of type `Tag[]` rather than `string[]`.
---
Having both together would be ideal.
コントリビューションガイド
調査の方向性
ファイル、テスト、エントリポイントは指定されていません。まず、ビルド完了処理と参照処理のパスを見つけ、既存の transformer の動作を、要求されているビルド後のフィールドキャッシュおよび Tag[] のハイドレーションと比較してください。カスタム transformer なしで両方の機能が連携して動作し、tags と posts の例に対するカバレッジがあれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- data
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100