React admin scoping, WordPress Interactivity API, full WooCommerce integration + 14 audit fixes - #1
Merged
Conversation
…dd Interactivity API + full WooCommerce integration
Bug fixes (all verified with real composer install/lint/test):
- React build pipeline silently failed (missing --webpack-src-dir)
- CI's npm ci had no lockfile to consume -> npm install
- composer.json version field failed composer validate --strict
- PHP 8.4 implicit-nullable deprecation in Plugin.php constructor
- Elementor add_action hooks moved from build_services() to boot() so
DI-injected still registers them
- get_instance() now threads its param through (was dead code)
- validateNamespace allows Vendor\Plugin namespaces
- validatePrefix rejects reserved words (wp, php, wordpress)
- validateOutputDir allows paths outside cwd (e.g. ../sibling-plugin)
- phpcs.xml prefix/VIP-exclude rules are now real template placeholders
instead of fragile exact-string runtime patching
- dead ternaries removed; runGenerator throws instead of process.exit
- added .distignore template
React scope correction:
- React admin app pipeline now targets wp-admin only (Assets.php on
admin_enqueue_scripts, auto-scoped to the settings page hook suffix
when admin_settings is also selected), mounting a real interactive
component instead of a no-op console.log
- new 'interactivity' module: WordPress's native Interactivity API
(data-wp-interactive directives, Script Modules) for real frontend
interactivity without shipping a React runtime to visitors
WooCommerce module now scaffolds a full, working integration:
- Payment gateway (classic checkout + WooCommerce Blocks payment method
registration, so it isn't invisible in the block-based checkout)
- Shipping method, custom order email (with its own template files),
custom product type, HPOS compatibility
- Cart & Checkout Blocks content integration via ExperimentalOrderMeta
- a real native Gutenberg block (assets/src/blocks/cart-summary) showing
a live cart summary, auto-discovered by wp-scripts
- webpack.config.js now correctly merges wp-scripts' lazily-computed
entry *function* with our own explicit entries -- spreading it as a
plain object ({ ...defaultConfig.entry }) silently drops every
auto-discovered block entry, which was caught and fixed during testing
Requires-at-least bumps automatically: 6.4 for the block.json render
field (WooCommerce module), 6.5 for the Interactivity API.
20 regression tests (up from 7), plus manual end-to-end verification:
php -l, composer validate --strict, composer lint, composer test, and
real npm install && npm run build against multiple fixture combinations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three rounds of work on this branch, all verified end-to-end (not just unit-tested):
1. Fixed 14 findings from a detailed audit
--webpack-src-dir)npm cihad no lockfile to consume →npm installcomposer.json'sversionfield failedcomposer validate --strictPlugin.phpadd_actionhooks moved frombuild_services()toboot()so a DI-injected$servicesarray still registers themget_instance()now threads its$servicesparam through (was dead code)validateNamespaceallowsVendor\PluginnamespacesvalidatePrefixrejects reserved words (wp,php,wordpress)validateOutputDirallows paths outside cwd (e.g.../sibling-plugin)phpcs.xmlprefix/VIP-exclude rules are now real template placeholders instead of fragile exact-string runtime patchingrunGeneratorthrows instead ofprocess.exit.distignoretemplate2. React rescoped to wp-admin + new Interactivity API module
Assets.phponadmin_enqueue_scripts, auto-scoped to the settings page hook suffix whenadmin_settingsis also selected), mounting a real interactive component instead of a no-opconsole.loginteractivitymodule: WordPress's native Interactivity API (data-wp-interactivedirectives, Script Modules) for real frontend interactivity without shipping a React runtime to visitorsRequires at leastauto-bumps to 6.5 when this module is selected3. WooCommerce module now scaffolds a full, working integration
ExperimentalOrderMetaassets/src/blocks/cart-summary) showing a live cart summary, auto-discovered by wp-scriptswebpack.config.jsnow correctly merges wp-scripts' lazily-computed entry function with our own explicit entries — spreading it as a plain object ({ ...defaultConfig.entry }) silently drops every auto-discovered block entry. Found and fixed during testing.Requires at leastauto-bumps to 6.4 (block.jsonrenderfield)Verification
php -l,composer validate --strict,composer lint(WPCS, zero errors),composer testagainst multiple generated fixturesnpm install && npm run buildconfirming the admin app, Interactivity view script, WooCommerce gateway block, Blocks integration script, and native Cart Summary block all compile together correctly