Skip to content
Corex

BlockPathResolver

Corex\Blocks\BlockPathResolver · class · Blocks layer

Maps a discovered block directory back to its WP_PLUGIN_DIR-relative mount location before registration, so WordPress’s plugins_url() can always derive a correct asset URL regardless of how the plugin/add-on is mounted (Windows junction, POSIX symlink, or a realpath-resolved/CI checkout) — spec 040. Pure string arithmetic over a mount map the boundary supplies; never touches the filesystem, so the realpath-resolved case is unit-testable with synthetic paths.

resolve(string $blockDir, string $pluginsDir, array $mounts): string

Section titled “resolve(string $blockDir, string $pluginsDir, array $mounts): string”