refactor(plugins): chart-registry delegation shim + derive ChartType - #426
refactor(plugins): chart-registry delegation shim + derive ChartType#426alfredo1996 wants to merge 1 commit into
Conversation
Phase 2: chart-registry.ts is now a thin shim that registers lightweight plugin entries with pluginRegistry and delegates all lookups via a Proxy. The static chartRegistry object, getChartConfig, and all helper functions continue to work unchanged for consumers. Phase 3: ChartType union is now derived from a single CHART_TYPES constant in plugins/chart-types.ts. Startup validation in plugins/index.ts warns if any declared type lacks a registered plugin. All 1971+ existing tests pass unchanged. New tests verify delegation behavior and CHART_TYPES/plugin registry alignment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23d0d08 to
af58dc9
Compare
|
|
Superseded by #428 (integration branch) |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR converts the chart registry from a static hardcoded object to a plugin-backed Proxy system. A new canonical Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant getChartConfig
participant Proxy as chartRegistry<br/>(Proxy)
participant pluginRegistry
participant adaptPlugin
participant componentLoader
Client->>getChartConfig: getChartConfig("bar")
getChartConfig->>Proxy: pluginRegistry.get("bar")
Proxy->>pluginRegistry: get("bar")
pluginRegistry-->>Proxy: ChartPlugin
Proxy->>adaptPlugin: adaptPlugin(plugin)
adaptPlugin->>componentLoader: Load component via<br/>componentLoader map
componentLoader-->>adaptPlugin: Lazy module
adaptPlugin-->>Proxy: ChartConfig with<br/>lazy component
Proxy-->>getChartConfig: ChartConfig
getChartConfig-->>Client: ChartConfig object
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Summary
Phases 2+3 of the plugin system refactor. Makes
chart-registry.tsa thin delegation layer overpluginRegistryand derivesChartTypefrom a single source of truth.Closes #417, Closes #419
Changes
Phase 2: Plugin delegation shim
chart-registry.ts— replaced staticchartRegistryobject with aProxythat delegates topluginRegistry.get(type)viaadaptPlugin()convertergetChartConfig,chartSupportsClickAction,getStylingTargets, etc.) now delegate to plugin registryPhase 3: Derived ChartType
app/src/plugins/chart-types.ts— singleCHART_TYPESconst array,ChartTypederived via(typeof CHART_TYPES)[number]chart-registry.tsre-exportsChartTypefromchart-types.ts(no more manual union)CHART_TYPESentry lacks a registered pluginStats
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Tests
Refactor