PHPackages                             automattic/jetpack-wp-build-polyfills - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. automattic/jetpack-wp-build-polyfills

ActiveJetpack-library[Utility &amp; Helpers](/categories/utility)

automattic/jetpack-wp-build-polyfills
=====================================

Polyfills for WordPress Core packages not available or incomplete in older WP versions

v0.2.5(2w ago)02.5k↑4860%10GPL-2.0-or-laterPHPPHP &gt;=7.2CI failing

Since Mar 23Pushed 1mo agoCompare

[ Source](https://github.com/Automattic/jetpack-wp-build-polyfills)[ Packagist](https://packagist.org/packages/automattic/jetpack-wp-build-polyfills)[ RSS](/packages/automattic-jetpack-wp-build-polyfills/feed)WikiDiscussions trunk Synced 1w ago

READMEChangelogDependencies (11)Versions (28)Used By (10)

Jetpack WP Build Polyfills
==========================

[](#jetpack-wp-build-polyfills)

Polyfills for WordPress Core packages not yet available or complete in older WordPress versions.

This package conditionally registers `@wordpress/*` packages as both classic scripts (IIFE) and script modules (ESM) when they are not already provided by Core or Gutenberg. It is intended to be used while Jetpack supports WordPress versions whose bundled packages are missing or incomplete. Revisit this package once Jetpack's minimum supported WordPress version reaches 7.1.

Problem
-------

[](#problem)

WordPress 7.0 introduces several new packages (`@wordpress/boot`, `@wordpress/route`, `@wordpress/theme`, etc.) that plugins built with [`@wordpress/build`](https://github.com/WordPress/gutenberg/tree/trunk/packages/wp-build) depend on. On older WordPress versions, these packages are missing or ship incomplete implementations — for example, `wp-private-apis` has an allowlist that rejects `@wordpress/theme`, `@wordpress/route`, and newer dashboard packages, and `wp-notices` lacks component exports that `@wordpress/boot` requires.

This package provides those missing or updated packages so that plugins using `@wordpress/build` can work across Jetpack's supported WordPress versions.

What it polyfills
-----------------

[](#what-it-polyfills)

### Classic scripts (IIFE)

[](#classic-scripts-iife)

HandleSource packageForce-replaced?`wp-notices``@wordpress/notices`Yes on WP &lt; 7.0 — missing component exports`wp-private-apis``@wordpress/private-apis`Yes on WP &lt; 7.1 unless Gutenberg &gt;= 23.5.0 is active — incomplete allowlist`wp-theme``@wordpress/theme`No — only registered if absent`wp-views``@wordpress/views`No — only registered if absent### Script modules (ESM)

[](#script-modules-esm)

Module IDSource package`@wordpress/boot``@wordpress/boot``@wordpress/route``@wordpress/route``@wordpress/a11y``@wordpress/a11y`Script modules use "first-wins" semantics — if Core or Gutenberg already registered the module, the polyfill is silently ignored.

How it works
------------

[](#how-it-works)

1. `WP_Build_Polyfills::register()` hooks into `wp_default_scripts` at **priority 20**, after Core (priority 0) and Gutenberg (priority 10) have registered their scripts.
2. For each polyfill, it checks whether a built asset file exists (`build/scripts/*/index.asset.php` or `build/modules/*/index.asset.php`).
3. For classic scripts, it checks whether the handle is already registered. Scripts marked for force replacement are deregistered and re-registered with the polyfill version when the WordPress version is below the script's threshold and active Gutenberg is not known to provide a compatible implementation. Non-force scripts are skipped if already registered.
4. For script modules, it calls `wp_register_script_module()`, which silently ignores duplicates.

`wp-private-apis` has an additional Gutenberg-version guard because the dashboard packages require a private-apis allowlist that includes `@wordpress/widget-dashboard`. Gutenberg 23.4.0 and older do not include that allowlist entry; Gutenberg 23.5.0 is expected to be the first active-Gutenberg version that matches the current `@next` package build used here.

Usage
-----

[](#usage)

Call `register()` early in your plugin, specifying a consumer name and the polyfills you need:

```
use Automattic\Jetpack\WP_Build_Polyfills\WP_Build_Polyfills;

WP_Build_Polyfills::register( 'my-plugin', array(
    'wp-notices',
    'wp-private-apis',
    '@wordpress/boot',
    '@wordpress/route',
) );
```

Available handles are listed in `WP_Build_Polyfills::SCRIPT_HANDLES` and `WP_Build_Polyfills::MODULE_IDS`.

Multiple plugins can call `register()` — the hook is only added once, and all requested polyfills are merged. You can inspect which consumers requested which polyfills via `WP_Build_Polyfills::get_consumers()`.

The version threshold for force-replacements can be overridden with a third parameter:

```
WP_Build_Polyfills::register( 'my-plugin', array( 'wp-notices' ), '7.1' );
```

Boot module asset file
----------------------

[](#boot-module-asset-file)

Packages that use `@wordpress/build` to generate pages get a hardcoded reference to `build/modules/boot/index.min.asset.php` in the generated page templates. This file provides the classic script dependencies and version hash needed to bootstrap the page.

When `@wordpress/build` stops bundling the boot module (as planned in upcoming Gutenberg changes), this asset file will no longer be generated. This package builds its own boot module asset file, and ships a bin script (`provide-boot-asset-file`) that copies it to the expected location in the consumer's build directory.

Consuming packages should add `@automattic/jetpack-wp-build-polyfills` as a devDependency and call the script after `wp-build`:

```
"build:boot-proxy": "provide-boot-asset-file"
```

Development
-----------

[](#development)

```
# Build polyfills (development)
pnpm run build

# Build polyfills (production)
pnpm run build-production

# Run PHP tests
composer run test-php
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance94

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

26

Last Release

14d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c5869ecbb8e0eac7e8b8e0f3cf7bdd8d5fcdc4abc10a72281872c53f8639d44?d=identicon)[automattic](/maintainers/automattic)

---

Top Contributors

[![tbradsha](https://avatars.githubusercontent.com/u/32492176?v=4)](https://github.com/tbradsha "tbradsha (14 commits)")[![anomiex](https://avatars.githubusercontent.com/u/1030580?v=4)](https://github.com/anomiex "anomiex (14 commits)")[![dhasilva](https://avatars.githubusercontent.com/u/8486249?v=4)](https://github.com/dhasilva "dhasilva (9 commits)")[![robertsreberski](https://avatars.githubusercontent.com/u/8419292?v=4)](https://github.com/robertsreberski "robertsreberski (6 commits)")[![simison](https://avatars.githubusercontent.com/u/87168?v=4)](https://github.com/simison "simison (4 commits)")[![manzoorwanijk](https://avatars.githubusercontent.com/u/18226415?v=4)](https://github.com/manzoorwanijk "manzoorwanijk (3 commits)")[![zaguiini](https://avatars.githubusercontent.com/u/26530524?v=4)](https://github.com/zaguiini "zaguiini (2 commits)")[![CGastrell](https://avatars.githubusercontent.com/u/157240?v=4)](https://github.com/CGastrell "CGastrell (2 commits)")[![LiamSarsfield](https://avatars.githubusercontent.com/u/43409125?v=4)](https://github.com/LiamSarsfield "LiamSarsfield (1 commits)")[![arcangelini](https://avatars.githubusercontent.com/u/33258733?v=4)](https://github.com/arcangelini "arcangelini (1 commits)")[![enejb](https://avatars.githubusercontent.com/u/115071?v=4)](https://github.com/enejb "enejb (1 commits)")[![kraftbj](https://avatars.githubusercontent.com/u/88897?v=4)](https://github.com/kraftbj "kraftbj (1 commits)")[![angelablake](https://avatars.githubusercontent.com/u/35241639?v=4)](https://github.com/angelablake "angelablake (1 commits)")[![obenland](https://avatars.githubusercontent.com/u/1398304?v=4)](https://github.com/obenland "obenland (1 commits)")[![retrofox](https://avatars.githubusercontent.com/u/77539?v=4)](https://github.com/retrofox "retrofox (1 commits)")

### Embed Badge

![Health badge](/badges/automattic-jetpack-wp-build-polyfills/health.svg)

```
[![Health](https://phpackages.com/badges/automattic-jetpack-wp-build-polyfills/health.svg)](https://phpackages.com/packages/automattic-jetpack-wp-build-polyfills)
```

###  Alternatives

[awcodes/richer-editor

A collection of extensions and tools to enhance the Filament Rich Editor field.

4018.1k11](/packages/awcodes-richer-editor)[cakedc/cakephp-forum

Forum Plugin for CakePHP

2212.4k](/packages/cakedc-cakephp-forum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
