Skip to content

[Blueprints] Load v2 WordPress data-reference sources - #4005

Merged
adamziel merged 1 commit into
trunkfrom
blueprint-v2-wordpress-data-sources
Jul 11, 2026
Merged

[Blueprints] Load v2 WordPress data-reference sources#4005
adamziel merged 1 commit into
trunkfrom
blueprint-v2-wordpress-data-sources

Conversation

@adamziel

@adamziel adamziel commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

Load custom wordpressVersion data references in TypeScript Blueprints v2.

Blueprints v2 can now load WordPress from a custom ZIP, a directory embedded in the Blueprint, or a directory in Git. The ZIP can sit next to the Blueprint or be embedded in it. Directory sources are turned into ZIPs before WordPress boots. Both the browser and CLI use the supplied source instead of downloading another WordPress build.

Built-in versions and HTTP(S) archives keep their existing download paths. This takes the useful source-resolution idea from #3725 without reviving that PR's compiler, validator, or migration work.

Why

The public v2 schema already accepts general data references for wordpressVersion, but the TypeScript runtime rejected every form except HTTP(S). A valid Blueprint could therefore validate and still fail before boot.

Testing

CI

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Enables Blueprint v2 callers (web, CLI, worker) to supply WordPress core as a resolved archive when wordpressVersion is a v2 data reference (execution-context path, inline file/dir, Git), avoiding runtime rejection and redundant core downloads.

Changes:

  • Add wordPressZip support to the worker boot options and skip core download when it’s provided.
  • Resolve v2 wordpressVersion data references into a concrete archive via the existing resource loader (resolveBlueprintV2WordPressSource), and pass it through client/CLI boot boundaries.
  • Update/extend tests to cover custom WordPress archive resolution and “no core download” behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/playground/remote/src/lib/playground-worker-endpoint.ts Extends worker boot options with a caller-supplied WordPress archive.
packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.ts Skips WordPress core download when wordPressZip is provided; forwards archive to boot.
packages/playground/remote/src/lib/playground-worker-endpoint-blueprints-v1.spec.ts Adds test ensuring caller-provided core avoids core download.
packages/playground/client/src/blueprints-v2-handler.ts Resolves v2 WordPress sources to an archive and passes it to the worker.
packages/playground/client/src/blueprints-v2-handler.spec.ts Adds test ensuring resolved archive is forwarded to worker boot.
packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts Uses v2 WordPress archive resolver before falling back to download in CLI.
packages/playground/cli/tests/blueprints-v2-handler.spec.ts Tests bundled v2 archive path avoids core download (CLI).
packages/playground/blueprints/src/lib/v2/resolve-runtime-configuration.ts Treats v2 WordPress data references as a synthetic runtime label (custom).
packages/playground/blueprints/src/lib/v2/compile.ts Adds resolveBlueprintV2WordPressSource and plumbing to map v2 references to v1 resources.
packages/playground/blueprints/src/index.ts Exports the new v2 WordPress source resolver API.
packages/playground/blueprints/src/tests/v2/resolve-wordpress-source.spec.ts New unit tests for data-reference WordPress source resolution.
packages/playground/blueprints/src/tests/v2/resolve-runtime-configuration.spec.ts Updates runtime-config tests to accept v2 WordPress data references.
Comments suppressed due to low confidence (1)

packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts:1

  • wordPressZip is now typed as File | undefined in the CLI handler, but the CLI pathway commonly operates on transferable byte payloads (e.g., Uint8Array/ArrayBuffer) rather than DOM Files. Given resolveBlueprintV2WordPressSource() is exported for both web and CLI use, it would be safer to type wordPressZip based on that function’s real return type (or a shared archive payload type) to avoid DOM-specific types leaking into Node/worker code and to prevent accidental .arrayBuffer()/.text() usage where it may not exist.
import { logger } from '@php-wasm/logger';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/blueprints/src/lib/v2/compile.ts
Comment thread packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts
Comment thread packages/playground/blueprints/src/lib/v2/compile.ts
Comment thread packages/playground/blueprints/src/lib/v2/compile.ts
@adamziel
adamziel force-pushed the blueprint-v2-wordpress-data-sources branch from bb86ac0 to ae82d73 Compare July 10, 2026 23:55
@adamziel
adamziel merged commit d80caaf into trunk Jul 11, 2026
53 checks passed
@adamziel
adamziel deleted the blueprint-v2-wordpress-data-sources branch July 11, 2026 00:49
adamziel added a commit that referenced this pull request Jul 11, 2026
## What

Remove the retired Blueprint v2 opt-in aliases now that v2 declarations
select the native TypeScript path automatically.

- The hidden CLI `--experimental-blueprints-v2-runner` flag and its
v1-option translations are gone.
- `WorkerBootOptions.experimentalBlueprintsV2Runner`, which was already
a no-op, is gone.
- Personal WP no longer gives the retired query parameter special
cleanup behavior.
- Auto-mounted themes always emit the normal v1-shaped activation step;
the v2 handler already owns the one required shape conversion.

## Breaking change

Callers still passing `--experimental-blueprints-v2-runner` must remove
it. Use a v2 declaration for automatic selection, or use `--mode` to
choose `create-new-site`, `apply-to-existing-site`, or `mount-only`. Use
`--allow=follow-symlinks` and `--allow=read-local-fs` for the
capabilities the alias used to infer from old flags.

Code passing `experimentalBlueprintsV2Runner` in worker boot options
must remove that property. It has had no effect since handler selection
moved before worker boot.

## Testing

- `npm exec -- nx run-many -t typecheck -p playground-cli
playground-personal-wp playground-remote --parallel=3`
- `npm exec -- nx run-many -t lint -p playground-cli
playground-personal-wp playground-remote --parallel=3`
- `npm exec -- nx run playground-cli:test-playground-cli
--testFiles=mounts.spec.ts`
- `npx vitest run --config packages/playground/cli/vite.config.ts
packages/playground/cli/tests/run-cli.spec.ts -t "should reject the
retired experimental v2 flag"`
- `npm exec -- nx test playground-personal-wp
--testFile=landing-page.spec.ts`

## Stack

1. #4005
2. #4006
3. This PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment