[CLI] Load WASM-backed WordPress plugins#3624
Draft
adamziel wants to merge 12 commits into
Draft
Conversation
2f8b2e6 to
1482cd4
Compare
9dd745c to
316f701
Compare
316f701 to
0cc451f
Compare
1482cd4 to
8b888fd
Compare
90ef8b9 to
f56274e
Compare
…ess-plugin-api # Conflicts: # packages/php-wasm/universal/public/php-extension-manifest-schema-validator.js # packages/php-wasm/universal/public/php-extension-manifest-schema.json # packages/php-wasm/universal/src/lib/load-extension.spec.ts # packages/php-wasm/universal/src/lib/load-extension.ts # packages/playground/cli/README.md # packages/playground/cli/src/php-extensions.ts # packages/playground/cli/src/run-cli.ts # packages/playground/cli/tests/php-extensions.spec.ts
# Conflicts: # CHANGELOG.md # packages/docs/site/docs/main/changelog.md
This was referenced May 15, 2026
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.
What it does
Adds an experimental
--wasm-wordpress-plugin=<path>descriptor for loading WordPress plugins backed by PHP.wasm modules.A descriptor wires together:
{ "slug": "hello-wasm", "extension": { "name": "hello_wasm", "source": { "format": "manifest", "manifestUrl": "./dist/hello-wasm/manifest.json" } }, "hooks": [ { "type": "filter", "hook": "the_content", "callback": "hello_wasm_render_content" } ] }The CLI loads the PHP.wasm extension before PHP starts, then writes an mu-plugin bootstrap that registers the declared WordPress hooks.
Rationale
The extension loader makes WASM modules available to PHP, but WordPress still needs a conventional PHP entry point for hooks. Installing a generated mu-plugin gives WASM-backed code a WordPress-native loading model: native functions/classes are exposed by the extension, and WordPress integration stays in PHP via
add_action()/add_filter().Implementation
readWasmWordPressPluginConfig()andexpandWasmWordPressPluginArgs().manifestUrl,baseUrl, andbootstrappaths relative to the descriptor file.action/filterhook registration withpriorityandacceptedArgs.runtimePHPExtensionsas the internal bridge from descriptor expansion to existing CLI PHP extension loading.packages/php-wasm/compile-extension/examples/hello-dolly-wasm, a complete Hello Dolly-style example with C extension source, PHP bootstrap, descriptor, and run instructions.Testing instructions
Run:
Also verified:
npx tsc -p packages/playground/cli/tsconfig.lib.json --noEmit --pretty falsecurrently fails in this sparse checkout on missing workspace/build packages such as@php-wasm/node-8-4and@wp-playground/blueprints.