@php-wasm/node 3.1.22 → 3.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/index.cjs +7 -7
- package/index.js +7 -7
- package/lib/extensions/load-extensions.d.ts +5 -3
- package/lib/load-runtime.d.ts +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ const php = new PHP(
|
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
`@php-wasm/node` ships `intl`, `xdebug`, `redis`, and `memcached`. It can also
|
|
44
|
-
load external `.so` artifacts from a manifest:
|
|
44
|
+
load external JSPI `.so` artifacts from a manifest:
|
|
45
45
|
|
|
46
46
|
```js
|
|
47
47
|
const php = new PHP(
|
|
@@ -63,6 +63,10 @@ URL. Relative local paths are resolved from the current working directory.
|
|
|
63
63
|
Relative artifact files in the manifest are resolved against the manifest
|
|
64
64
|
location.
|
|
65
65
|
|
|
66
|
+
External extensions are only supported when the Node.js runtime has JSPI
|
|
67
|
+
available. Asyncify support is limited to the bundled extensions shipped with
|
|
68
|
+
this package.
|
|
69
|
+
|
|
66
70
|
The older `withIntl`, `withXdebug`, `withRedis`, and `withMemcached` loader
|
|
67
71
|
options still work, but new code should use `extensions`.
|
|
68
72
|
|
package/index.cjs
CHANGED
|
@@ -1730,11 +1730,15 @@ async function withPHPExtensions(version, asyncMode, options, extensions = []) {
|
|
|
1730
1730
|
}
|
|
1731
1731
|
async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
1732
1732
|
if (typeof extension === "object" && "source" in extension) {
|
|
1733
|
+
if (asyncMode === "asyncify") {
|
|
1734
|
+
throw new Error(
|
|
1735
|
+
"External PHP extensions require JSPI. Asyncify is only supported for PHP.wasm bundled extensions."
|
|
1736
|
+
);
|
|
1737
|
+
}
|
|
1733
1738
|
return await (0, import_universal8.resolvePHPExtension)({
|
|
1734
1739
|
...extension,
|
|
1735
1740
|
source: normalizeNodeExtensionSource(extension.source),
|
|
1736
1741
|
phpVersion: version,
|
|
1737
|
-
asyncMode,
|
|
1738
1742
|
fetch: extension.fetch ?? fetchNodeExtensionResource
|
|
1739
1743
|
});
|
|
1740
1744
|
}
|
|
@@ -1755,7 +1759,6 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1755
1759
|
bytes: soBytes
|
|
1756
1760
|
},
|
|
1757
1761
|
phpVersion: version,
|
|
1758
|
-
asyncMode,
|
|
1759
1762
|
env: {
|
|
1760
1763
|
ICU_DATA: "/internal/shared"
|
|
1761
1764
|
},
|
|
@@ -1776,8 +1779,7 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1776
1779
|
name: "redis",
|
|
1777
1780
|
bytes: new Uint8Array(import_fs.default.readFileSync(extensionPath))
|
|
1778
1781
|
},
|
|
1779
|
-
phpVersion: version
|
|
1780
|
-
asyncMode
|
|
1782
|
+
phpVersion: version
|
|
1781
1783
|
});
|
|
1782
1784
|
}
|
|
1783
1785
|
case "memcached": {
|
|
@@ -1788,8 +1790,7 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1788
1790
|
name: "memcached",
|
|
1789
1791
|
bytes: new Uint8Array(import_fs.default.readFileSync(extensionPath))
|
|
1790
1792
|
},
|
|
1791
|
-
phpVersion: version
|
|
1792
|
-
asyncMode
|
|
1793
|
+
phpVersion: version
|
|
1793
1794
|
});
|
|
1794
1795
|
}
|
|
1795
1796
|
case "xdebug": {
|
|
@@ -1803,7 +1804,6 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1803
1804
|
bytes: new Uint8Array(import_fs.default.readFileSync(filePath))
|
|
1804
1805
|
},
|
|
1805
1806
|
phpVersion: version,
|
|
1806
|
-
asyncMode,
|
|
1807
1807
|
loadWithIniDirective: "zend_extension",
|
|
1808
1808
|
iniEntries: {
|
|
1809
1809
|
"xdebug.mode": "debug,develop",
|
package/index.js
CHANGED
|
@@ -1712,11 +1712,15 @@ async function withPHPExtensions(version, asyncMode, options, extensions = []) {
|
|
|
1712
1712
|
}
|
|
1713
1713
|
async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
1714
1714
|
if (typeof extension === "object" && "source" in extension) {
|
|
1715
|
+
if (asyncMode === "asyncify") {
|
|
1716
|
+
throw new Error(
|
|
1717
|
+
"External PHP extensions require JSPI. Asyncify is only supported for PHP.wasm bundled extensions."
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1715
1720
|
return await resolvePHPExtension({
|
|
1716
1721
|
...extension,
|
|
1717
1722
|
source: normalizeNodeExtensionSource(extension.source),
|
|
1718
1723
|
phpVersion: version,
|
|
1719
|
-
asyncMode,
|
|
1720
1724
|
fetch: extension.fetch ?? fetchNodeExtensionResource
|
|
1721
1725
|
});
|
|
1722
1726
|
}
|
|
@@ -1737,7 +1741,6 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1737
1741
|
bytes: soBytes
|
|
1738
1742
|
},
|
|
1739
1743
|
phpVersion: version,
|
|
1740
|
-
asyncMode,
|
|
1741
1744
|
env: {
|
|
1742
1745
|
ICU_DATA: "/internal/shared"
|
|
1743
1746
|
},
|
|
@@ -1758,8 +1761,7 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1758
1761
|
name: "redis",
|
|
1759
1762
|
bytes: new Uint8Array(fs.readFileSync(extensionPath))
|
|
1760
1763
|
},
|
|
1761
|
-
phpVersion: version
|
|
1762
|
-
asyncMode
|
|
1764
|
+
phpVersion: version
|
|
1763
1765
|
});
|
|
1764
1766
|
}
|
|
1765
1767
|
case "memcached": {
|
|
@@ -1770,8 +1772,7 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1770
1772
|
name: "memcached",
|
|
1771
1773
|
bytes: new Uint8Array(fs.readFileSync(extensionPath))
|
|
1772
1774
|
},
|
|
1773
|
-
phpVersion: version
|
|
1774
|
-
asyncMode
|
|
1775
|
+
phpVersion: version
|
|
1775
1776
|
});
|
|
1776
1777
|
}
|
|
1777
1778
|
case "xdebug": {
|
|
@@ -1785,7 +1786,6 @@ async function resolveRuntimePHPExtension(version, asyncMode, extension) {
|
|
|
1785
1786
|
bytes: new Uint8Array(fs.readFileSync(filePath))
|
|
1786
1787
|
},
|
|
1787
1788
|
phpVersion: version,
|
|
1788
|
-
asyncMode,
|
|
1789
1789
|
loadWithIniDirective: "zend_extension",
|
|
1790
1790
|
iniEntries: {
|
|
1791
1791
|
"xdebug.mode": "debug,develop",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EmscriptenOptions, PHPExtensionInstallOptions,
|
|
1
|
+
import type { EmscriptenOptions, PHPExtensionInstallOptions, SupportedPHPVersion } from '@php-wasm/universal';
|
|
2
|
+
type PHPWasmAsyncMode = 'jspi' | 'asyncify';
|
|
2
3
|
export interface PathMapping {
|
|
3
4
|
hostPath: string;
|
|
4
5
|
vfsPath: string;
|
|
@@ -15,8 +16,8 @@ export type BuiltInPHPExtensionName = 'intl' | 'xdebug' | 'redis' | 'memcached';
|
|
|
15
16
|
/**
|
|
16
17
|
* External PHP extension source that can be installed before PHP starts.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* External sources are supported in JSPI runtimes only. Asyncify support is
|
|
20
|
+
* limited to bundled extensions shipped with this package.
|
|
20
21
|
*/
|
|
21
22
|
export type RuntimePHPExtensionSource = PHPExtensionInstallOptions;
|
|
22
23
|
/**
|
|
@@ -57,3 +58,4 @@ export type PHPExtension = BuiltInPHPExtension | RuntimePHPExtensionSource;
|
|
|
57
58
|
* downloads do not block each other.
|
|
58
59
|
*/
|
|
59
60
|
export declare function withPHPExtensions(version: SupportedPHPVersion, asyncMode: PHPWasmAsyncMode, options: EmscriptenOptions, extensions?: PHPExtension[]): Promise<EmscriptenOptions>;
|
|
61
|
+
export {};
|
package/lib/load-runtime.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface PHPLoaderOptions {
|
|
|
7
7
|
* PHP extensions to install before the runtime starts.
|
|
8
8
|
*
|
|
9
9
|
* Use built-in names such as `intl`, `xdebug`, `redis`, and `memcached`,
|
|
10
|
-
* or pass an external extension source such as a manifest.
|
|
10
|
+
* or pass an external JSPI extension source such as a manifest.
|
|
11
11
|
*/
|
|
12
12
|
extensions?: PHPExtension[];
|
|
13
13
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.25",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"wasm-feature-detect": "1.8.0",
|
|
48
48
|
"ws": "8.18.0",
|
|
49
49
|
"yargs": "17.7.2",
|
|
50
|
-
"@php-wasm/universal": "3.1.
|
|
51
|
-
"@php-wasm/node-8-5": "3.1.
|
|
52
|
-
"@php-wasm/node-8-4": "3.1.
|
|
53
|
-
"@php-wasm/node-8-3": "3.1.
|
|
54
|
-
"@php-wasm/node-8-2": "3.1.
|
|
55
|
-
"@php-wasm/node-8-1": "3.1.
|
|
56
|
-
"@php-wasm/node-8-0": "3.1.
|
|
57
|
-
"@php-wasm/node-7-4": "3.1.
|
|
58
|
-
"@php-wasm/cli-util": "3.1.
|
|
59
|
-
"@php-wasm/logger": "3.1.
|
|
60
|
-
"@php-wasm/node-5-2": "3.1.
|
|
61
|
-
"@php-wasm/util": "3.1.
|
|
62
|
-
"@wp-playground/common": "3.1.
|
|
50
|
+
"@php-wasm/universal": "3.1.25",
|
|
51
|
+
"@php-wasm/node-8-5": "3.1.25",
|
|
52
|
+
"@php-wasm/node-8-4": "3.1.25",
|
|
53
|
+
"@php-wasm/node-8-3": "3.1.25",
|
|
54
|
+
"@php-wasm/node-8-2": "3.1.25",
|
|
55
|
+
"@php-wasm/node-8-1": "3.1.25",
|
|
56
|
+
"@php-wasm/node-8-0": "3.1.25",
|
|
57
|
+
"@php-wasm/node-7-4": "3.1.25",
|
|
58
|
+
"@php-wasm/cli-util": "3.1.25",
|
|
59
|
+
"@php-wasm/logger": "3.1.25",
|
|
60
|
+
"@php-wasm/node-5-2": "3.1.25",
|
|
61
|
+
"@php-wasm/util": "3.1.25",
|
|
62
|
+
"@wp-playground/common": "3.1.25"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e662afdd9a3b6dad3e194ad34d80421c539b7386",
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=20.10.0",
|
|
67
67
|
"npm": ">=10.2.3"
|