Refactor preloaded contexts into static JSON assets#641
Refactor preloaded contexts into static JSON assets#641dahlia merged 1 commit intofedify-dev:mainfrom
Conversation
Refactor @fedify/vocab-runtime's preloaded JSON-LD contexts so that each context lives in its own static JSON asset under packages/vocab-runtime/src/contexts/. Keep the exported preloadedContexts registry and its URL keys unchanged while replacing the monolithic in-code definition with static JSON imports. This makes single-context updates easier to review and reduces unrelated merge conflicts. Fixes fedify-dev#627 Co-Authored-By: OpenAI Codex <codex@openai.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant internal refactoring to the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively refactors the preloaded JSON-LD contexts into separate static JSON assets, which is a great improvement for code organization and maintainability. The changes are well-structured. I've found one potential issue in the gotosocial.json context file, which appears to be a typo that affects correctness.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Summary
This PR refactors the preloaded JSON-LD contexts in @fedify/vocab-runtime so that each context is stored as its own static JSON asset instead of being embedded together in one large TypeScript object.
Details
Each preloaded context now lives under packages/vocab-runtime/src/contexts/, and packages/vocab-runtime/src/contexts.ts rebuilds the existing
preloadedContextsregistry through static JSON imports while preserving the same URL keys, exported API shape, and runtime behavior.Rationale
This keeps data-only context updates isolated from runtime code, reduces merge conflicts when multiple contexts change independently, and makes context changes easier to review because unrelated definitions no longer live in the same source block.
Testing
I verified the change with
deno task -f @fedify/vocab-runtime test,pnpm --filter @fedify/vocab-runtime test,deno test --check --allow-all packages/fedify/src/utils/kv-cache.test.ts,node --test utils/kv-cache.test.jsfrom packages/fedify/dist, andbun test utils/kv-cache.test.js --timeout 60000from packages/fedify/dist.Notes
This is an internal refactor with no user-visible behavior change, so CHANGES.md was intentionally not updated.
Related issue
Fixes #627