Extract Zuplo integration into standalone @zuplo/zudoku package#2593
Draft
mosch wants to merge 2 commits into
Draft
Extract Zuplo integration into standalone @zuplo/zudoku package#2593mosch wants to merge 2 commits into
mosch wants to merge 2 commits into
Conversation
Moves the Zuplo-specific code out of zudoku core into a new package that is only used in the Zuplo context. The package inspects the Zuplo project (via a transformConfig plugin) and builds the Zudoku config for it: - Sets up an OpenAPI reference for each OpenAPI file found in the project's config/ directory (skipping files the user documents themselves) - Detects GraphQL endpoints (routes marked with x-graphql or exposed as GraphQL MCP endpoints) and sets up a @zudoku/plugin-graphql instance per endpoint, introspecting through the gateway URL with a fallback to the route's upstream - Applies everything the Zuplo processors did before: policy-based enrichment (API key headers, rate limit responses), MCP server route documentation, server URL injection, and removal of x-internal routes, parameters and x-zuplo extensions A companion Vite plugin (merged automatically via the plugin's package vite.config.ts) bakes the inspected context into a virtual module so the client/server bundles build the same config without filesystem access, and stubs the node-only entry out of those bundles. Core changes: - plugins can now contribute schema processors through the internal __processors config field instead of the hardcoded Zuplo import in the API vite plugin - selectPluginConfigs is exported from zudoku/plugins - traverseAsync is re-exported from zudoku/processors/traverse - running with --zuplo without the plugin logs a migration warning, and the deprecated withZuplo export now points to @zuplo/zudoku - @zuplo/mcp dependency moved to the new package The with-zuplo example now uses zuploPlugin() instead of a manual apis entry. https://claude.ai/code/session_01Dq4AK4qdCF8sensEVCZf46
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Zero-config: running `zudoku build --zuplo` now generates the Zudoku config on the fly without any setup in the user's config file. Two steps: @zuplo/zudoku inspects the Zuplo project and builds the config, zudoku consumes it. - The config loader resolves @zuplo/zudoku from the docs project (it is a dependency there, never of zudoku itself) and applies `withZuploPlugin` before running config transforms; a warning is logged when the package isn't installed - The generated `virtual:zudoku-config` module applies the same wrapper so client/server bundles produce the identical config - The server entry now exports the fully transformed config and the prerenderer consumes it instead of importing the raw config chunk and re-running the transform itself, which also removes the serverConfigFilename plumbing - `zuploPlugin()` stays exported for passing options; the automatic application backs off when it is configured explicitly The with-zuplo example is back to a plain config with no Zuplo wiring. https://claude.ai/code/session_01Dq4AK4qdCF8sensEVCZf46
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.
Summary
Extracts the Zuplo-specific integration logic from the main Zudoku package into a new standalone
@zuplo/zudokupackage. This enables Zuplo projects to automatically discover and document their OpenAPI files and GraphQL endpoints through a simple plugin, while keeping Zuplo-specific code isolated from the core framework.Key Changes
New
@zuplo/zudokupackage with:zuploPlugin()- Main plugin that inspects Zuplo projects and builds the Zudoku configinspectZuploContext()- Scans the project'sconfig/directory for OpenAPI files and GraphQL endpointsapplyZuploConfig()- Applies discovered APIs and endpoints to the Zudoku configzuploVitePlugin) that bakes the inspected context into client/server bundlesContext detection discovers:
*.oas.jsonfiles in the project'sconfig/directoryx-graphqlorx-zuplo-route.mcp.typeConfig application:
/api, multiple files under/api/{filename}Moved/refactored:
packages/zudoku/src/zuplo/topackages/zuplo/src/processors/withZuplo()helper (now automatic via plugin)Updated example (
examples/with-zuplo/) to use the newzuploPlugin()Implementation Details
The plugin works in two modes:
virtual:zuplo-contextmodule to avoid Node dependenciesThe Vite plugin watches OpenAPI files and reloads when GraphQL endpoints are added/removed
GraphQL endpoint detection supports both explicit marking (
x-graphql) and MCP server routes (x-zuplo-route.mcp.type)Gracefully handles missing configuration (non-Zuplo projects return empty context) and logs warnings for GraphQL endpoints without introspectable URLs
https://claude.ai/code/session_01Dq4AK4qdCF8sensEVCZf46