Skip to content

Conversation

@epeicher
Copy link
Contributor

@epeicher epeicher commented Jan 28, 2026

Related issues

Proposed Changes

  • 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, 7.3, and 8.5 support (7.2/7.3 deprecated upstream; 8.5 causes WP-CLI deprecation warnings that break JSON parsing)
  • 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 for 3.0.22 (no longer needed with 3.0.46)

Why the external config for @php-wasm?

The @wp-playground/blueprints package (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

  1. Run npm install in root and cli/ directories
  2. Run npm start and verify the app launches without WASM errors
  3. Run npm run make and verify the production build succeeds
  4. Confirm that creating, starting, and stopping the site works fine
  5. Confirm that you can create a site using the normal flow, using a Blueprint and using an Import
  6. Check the PHP version selector shows 7.4-8.4 range

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@epeicher epeicher changed the title Add utility to parse JSON from PHP output with warnings Update WordPress Playground dependencies to 3.0.46 and fix JSON parsing Jan 28, 2026
@epeicher epeicher changed the title Update WordPress Playground dependencies to 3.0.46 and fix JSON parsing Update WordPress Playground dependencies to 3.0.46 Jan 28, 2026
@epeicher epeicher force-pushed the fix/php-output-json-parsing branch 2 times, most recently from d45604b to ec14ce4 Compare January 29, 2026 11:08
- 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)
@epeicher epeicher force-pushed the fix/php-output-json-parsing branch 2 times, most recently from 8826846 to 0977838 Compare January 29, 2026 11:29
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\/.*/,
],
Copy link
Contributor Author

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.

Copy link
Contributor Author

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\/.*/,

@epeicher epeicher self-assigned this Jan 29, 2026
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)"
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants