-
Notifications
You must be signed in to change notification settings - Fork 57
Update WordPress Playground dependencies to 3.0.46 #2499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
d45604b to
ec14ce4
Compare
- Update @wp-playground/blueprints to 3.0.46 in package.json - Update @php-wasm/universal, @wp-playground/blueprints, @wp-playground/cli, @wp-playground/common, @wp-playground/storage to 3.0.46 in cli/package.json - Remove PHP 7.2 and 7.3 support (deprecated in upstream packages) - Add PHP 8.5 support - Update blueprint validation to use new validateBlueprint export - Fix workerThreadCount access via internalsKeyForTesting symbol - Add external config for @php-wasm packages in electron.vite.config.ts - Remove old patches (no longer needed with 3.0.46)
8826846 to
0977838
Compare
PHP 8.5 causes WP-CLI deprecation warnings (react/promise uses deprecated case statement syntax) that break JSON parsing of CLI output. Can be re-added when WP-CLI updates its dependencies.
| }, | ||
| external: [ | ||
| /^@php-wasm\/.*/, | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been added to avoid an issue with the new imports of import { validateBlueprint } from '@wp-playground/blueprints';. That import transitively imports @php-wasm/* packages that contain .wasm files that fail bundling.
Those @php-wasm are not needed by the UI so it is OK not to bundle them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this commit bf31ab5 contains the explanation for adding /^@wp-playground\/.*/,
Playground 3.0.46 changed the behavior of process spawning functions (exec, popen, proc_open, etc.) to throw an explicit error when called without a spawn handler, instead of silently failing. This caused WP-CLI's search-replace command to hang during site imports, because it attempts to use these functions which are not supported in WASM without an explicit spawn handler. The fix disables these functions via php.ini's disable_functions, which causes WP-CLI to fall back to alternative implementations that don't require process spawning. Reference: WordPress/wordpress-playground@b2e809fcc "[PHP] Require explicit spawn handler for process spawning (#3008)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the following PR #1671 (comment) and it works as expected so I don't think this patch is required anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit has a great explanation of why this change is required 62b1dc2
The packaged app was failing with "Cannot find module '@wp-playground/blueprints'" because: 1. The package was in devDependencies, so it was pruned during packaging 2. The package is needed at runtime for blueprint validation (validateBlueprint) Changes: - Move @wp-playground/blueprints from devDependencies to dependencies so it's included in the asar archive - Add @wp-playground/* to external patterns in electron.vite.config.ts to prevent Vite from trying to bundle WASM modules (which would fail with "ESM integration proposal for Wasm is not supported") These changes ensure the packages are externalized (not bundled into the main process) but still included in node_modules within the packaged app.
Related issues
Proposed Changes
@wp-playground/blueprintsto 3.0.46 in package.json@php-wasm/universal,@wp-playground/blueprints,@wp-playground/cli,@wp-playground/common,@wp-playground/storageto 3.0.46 in cli/package.jsonvalidateBlueprintexportworkerThreadCountaccess viainternalsKeyForTestingsymbol@php-wasmpackages in electron.vite.config.tsWhy the external config for @php-wasm?
The
@wp-playground/blueprintspackage (used for blueprint validation in the main process) imports@php-wasm/web-*packages which contain WASM files. Vite cannot bundle these WASM files and fails with "ESM integration proposal for Wasm is not supported". Marking@php-wasm/*as external tells Vite to skip bundling them, resolving the build failure.Testing Instructions
npm installin root andcli/directoriesnpm startand verify the app launches without WASM errorsnpm run makeand verify the production build succeedsPre-merge Checklist