@php-wasm/universal 3.1.19 → 3.1.21
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/index.cjs +9 -8
- package/index.cjs.map +1 -1
- package/index.js +170 -117
- package/index.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/legacy-php-ini.d.ts +32 -0
- package/lib/proxy-file-system.d.ts +14 -2
- package/lib/supported-php-versions.d.ts +10 -0
- package/package.json +8 -8
package/lib/index.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ export type { MaxPhpInstancesError, PHPFactory, PHPFactoryOptions, ProcessManage
|
|
|
21
21
|
export { PHPResponse, StreamedPHPResponse } from './php-response';
|
|
22
22
|
export type { PHPResponseData } from './php-response';
|
|
23
23
|
export type { ErrnoError } from './rethrow-file-system-error';
|
|
24
|
-
export { LatestSupportedPHPVersion, SupportedPHPVersions, SupportedPHPVersionsList, } from './supported-php-versions';
|
|
25
|
-
export type { SupportedPHPVersion } from './supported-php-versions';
|
|
24
|
+
export { AllPHPVersions, isLegacyPHPVersion, LatestSupportedPHPVersion, LegacyPHPVersions, SupportedPHPVersions, SupportedPHPVersionsList, } from './supported-php-versions';
|
|
25
|
+
export type { AllPHPVersion, LegacyPHPVersion, SupportedPHPVersion, } from './supported-php-versions';
|
|
26
|
+
export { createLegacyPhpIniPreRunStep, LEGACY_PHP_INI_CONTENT, LEGACY_PHP_INI_PATH, } from './legacy-php-ini';
|
|
26
27
|
export { PHP, __private__dont__use, PHPExecutionFailureError } from './php';
|
|
27
28
|
export type { MountHandler, UnmountFunction } from './php';
|
|
28
29
|
export { loadPHPRuntime, popLoadedRuntime } from './load-php-runtime';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-boot php.ini content for legacy PHP builds (currently 5.2).
|
|
3
|
+
*
|
|
4
|
+
* Why pre-create a php.ini before the SAPI starts:
|
|
5
|
+
*
|
|
6
|
+
* - ini_get_all() crashes on legacy PHP WASM (null function pointer in
|
|
7
|
+
* the Asyncify instrumentation) so we disable it via
|
|
8
|
+
* `disable_functions`, which PHP only reads during module startup.
|
|
9
|
+
* - OPcache's shared-memory allocator fails in our WASM environment,
|
|
10
|
+
* so opcache must be disabled before php_module_startup runs.
|
|
11
|
+
*
|
|
12
|
+
* Both settings are processed by php_module_startup before PHP reads
|
|
13
|
+
* any user code, so setting them at runtime via `ini_set()` is too
|
|
14
|
+
* late. The Emscripten preRun hook below writes the ini file before
|
|
15
|
+
* PHP.initializeRuntime invokes __wasm_call_ctors, which in turn
|
|
16
|
+
* invokes wasm_sapi_module_startup → php_module_startup.
|
|
17
|
+
*
|
|
18
|
+
* PHP.initializeRuntime will skip writing its own default php.ini
|
|
19
|
+
* when the file already exists.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LEGACY_PHP_INI_PATH = "/internal/shared/php.ini";
|
|
22
|
+
export declare const LEGACY_PHP_INI_CONTENT: string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns an Emscripten preRun callback that writes
|
|
25
|
+
* {@link LEGACY_PHP_INI_CONTENT} to {@link LEGACY_PHP_INI_PATH}.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createLegacyPhpIniPreRunStep(): (module: {
|
|
28
|
+
FS: {
|
|
29
|
+
mkdirTree: (path: string) => void;
|
|
30
|
+
writeFile: (path: string, content: string) => void;
|
|
31
|
+
};
|
|
32
|
+
}) => void;
|
|
@@ -6,8 +6,20 @@ import type { PHP } from './php';
|
|
|
6
6
|
* For example, mounting /wordpress from the parent instance into a child worker allows
|
|
7
7
|
* both to access the same WordPress installation without copying the entire directory.
|
|
8
8
|
*
|
|
9
|
-
* The function automatically patches PROXYFS with mmap support before mounting
|
|
10
|
-
* libraries like ICU can memory-map data files through the proxied
|
|
9
|
+
* The function automatically patches PROXYFS with mmap support before mounting on
|
|
10
|
+
* PHP 7+, so libraries like ICU can memory-map data files through the proxied
|
|
11
|
+
* filesystem.
|
|
12
|
+
*
|
|
13
|
+
* Legacy PHP (< 7) skips the mmap patch. PHP 5.x's zend_compile_file
|
|
14
|
+
* calls mmap() via zend_stream_fixup and trusts fstat() for the buffer
|
|
15
|
+
* size. When a file is pre-populated in MEMFS before PROXYFS is mounted
|
|
16
|
+
* over that path (e.g. php.ini written by preRun), fstat() can return
|
|
17
|
+
* the stale MEMFS size instead of the PROXYFS size, causing the parser
|
|
18
|
+
* to read past the real EOF and report spurious syntax errors. Without
|
|
19
|
+
* the mmap patch, Emscripten returns ENOSYS from mmap() and PHP falls
|
|
20
|
+
* back to a read-based path that handles size mismatches gracefully.
|
|
21
|
+
* PHP 7+ removed the mmap path from zend_stream_fixup entirely, so the
|
|
22
|
+
* patch is both safe and needed there (for ICU/intl).
|
|
11
23
|
*
|
|
12
24
|
* Mounts are registered via php.mount() so they survive runtime rotation.
|
|
13
25
|
* When the replica's WASM module is hot-swapped, hotSwapPHPRuntime()
|
|
@@ -2,3 +2,13 @@ export declare const SupportedPHPVersions: readonly ["8.5", "8.4", "8.3", "8.2",
|
|
|
2
2
|
export declare const LatestSupportedPHPVersion: "8.5";
|
|
3
3
|
export declare const SupportedPHPVersionsList: string[];
|
|
4
4
|
export type SupportedPHPVersion = (typeof SupportedPHPVersions)[number];
|
|
5
|
+
export declare const LegacyPHPVersions: readonly ["5.2"];
|
|
6
|
+
export type LegacyPHPVersion = (typeof LegacyPHPVersions)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Type guard for legacy PHP versions. Lets callers narrow a string
|
|
9
|
+
* to `LegacyPHPVersion` without the `as readonly string[]` cast that
|
|
10
|
+
* would otherwise be required to satisfy `Array.prototype.includes`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isLegacyPHPVersion(version: string | undefined): version is LegacyPHPVersion;
|
|
13
|
+
export declare const AllPHPVersions: readonly ["8.5", "8.4", "8.3", "8.2", "8.1", "8.0", "7.4", "5.2"];
|
|
14
|
+
export type AllPHPVersion = SupportedPHPVersion | LegacyPHPVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/universal",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.21",
|
|
4
4
|
"description": "PHP.wasm – emscripten bindings for PHP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,18 +37,17 @@
|
|
|
37
37
|
"module": "./index.js",
|
|
38
38
|
"types": "index.d.ts",
|
|
39
39
|
"license": "GPL-2.0-or-later",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "5864051cbf4c2a55656112d99a3f1b076bcd67cd",
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=20.10.0",
|
|
43
43
|
"npm": ">=10.2.3"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"ini": "4.1.2",
|
|
47
|
-
"@php-wasm/
|
|
48
|
-
"@php-wasm/
|
|
49
|
-
"@php-wasm/
|
|
50
|
-
"@php-wasm/
|
|
51
|
-
"@php-wasm/progress": "3.1.19"
|
|
47
|
+
"@php-wasm/logger": "3.1.21",
|
|
48
|
+
"@php-wasm/util": "3.1.21",
|
|
49
|
+
"@php-wasm/stream-compression": "3.1.21",
|
|
50
|
+
"@php-wasm/progress": "3.1.21"
|
|
52
51
|
},
|
|
53
52
|
"packageManager": "npm@10.9.2",
|
|
54
53
|
"overrides": {
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
"tmp": "0.2.5",
|
|
61
60
|
"form-data": "^4.0.4",
|
|
62
61
|
"lodash": "^4.17.23",
|
|
63
|
-
"glob": "^9.3.0"
|
|
62
|
+
"glob": "^9.3.0",
|
|
63
|
+
"webpackbar": "^7.0.0"
|
|
64
64
|
}
|
|
65
65
|
}
|