Skip to content
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

Explore Bun bundling playground server #1297

Draft
wants to merge 38 commits into
base: trunk
Choose a base branch
from

Conversation

adamziel
Copy link
Collaborator

What is this PR doing?

Explores bundling php-wasm-cli and wp-playground-server as single executable files with Bun.

It works for php-wasm-cli:

bash build-php-wasm-cli.sh; ./php-wasm-cli
  [49ms]  minify  -124.74 MB (estimate)
   [7ms]  bundle  83 modules
 [311ms] compile  php-wasm-cli
Usage: php [options] [-f] <file> [--] [args...]
   php [options] -r <code> [--] [args...]
   php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]

However, it doesn't yet work for the Playground server:

bash build-playground-server.sh
3 | import url_nightly from './wp-nightly.zip?url';
                            ^
error: Could not resolve: "./wp-nightly.zip?url"
    at playground/packages/playground/wordpress/src/wordpress/get-wordpress-module-details.ts:3:25

I tried calling Bun.build directly, but it doesn't seem to do anything:

await Bun.build({
	entrypoints: [__dirname + '/packages/playground/cli/src/cli.ts'],
	outdir: __dirname + '/out',
	target: 'node',
});
console.log('built');
export {};
# bun build-playground-server.ts; ll out
built

Related to #1289

…teStreaming method once the spy has been called
…HP instances equal standing (there's a single authoritative MEMFS that's proxied to all other PHPs)
The request handler needs to decide whether to serve a static asset or
run the PHP interpreter. For static assets it should just reuse the primary
PHP even if there's 50 concurrent requests to serve. However, for
dynamic PHP requests, it needs to grab an available interpreter.
Therefore, it cannot just accept PHP as an argument as serving requests
requires access to ProcessManager.
@adamziel adamziel changed the title Explore bun bundling playground server Explore Bun bundling playground server Apr 23, 2024
Base automatically changed from node-server to trunk April 29, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant