The PRC Block Library is the platform's shared block runtime. It registers PRC blocks, extends WordPress core blocks, and provides support systems used across block implementations.
Package: @prc/block-library. Source: plugins/prc-block-library/.
Bootstrap and block discovery
prc-block-library.php starts PRC\Platform\Blocks\Plugin. The plugin loads shared dependencies, patterns, block extensions, PRC blocks, and deprecated blocks.
During local development, Plugin::load_blocks() scans src/*. Production scans build/*. A directory whose name starts with _ or . is skipped. Each discovered directory can provide class-<block-slug>.php, which registers its block from the built metadata.
The build creates build/blocks-manifest.php. When that file exists, the plugin passes it to wp_register_block_metadata_collection() so WordPress can use the prebuilt metadata index.
Runtime layers
The plugin has four main layers:
- Core block extensions modify
core/*blocks with filters, attributes, context, controls, or render behavior. - PRC blocks register blocks in the
prc-block/*namespace. - Deprecated blocks remain loadable from
deprecated/for existing content. - Shared support systems add behavior across blocks, including Interactivity API context, block visibility, custom rich text formats, pagination assets, sticky and legacy width supports, and editor integrations.
Individual block narratives are listed on the plugin landing page. Each narrative describes behavior and usage. The corresponding block.json remains the source of truth for attributes and supports.
Server and editor flow
Most dynamic blocks register from metadata and use a PHP render callback or render.php. Editor scripts update block attributes and compose inner blocks. Frontend scripts use the WordPress Interactivity API where the block declares interactive behavior.
The shared Interactivity API support adds interactiveNamespace and interactiveSubsumption metadata to blocks that opt into interactivity. It also wires context so a namespace can pass through a nested block tree.
Build layout
Source blocks live in src/<block-slug>/. Deprecated source blocks live in deprecated/src/<block-slug>/. Build output mirrors these folders under build/ and deprecated/build/.
Use the root Turbo task for a normal build:
npx turbo build --filter=@prc/block-library
The plugin also has focused scripts for development:
npm run build:block -w @prc/block-library -- <block-slug>
npm run start -w @prc/block-library -- <block-slug>
Maintainer map
| Path | Responsibility |
|---|---|
includes/class-plugin.php | Plugin bootstrap, block discovery, patterns, categories, and global hooks |
includes/class-loader.php | Action and filter registration |
includes/interactivity-api/ | Shared Interactivity API attributes and context |
includes/supports/ | Sticky and legacy width support |
includes/block-visibility/ | Per-block visibility controls |
src/<block-slug>/ | Current block source and metadata |
deprecated/src/<block-slug>/ | Compatibility implementations for deprecated blocks |
patterns/ | Plugin-owned block patterns |
build/blocks-manifest.php | Generated block metadata collection |