Skip to content

[Remote] Use CORS proxy in embedded Playgrounds #2369

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

Merged
merged 4 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,71 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v1.2.3] (2025-07-21)
## [v1.2.3] (2025-07-21)

### Enhancements

- [Playground CLI] Consolidate auto mounting logic. ([#2360](https://github.com/WordPress/wordpress-playground/pull/2360))
- [Playground CLI] Move mounting code to mount.ts. ([#2362](https://github.com/WordPress/wordpress-playground/pull/2362))
- [Playground CLI] Consolidate auto mounting logic. ([#2360](https://github.com/WordPress/wordpress-playground/pull/2360))
- [Playground CLI] Move mounting code to mount.ts. ([#2362](https://github.com/WordPress/wordpress-playground/pull/2362))

### Blueprints

- [CLI] Move Blueprints v2 to Playground CLI package. ([#2364](https://github.com/WordPress/wordpress-playground/pull/2364))
- [CLI] Move Blueprints v2 to Playground CLI package. ([#2364](https://github.com/WordPress/wordpress-playground/pull/2364))

### Public API


#### Blueprints

- [Client] Accept wasm.wordpress.net as an official origin. ([#2368](https://github.com/WordPress/wordpress-playground/pull/2368))
- [Client] Accept wasm.wordpress.net as an official origin. ([#2368](https://github.com/WordPress/wordpress-playground/pull/2368))

### Tools

- Make PHP 8.3 the default version. ([#2371](https://github.com/WordPress/wordpress-playground/pull/2371))
- Make PHP 8.3 the default version. ([#2371](https://github.com/WordPress/wordpress-playground/pull/2371))

#### PHP WebAssembly

- Add `--xdebug` option in php-wasm CLI and wp-playground CLI. ([#2346](https://github.com/WordPress/wordpress-playground/pull/2346))
- Add `--xdebug` option in php-wasm CLI and wp-playground CLI. ([#2346](https://github.com/WordPress/wordpress-playground/pull/2346))

### Documentation

- Adding Playground CLI page and removing wp-now references. ([#2337](https://github.com/WordPress/wordpress-playground/pull/2337))
- Adding pt-br About and Launch Page. ([#2358](https://github.com/WordPress/wordpress-playground/pull/2358))
- Adding three new flags on the CLI README file. ([#2325](https://github.com/WordPress/wordpress-playground/pull/2325))
- Adding video content in Japanese to resources page. ([#2354](https://github.com/WordPress/wordpress-playground/pull/2354))
- Updating web instance page documentation. ([#2365](https://github.com/WordPress/wordpress-playground/pull/2365))
- Adding Playground CLI page and removing wp-now references. ([#2337](https://github.com/WordPress/wordpress-playground/pull/2337))
- Adding pt-br About and Launch Page. ([#2358](https://github.com/WordPress/wordpress-playground/pull/2358))
- Adding three new flags on the CLI README file. ([#2325](https://github.com/WordPress/wordpress-playground/pull/2325))
- Adding video content in Japanese to resources page. ([#2354](https://github.com/WordPress/wordpress-playground/pull/2354))
- Updating web instance page documentation. ([#2365](https://github.com/WordPress/wordpress-playground/pull/2365))

### PHP WebAssembly

- [PHP-wasm Node] Remove unused node creation code from createNodeFsMountHandler. ([#2379](https://github.com/WordPress/wordpress-playground/pull/2379))
- [PHP-wasm] File mounting in NODEFS. ([#2338](https://github.com/WordPress/wordpress-playground/pull/2338))
- [PHP] Improve error logging. ([#2357](https://github.com/WordPress/wordpress-playground/pull/2357))
- [PHP] Isomorphic, reusable spawn handler. ([#2359](https://github.com/WordPress/wordpress-playground/pull/2359))
- [PHP] Refresh the latest PHP versions before recompiling. ([#2372](https://github.com/WordPress/wordpress-playground/pull/2372))
- [php-wasm/universal] Try require() before dynamic imprt in comlink-sync.ts. ([#2363](https://github.com/WordPress/wordpress-playground/pull/2363))
- [PHP-wasm Node] Remove unused node creation code from createNodeFsMountHandler. ([#2379](https://github.com/WordPress/wordpress-playground/pull/2379))
- [PHP-wasm] File mounting in NODEFS. ([#2338](https://github.com/WordPress/wordpress-playground/pull/2338))
- [PHP] Improve error logging. ([#2357](https://github.com/WordPress/wordpress-playground/pull/2357))
- [PHP] Isomorphic, reusable spawn handler. ([#2359](https://github.com/WordPress/wordpress-playground/pull/2359))
- [PHP] Refresh the latest PHP versions before recompiling. ([#2372](https://github.com/WordPress/wordpress-playground/pull/2372))
- [php-wasm/universal] Try require() before dynamic imprt in comlink-sync.ts. ([#2363](https://github.com/WordPress/wordpress-playground/pull/2363))

### Website

- Deploy public web app after WP major/beta update. ([#2378](https://github.com/WordPress/wordpress-playground/pull/2378))
- Deploy public web app after WP major/beta update. ([#2378](https://github.com/WordPress/wordpress-playground/pull/2378))

### Bug Fixes

- Allow the WP update and changelog workflows to commit to trunk again. ([#2377](https://github.com/WordPress/wordpress-playground/pull/2377))
- Fix failing WP update workflows. ([#2376](https://github.com/WordPress/wordpress-playground/pull/2376))
- Allow the WP update and changelog workflows to commit to trunk again. ([#2377](https://github.com/WordPress/wordpress-playground/pull/2377))
- Fix failing WP update workflows. ([#2376](https://github.com/WordPress/wordpress-playground/pull/2376))

### Various

- Add Japanese translations to Resources References. ([#2352](https://github.com/WordPress/wordpress-playground/pull/2352))
- Add new logo and open graph image. ([#2350](https://github.com/WordPress/wordpress-playground/pull/2350))
- Adding Portuguese version for Code Standards, Code, and Documentation.. ([#2343](https://github.com/WordPress/wordpress-playground/pull/2343))
- Adding new icons and og:Image for the Playground Web instance. ([#2367](https://github.com/WordPress/wordpress-playground/pull/2367))
- Update Japanese translations to main directory. ([#2375](https://github.com/WordPress/wordpress-playground/pull/2375))
- Add Japanese translations to Resources References. ([#2352](https://github.com/WordPress/wordpress-playground/pull/2352))
- Add new logo and open graph image. ([#2350](https://github.com/WordPress/wordpress-playground/pull/2350))
- Adding Portuguese version for Code Standards, Code, and Documentation.. ([#2343](https://github.com/WordPress/wordpress-playground/pull/2343))
- Adding new icons and og:Image for the Playground Web instance. ([#2367](https://github.com/WordPress/wordpress-playground/pull/2367))
- Update Japanese translations to main directory. ([#2375](https://github.com/WordPress/wordpress-playground/pull/2375))

### Contributors

The following contributors merged PRs in this release:

@adamziel @bgrgicak @brandonpayton @fellyph @mho22 @shimotmk


## [v1.2.2] (2025-07-14)

### Enhancements
Expand Down
54 changes: 26 additions & 28 deletions packages/docs/site/docs/main/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,71 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v1.2.3] (2025-07-21)
## [v1.2.3] (2025-07-21)

### Enhancements

- [Playground CLI] Consolidate auto mounting logic. ([#2360](https://github.com/WordPress/wordpress-playground/pull/2360))
- [Playground CLI] Move mounting code to mount.ts. ([#2362](https://github.com/WordPress/wordpress-playground/pull/2362))
- [Playground CLI] Consolidate auto mounting logic. ([#2360](https://github.com/WordPress/wordpress-playground/pull/2360))
- [Playground CLI] Move mounting code to mount.ts. ([#2362](https://github.com/WordPress/wordpress-playground/pull/2362))

### Blueprints

- [CLI] Move Blueprints v2 to Playground CLI package. ([#2364](https://github.com/WordPress/wordpress-playground/pull/2364))
- [CLI] Move Blueprints v2 to Playground CLI package. ([#2364](https://github.com/WordPress/wordpress-playground/pull/2364))

### Public API


#### Blueprints

- [Client] Accept wasm.wordpress.net as an official origin. ([#2368](https://github.com/WordPress/wordpress-playground/pull/2368))
- [Client] Accept wasm.wordpress.net as an official origin. ([#2368](https://github.com/WordPress/wordpress-playground/pull/2368))

### Tools

- Make PHP 8.3 the default version. ([#2371](https://github.com/WordPress/wordpress-playground/pull/2371))
- Make PHP 8.3 the default version. ([#2371](https://github.com/WordPress/wordpress-playground/pull/2371))

#### PHP WebAssembly

- Add `--xdebug` option in php-wasm CLI and wp-playground CLI. ([#2346](https://github.com/WordPress/wordpress-playground/pull/2346))
- Add `--xdebug` option in php-wasm CLI and wp-playground CLI. ([#2346](https://github.com/WordPress/wordpress-playground/pull/2346))

### Documentation

- Adding Playground CLI page and removing wp-now references. ([#2337](https://github.com/WordPress/wordpress-playground/pull/2337))
- Adding pt-br About and Launch Page. ([#2358](https://github.com/WordPress/wordpress-playground/pull/2358))
- Adding three new flags on the CLI README file. ([#2325](https://github.com/WordPress/wordpress-playground/pull/2325))
- Adding video content in Japanese to resources page. ([#2354](https://github.com/WordPress/wordpress-playground/pull/2354))
- Updating web instance page documentation. ([#2365](https://github.com/WordPress/wordpress-playground/pull/2365))
- Adding Playground CLI page and removing wp-now references. ([#2337](https://github.com/WordPress/wordpress-playground/pull/2337))
- Adding pt-br About and Launch Page. ([#2358](https://github.com/WordPress/wordpress-playground/pull/2358))
- Adding three new flags on the CLI README file. ([#2325](https://github.com/WordPress/wordpress-playground/pull/2325))
- Adding video content in Japanese to resources page. ([#2354](https://github.com/WordPress/wordpress-playground/pull/2354))
- Updating web instance page documentation. ([#2365](https://github.com/WordPress/wordpress-playground/pull/2365))

### PHP WebAssembly

- [PHP-wasm Node] Remove unused node creation code from createNodeFsMountHandler. ([#2379](https://github.com/WordPress/wordpress-playground/pull/2379))
- [PHP-wasm] File mounting in NODEFS. ([#2338](https://github.com/WordPress/wordpress-playground/pull/2338))
- [PHP] Improve error logging. ([#2357](https://github.com/WordPress/wordpress-playground/pull/2357))
- [PHP] Isomorphic, reusable spawn handler. ([#2359](https://github.com/WordPress/wordpress-playground/pull/2359))
- [PHP] Refresh the latest PHP versions before recompiling. ([#2372](https://github.com/WordPress/wordpress-playground/pull/2372))
- [php-wasm/universal] Try require() before dynamic imprt in comlink-sync.ts. ([#2363](https://github.com/WordPress/wordpress-playground/pull/2363))
- [PHP-wasm Node] Remove unused node creation code from createNodeFsMountHandler. ([#2379](https://github.com/WordPress/wordpress-playground/pull/2379))
- [PHP-wasm] File mounting in NODEFS. ([#2338](https://github.com/WordPress/wordpress-playground/pull/2338))
- [PHP] Improve error logging. ([#2357](https://github.com/WordPress/wordpress-playground/pull/2357))
- [PHP] Isomorphic, reusable spawn handler. ([#2359](https://github.com/WordPress/wordpress-playground/pull/2359))
- [PHP] Refresh the latest PHP versions before recompiling. ([#2372](https://github.com/WordPress/wordpress-playground/pull/2372))
- [php-wasm/universal] Try require() before dynamic imprt in comlink-sync.ts. ([#2363](https://github.com/WordPress/wordpress-playground/pull/2363))

### Website

- Deploy public web app after WP major/beta update. ([#2378](https://github.com/WordPress/wordpress-playground/pull/2378))
- Deploy public web app after WP major/beta update. ([#2378](https://github.com/WordPress/wordpress-playground/pull/2378))

### Bug Fixes

- Allow the WP update and changelog workflows to commit to trunk again. ([#2377](https://github.com/WordPress/wordpress-playground/pull/2377))
- Fix failing WP update workflows. ([#2376](https://github.com/WordPress/wordpress-playground/pull/2376))
- Allow the WP update and changelog workflows to commit to trunk again. ([#2377](https://github.com/WordPress/wordpress-playground/pull/2377))
- Fix failing WP update workflows. ([#2376](https://github.com/WordPress/wordpress-playground/pull/2376))

### Various

- Add Japanese translations to Resources References. ([#2352](https://github.com/WordPress/wordpress-playground/pull/2352))
- Add new logo and open graph image. ([#2350](https://github.com/WordPress/wordpress-playground/pull/2350))
- Adding Portuguese version for Code Standards, Code, and Documentation.. ([#2343](https://github.com/WordPress/wordpress-playground/pull/2343))
- Adding new icons and og:Image for the Playground Web instance. ([#2367](https://github.com/WordPress/wordpress-playground/pull/2367))
- Update Japanese translations to main directory. ([#2375](https://github.com/WordPress/wordpress-playground/pull/2375))
- Add Japanese translations to Resources References. ([#2352](https://github.com/WordPress/wordpress-playground/pull/2352))
- Add new logo and open graph image. ([#2350](https://github.com/WordPress/wordpress-playground/pull/2350))
- Adding Portuguese version for Code Standards, Code, and Documentation.. ([#2343](https://github.com/WordPress/wordpress-playground/pull/2343))
- Adding new icons and og:Image for the Playground Web instance. ([#2367](https://github.com/WordPress/wordpress-playground/pull/2367))
- Update Japanese translations to main directory. ([#2375](https://github.com/WordPress/wordpress-playground/pull/2375))

### Contributors

The following contributors merged PRs in this release:

@adamziel @bgrgicak @brandonpayton @fellyph @mho22 @shimotmk


## [v1.2.2] (2025-07-14)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"rules": {}
}
]
}
}
32 changes: 16 additions & 16 deletions packages/php-wasm/xdebug-bridge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ await server.start();

// Start with custom configuration
const server = startXDebugBridge({
protocol: 'cdp', // or 'dap'
xdebugServerPort: 9003, // XDebug connection port
xdebugServerHost: 'localhost',
verbose: false, // Silent mode
protocol: 'cdp', // or 'dap'
xdebugServerPort: 9003, // XDebug connection port
xdebugServerHost: 'localhost',
verbose: false, // Silent mode
});

await server.start();
Expand All @@ -51,20 +51,20 @@ npx xdebug-bridge --help

## Configuration Options

- `protocol`: Protocol to use ('cdp' or 'dap', default: 'cdp')
- `xdebugServerPort`: Port to listen for XDebug connections (default: 9003)
- `xdebugServerHost`: Host to bind to (default: 'localhost')
- `verbose`: Enable verbose logging (default: false for API, true for CLI)
- `logger`: Custom logger function
- `protocol`: Protocol to use ('cdp' or 'dap', default: 'cdp')
- `xdebugServerPort`: Port to listen for XDebug connections (default: 9003)
- `xdebugServerHost`: Host to bind to (default: 'localhost')
- `verbose`: Enable verbose logging (default: false for API, true for CLI)
- `logger`: Custom logger function

## Events

The server emits events for monitoring connection activity:

- `started`: Server has started
- `stopped`: Server has stopped
- `connection`: New XDebug connection established
- `disconnection`: XDebug connection closed
- `xdebugData`: Raw XDebug data received
- `error`: Server error occurred
- `socketError`: Socket-level error occurred
- `started`: Server has started
- `stopped`: Server has stopped
- `connection`: New XDebug connection established
- `disconnection`: XDebug connection closed
- `xdebugData`: Raw XDebug data received
- `error`: Server error occurred
- `socketError`: Socket-level error occurred
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
"node": ">=20.18.3",
"npm": ">=10.1.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './xdebug-bridge';
export * from './xdebug-bridge';
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"path": "./tsconfig.spec.json"
}
]
}
}
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
}
}
2 changes: 1 addition & 1 deletion packages/php-wasm/xdebug-bridge/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
}
6 changes: 6 additions & 0 deletions packages/playground/remote/src/lib/worker-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ import {
networkingDisabledFunctions,
} from './disabled-functions';
import { WordPressFetchNetworkTransport } from './wordpress-fetch-network-transport';
/* @ts-ignore */
import { corsProxyUrl as defaultCorsProxyUrl } from 'virtual:cors-proxy-url';

// post message to parent
self.postMessage('worker-script-started');
Expand Down Expand Up @@ -189,6 +191,10 @@ export class PlaygroundWorkerEndpoint extends PHPWorker {
throw new Error('Playground already booted');
}

if (corsProxyUrl === undefined) {
corsProxyUrl = defaultCorsProxyUrl;
}

this.booted = true;
this.scope = scope;
this.requestedWordPressVersion = wpVersion;
Expand Down
Loading
Loading