Maintainer overview of the dual build, public entry, and WordPress registration.
Role in the platform
@prc/charting-library is the shared visualization runtime. Chart Builder and other chart consumers import controllers from this package rather than individual chart files.
Authoritative chart-type routing lives in src/lib/controller/ChartBuilder.tsx (layout.type values). Some types resolve to two renderers by orientation (for example bar → BarHorizontal or BarVertical).
Dual build
webpack.config.js exports two configs from one source tree:
| Build | Output | WordPress registration | Runtime | Interactivity store |
|---|---|---|---|---|
| Editor | build/editor.js | Classic script prc-charting-library | React 18 | none — useChartStore is a no-op |
| Frontend | build/view.js | Script Module @prc/charting-library | Preact via preact/compat | prc-chart-builder/chart store |
PHP registration and publicPath: 'auto' handling live in class-prc-charting-library.php and src/publicPath.js. Chunks resolve relative to the loading module so VIP path contexts stay correct.
The Preact bundle also exposes window.prcChartingLibrary as a compat shim for prc-custom-charts (not yet on the dual-build path).
Public surface
The package entry (export.js / src) exports ChartBuilder* controllers. Consumers pass layout, data, and theme props; the controller picks the renderer.
Shared compute helpers and map utilities come from @prc/charting-utilities.
Map loading
Map topology is lazy-loaded so non-map charts do not pay for TopoJSON. See bundle optimization.
Build
npx turbo build --filter=@prc/charting-library