[compile-extension] Emit the new PHPExtensionManifest shape, add --extra-files - #3596
Merged
Conversation
The loader merged in #3580 expects manifests with sourcePath and the extraFiles+nodes+vfsRoot shape, plus dropped sha256. Update the package to write that shape and add a --extra-files <hostDir>:<vfsRoot> CLI flag that copies sidecar assets next to the manifest and records them under extraFiles.nodes (with empty directories tracked as type=directory).
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates @php-wasm/compile-extension to emit a loader-compatible PHPExtensionManifest shape and adds support for staging sidecar assets via a new --extra-files <hostDir>:<vfsRoot> CLI flag.
Changes:
- Update manifest schema:
file→sourcePath, removesha256, addextraFilesat manifest/artifact level. - Add
extra-filesstaging implementation + tests (copy intooutDir, emitextraFiles.nodes, record empty dirs). - Wire the new flag into the CLI, and document the new manifest shape and flag usage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/php-wasm/compile-extension/src/manifest.ts | Adjusts manifest types/output to match PHPExtensionManifest and adds extraFiles support. |
| packages/php-wasm/compile-extension/src/manifest.spec.ts | Updates artifact assertions and adds coverage for createManifest output + extraFiles. |
| packages/php-wasm/compile-extension/src/extra-files.ts | Implements --extra-files parsing and staging into outDir with manifest node generation. |
| packages/php-wasm/compile-extension/src/extra-files.spec.ts | Adds tests for parsing and staging behavior, including empty directories and mixed roots. |
| packages/php-wasm/compile-extension/src/compile.ts | Plumbs extraFiles through compile options into the written manifest. |
| packages/php-wasm/compile-extension/src/cli.ts | Adds --extra-files flag, stages assets, and passes extraFiles into compilation. |
| packages/php-wasm/compile-extension/README.md | Documents the new manifest schema and --extra-files usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Split --extra-files spec on the last colon so Windows hostDirs with drive letters round-trip - Detect duplicate vfsPath nodes and on-disk basename collisions across multiple --extra-files specs, throw clear errors - Sort manifest nodes with a locale-independent comparator (was localeCompare, host-locale-dependent) - Rename walk()'s visitor parameter from 'path' to 'entryPath' to avoid shadowing the imported path module - Add tests for Windows-style hostDir, basename collisions, and vfsPath collisions
adamziel
added a commit
that referenced
this pull request
May 3, 2026
After #3596 the helper emits manifests in the PHPExtensionManifest shape: artifacts use sourcePath instead of file, sha256 was removed because the loader stopped verifying hashes, and there is a new --extra-files flag for staging sidecar assets. The README on trunk already reflects this; bring the public docs page in line and document --extra-files alongside the matrix example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Updates
@php-wasm/compile-extensionto emit manifests in the shape the loader merged in #3580 expects, and adds a--extra-files <hostDir>:<vfsRoot>CLI flag for staging sidecar assets (web UIs, data dirs, etc.) alongside the.sofiles.The package's manifest output now matches
PHPExtensionManifestfrom@php-wasm/universalexactly:artifacts[i].file→artifacts[i].sourcePathsha256removed (the loader dropped verification in [PHP] SupportextraFilesfor custom PHP extensions #3580)extraFileswithvfsRoot+nodesis supported at both the top-level and per-artifactWhy
The loader merged in #3580 validates manifests against a strict schema generated from
PHPExtensionManifest, and rejects the old shape. Without this update, anything built with the published 3.1.25 fails at runtime with "Invalid PHP extension manifest". This is the prerequisite for stacking an SPX build PR that uses@php-wasm/compile-extensionto produce the.soand the new manifest API to stage SPX's web UI files.How to use --extra-files
./web-uiis copied next to the manifest. Each file becomes one node underextraFiles.nodeswithvfsPathrelative tovfsRootandsourcePathrelative to the manifest URL. Empty directories are recorded astype: "directory"nodes so the loader creates them before PHP starts.Multiple
--extra-filesentries are allowed; they must agree onvfsRootbecause the manifest format stores a single root per group.Testing instructions
The existing integration suite (
tests/run-integration-tests.sh) keeps working because the loader-side tests already passmanifestUrlstraight through and use the new manifest shape.