A consuming plugin bundles the library in assets/lib/idb-keyval/ (index.js, umd.js, LICENSE) and copies snippets/lh-idb-keyval-fallback.php verbatim to includes/lh-idb-keyval-fallback.php. Never edit the copy: change the canonical snippet, bump its snippet version and recopy it everywhere. There is no Requires Plugins header, so the consumer stays independent and releasable.
What the snippet does
- Fallback check:
lh_idb_keyval_use_fallback()is true when LH idb-keyval has not firedlh_idb_keyval_registered, so a plugin turned off by its init filter counts as inactive. - Registration:
lh_idb_keyval_register_fallback()registers the bundled copy only in that case. - Registry: records each plugin using its own copy, with the version, in registration order. Only the first copy registers, as a script module ID can only be registered once.
- Site Health: one recommended test, added by whichever plugin loads the snippet first, lists those plugins and, when their versions differ, names the version every plugin is actually getting.
- Plugins screen: each such plugin’s row shows Using bundled idb-keyval x.y.z.
- Service workers:
lh_idb_keyval_get_umd_url()returns the shared classic build when LH idb-keyval is active, otherwise the plugin’s own.
No admin notices and no debug-log output.