[CLI] Support staged PHP.wasm side modules#3620
Merged
Merged
Conversation
0316c21 to
94e808c
Compare
94e808c to
e0d3db0
Compare
e0d3db0 to
e825a8d
Compare
e825a8d to
52fba4f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for staging PHP.wasm side modules without registering them via php.ini, by allowing loadWithIniDirective: false in extension manifests.
Changes:
- Introduces
PHPExtensionLoadDirective = PHPExtensionIniDirective | falsetype and threads it through manifest resolution, install options, andwithResolvedPHPExtensions(). - Refactors ini-file generation into
createPHPExtensionIniFile()and skips ini generation/PHP_INI_SCAN_DIRentries when the directive isfalse. - Updates the generated extension manifest JSON schema/validator and
@php-wasm/compile-extensionmanifest type to accept the newfalsevalue.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/cli/README.md | Docs example for loadWithIniDirective: false. |
| packages/php-wasm/universal/src/lib/load-extension.ts | Adds new type, refactors ini generation, skips ini staging when directive is false. |
| packages/php-wasm/universal/src/lib/load-extension.spec.ts | Tests for side-module behavior in resolver. |
| packages/php-wasm/universal/src/lib/index.ts | Exports new PHPExtensionLoadDirective type. |
| packages/php-wasm/universal/public/php-extension-manifest-schema.json | Schema updated with new directive variant. |
| packages/php-wasm/universal/public/php-extension-manifest-schema-validator.js | Regenerated validator supporting false. |
| packages/php-wasm/universal/README.md | Docs updated for new behavior and sourcePath field. |
| packages/php-wasm/node/src/test/with-php-extensions.spec.ts | Test ensuring no PHP_INI_SCAN_DIR entry is created. |
| packages/php-wasm/node/README.md | Docs note for loadWithIniDirective: false. |
| packages/php-wasm/compile-extension/src/manifest.ts | Adds false variant in compile-extension manifest type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Allows a PHP.wasm extension manifest to stage an artifact before PHP starts without adding a
php.iniload directive.{ "name": "sqlite_markdown", "loadWithIniDirective": false, "artifacts": [] }The extension bytes and sidecar files are still fetched and written into the PHP virtual filesystem, but PHP does not receive an
extension=orzend_extension=entry for that artifact.Rationale
Some Wasm side modules are consumed by another runtime component instead of PHP's extension loader. They need the startup-time fetch/staging path from custom PHP.wasm extensions, but registering them through
php.inimakes PHP try to load them as native PHP extensions.Implementation
Adds
PHPExtensionLoadDirective = 'extension' | 'zend_extension' | falseand threads it through manifest resolution,@php-wasm/node, and the generated manifest schema.When
loadWithIniDirectiveisfalse:.sois staged inextensionDir.inifile is generatedwithResolvedPHPExtensions()omits that extension fromPHP_INI_SCAN_DIRThe
@php-wasm/compile-extensionmanifest type now accepts the same value, so generated extension manifests can use the single manifest object format.Testing instructions