@php-wasm/node 2.0.5 → 2.0.7
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/asyncify/7_2_34/php_7_2.wasm +0 -0
- package/asyncify/7_3_33/php_7_3.wasm +0 -0
- package/asyncify/7_4_33/php_7_4.wasm +0 -0
- package/asyncify/8_0_30/php_8_0.wasm +0 -0
- package/asyncify/8_1_33/php_8_1.wasm +0 -0
- package/asyncify/8_2_29/php_8_2.wasm +0 -0
- package/asyncify/8_3_24/php_8_3.wasm +0 -0
- package/asyncify/8_4_11/php_8_4.wasm +0 -0
- package/asyncify/php_7_2.js +40 -35
- package/asyncify/php_7_3.js +40 -35
- package/asyncify/php_7_4.js +40 -35
- package/asyncify/php_8_0.js +40 -35
- package/asyncify/php_8_1.js +40 -35
- package/asyncify/php_8_2.js +40 -35
- package/asyncify/php_8_3.js +50 -45
- package/asyncify/php_8_4.js +46 -41
- package/index.cjs +623 -437
- package/index.js +623 -437
- package/jspi/7_2_34/php_7_2.wasm +0 -0
- package/jspi/7_3_33/php_7_3.wasm +0 -0
- package/jspi/7_4_33/php_7_4.wasm +0 -0
- package/jspi/8_0_30/php_8_0.wasm +0 -0
- package/jspi/8_1_33/php_8_1.wasm +0 -0
- package/jspi/8_2_29/php_8_2.wasm +0 -0
- package/jspi/8_3_24/php_8_3.wasm +0 -0
- package/jspi/8_4_11/php_8_4.wasm +0 -0
- package/jspi/php_7_2.js +40 -35
- package/jspi/php_7_3.js +40 -35
- package/jspi/php_7_4.js +40 -35
- package/jspi/php_8_0.js +40 -35
- package/jspi/php_8_1.js +40 -35
- package/jspi/php_8_2.js +40 -35
- package/jspi/php_8_3.js +46 -41
- package/jspi/php_8_4.js +46 -41
- package/lib/file-lock-manager-for-node.d.ts +9 -2
- package/lib/load-runtime.d.ts +2 -1
- package/package.json +7 -7
package/jspi/php_8_3.js
CHANGED
|
@@ -6,10 +6,10 @@ const require = createRequire(import.meta.url);
|
|
|
6
6
|
// Note: The path module is currently needed by code injected by the php-wasm Dockerfile.
|
|
7
7
|
import path from 'path';
|
|
8
8
|
|
|
9
|
-
const dependencyFilename = path.join(__dirname, '
|
|
9
|
+
const dependencyFilename = path.join(__dirname, '8_3_24', 'php_8_3.wasm');
|
|
10
10
|
export { dependencyFilename };
|
|
11
|
-
export const dependenciesTotalSize =
|
|
12
|
-
const phpVersionString = '8.3.
|
|
11
|
+
export const dependenciesTotalSize = 32572592;
|
|
12
|
+
const phpVersionString = '8.3.24';
|
|
13
13
|
export function init(RuntimeName, PHPLoader) {
|
|
14
14
|
// The rest of the code comes from the built php.js file and esm-suffix.js
|
|
15
15
|
// include: shell.js
|
|
@@ -1012,7 +1012,7 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
1012
1012
|
|
|
1013
1013
|
/** @type {WebAssembly.Table} */
|
|
1014
1014
|
var wasmTable = new WebAssembly.Table({
|
|
1015
|
-
initial:
|
|
1015
|
+
initial: 15739,
|
|
1016
1016
|
element: 'anyfunc',
|
|
1017
1017
|
});
|
|
1018
1018
|
var getWasmTableEntry = (funcPtr) => {
|
|
@@ -6994,35 +6994,25 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
6994
6994
|
1: 'exclusive',
|
|
6995
6995
|
2: 'unlocked',
|
|
6996
6996
|
},
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
6997
|
+
is_path_to_shared_fs(path) {
|
|
6998
|
+
_js_wasm_trace('is_path_to_shared_fs(%s)', path);
|
|
6999
|
+
const { node } = FS.lookupPath(path, { noent_okay: true });
|
|
7000
|
+
if (node.mount.type !== PROXYFS) {
|
|
7001
|
+
return !!node.isSharedFS;
|
|
7002
|
+
}
|
|
7003
|
+
|
|
7004
|
+
// This looks like a PROXYFS node. Let's try a lookup.
|
|
7005
|
+
const nodePath = PROXYFS.realPath(node);
|
|
7006
|
+
const backingFs = node?.mount?.opts?.fs;
|
|
7007
|
+
if (backingFs) {
|
|
7008
|
+
// Tolerate ENOENT because looking up a MEMFS node by path always fails.
|
|
7009
|
+
const { node: backingNode } = backingFs.lookupPath(nodePath, {
|
|
7010
|
+
noent_okay: true,
|
|
7011
|
+
});
|
|
7012
|
+
return !!backingNode?.isSharedFS;
|
|
7008
7013
|
}
|
|
7009
7014
|
|
|
7010
|
-
|
|
7011
|
-
if (node.mount.type !== NODEFS) {
|
|
7012
|
-
return false;
|
|
7013
|
-
}
|
|
7014
|
-
const vfsPath = node.mount.type.realPath(node);
|
|
7015
|
-
try {
|
|
7016
|
-
const underlyingNode =
|
|
7017
|
-
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
7018
|
-
return !!underlyingNode?.isSharedFS;
|
|
7019
|
-
} catch (e) {
|
|
7020
|
-
return false;
|
|
7021
|
-
}
|
|
7022
|
-
},
|
|
7023
|
-
is_path_to_shared_fs(path) {
|
|
7024
|
-
const { node } = FS.lookupPath(path);
|
|
7025
|
-
return locking.is_shared_fs_node(node);
|
|
7015
|
+
return false;
|
|
7026
7016
|
},
|
|
7027
7017
|
get_fd_access_mode(fd) {
|
|
7028
7018
|
const emscripten_F_GETFL = Number('3');
|
|
@@ -7040,8 +7030,26 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
7040
7030
|
}
|
|
7041
7031
|
},
|
|
7042
7032
|
get_native_path_from_vfs_path(vfsPath) {
|
|
7043
|
-
|
|
7044
|
-
|
|
7033
|
+
// TODO: Should there be a try/catch here?
|
|
7034
|
+
const { node } = FS.lookupPath(vfsPath, {});
|
|
7035
|
+
if (node.mount.type === NODEFS) {
|
|
7036
|
+
return NODEFS.realPath(node);
|
|
7037
|
+
} else if (node.mount.type === PROXYFS) {
|
|
7038
|
+
// TODO: Tolerate ENOENT here?
|
|
7039
|
+
const { node: backingNode, path: backingPath } =
|
|
7040
|
+
node.mount.opts.fs.lookupPath(vfsPath);
|
|
7041
|
+
_js_wasm_trace(
|
|
7042
|
+
'backingNode for %s: %s',
|
|
7043
|
+
vfsPath,
|
|
7044
|
+
backingPath,
|
|
7045
|
+
backingNode
|
|
7046
|
+
);
|
|
7047
|
+
return backingNode.mount.type.realPath(backingNode);
|
|
7048
|
+
} else {
|
|
7049
|
+
throw new Error(
|
|
7050
|
+
`Unsupported filesystem type for path ${vfsPath}`
|
|
7051
|
+
);
|
|
7052
|
+
}
|
|
7045
7053
|
},
|
|
7046
7054
|
check_lock_params(fd, l_type) {
|
|
7047
7055
|
const emscripten_O_RDONLY = Number('0');
|
|
@@ -31254,13 +31262,13 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
31254
31262
|
// End JS library code
|
|
31255
31263
|
|
|
31256
31264
|
var ASM_CONSTS = {
|
|
31257
|
-
|
|
31265
|
+
13232510: ($0) => {
|
|
31258
31266
|
if (!$0) {
|
|
31259
31267
|
AL.alcErr = 0xa004;
|
|
31260
31268
|
return 1;
|
|
31261
31269
|
}
|
|
31262
31270
|
},
|
|
31263
|
-
|
|
31271
|
+
13232558: ($0) => {
|
|
31264
31272
|
if (!AL.currentCtx) {
|
|
31265
31273
|
err('alGetProcAddress() called without a valid context');
|
|
31266
31274
|
return 1;
|
|
@@ -34409,19 +34417,16 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
34409
34417
|
// We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
|
|
34410
34418
|
// nodes. This way we can tell whether file-locking is needed and possible
|
|
34411
34419
|
// for an FS node, even if wrapped with PROXYFS.
|
|
34412
|
-
const
|
|
34420
|
+
const originalNodeFsCreateNode = NODEFS.createNode;
|
|
34413
34421
|
NODEFS.createNode = function createNodeWithSharedFlag() {
|
|
34414
|
-
const node =
|
|
34422
|
+
const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
|
|
34415
34423
|
node.isSharedFS = true;
|
|
34416
34424
|
return node;
|
|
34417
34425
|
};
|
|
34418
34426
|
|
|
34419
34427
|
var originalHashAddNode = FS.hashAddNode;
|
|
34420
34428
|
FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
|
|
34421
|
-
if (
|
|
34422
|
-
typeof locking === 'object' &&
|
|
34423
|
-
locking?.is_shared_fs_node(node)
|
|
34424
|
-
) {
|
|
34429
|
+
if (node?.isSharedFS) {
|
|
34425
34430
|
// Avoid caching shared VFS nodes so multiple instances
|
|
34426
34431
|
// can access the same underlying filesystem without
|
|
34427
34432
|
// conflicting caches.
|
package/jspi/php_8_4.js
CHANGED
|
@@ -6,10 +6,10 @@ const require = createRequire(import.meta.url);
|
|
|
6
6
|
// Note: The path module is currently needed by code injected by the php-wasm Dockerfile.
|
|
7
7
|
import path from 'path';
|
|
8
8
|
|
|
9
|
-
const dependencyFilename = path.join(__dirname, '
|
|
9
|
+
const dependencyFilename = path.join(__dirname, '8_4_11', 'php_8_4.wasm');
|
|
10
10
|
export { dependencyFilename };
|
|
11
|
-
export const dependenciesTotalSize =
|
|
12
|
-
const phpVersionString = '8.4.
|
|
11
|
+
export const dependenciesTotalSize = 36373389;
|
|
12
|
+
const phpVersionString = '8.4.11';
|
|
13
13
|
export function init(RuntimeName, PHPLoader) {
|
|
14
14
|
// The rest of the code comes from the built php.js file and esm-suffix.js
|
|
15
15
|
// include: shell.js
|
|
@@ -1012,7 +1012,7 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
1012
1012
|
|
|
1013
1013
|
/** @type {WebAssembly.Table} */
|
|
1014
1014
|
var wasmTable = new WebAssembly.Table({
|
|
1015
|
-
initial:
|
|
1015
|
+
initial: 16556,
|
|
1016
1016
|
element: 'anyfunc',
|
|
1017
1017
|
});
|
|
1018
1018
|
var getWasmTableEntry = (funcPtr) => {
|
|
@@ -6994,35 +6994,25 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
6994
6994
|
1: 'exclusive',
|
|
6995
6995
|
2: 'unlocked',
|
|
6996
6996
|
},
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
6997
|
+
is_path_to_shared_fs(path) {
|
|
6998
|
+
_js_wasm_trace('is_path_to_shared_fs(%s)', path);
|
|
6999
|
+
const { node } = FS.lookupPath(path, { noent_okay: true });
|
|
7000
|
+
if (node.mount.type !== PROXYFS) {
|
|
7001
|
+
return !!node.isSharedFS;
|
|
7002
|
+
}
|
|
7003
|
+
|
|
7004
|
+
// This looks like a PROXYFS node. Let's try a lookup.
|
|
7005
|
+
const nodePath = PROXYFS.realPath(node);
|
|
7006
|
+
const backingFs = node?.mount?.opts?.fs;
|
|
7007
|
+
if (backingFs) {
|
|
7008
|
+
// Tolerate ENOENT because looking up a MEMFS node by path always fails.
|
|
7009
|
+
const { node: backingNode } = backingFs.lookupPath(nodePath, {
|
|
7010
|
+
noent_okay: true,
|
|
7011
|
+
});
|
|
7012
|
+
return !!backingNode?.isSharedFS;
|
|
7008
7013
|
}
|
|
7009
7014
|
|
|
7010
|
-
|
|
7011
|
-
if (node.mount.type !== NODEFS) {
|
|
7012
|
-
return false;
|
|
7013
|
-
}
|
|
7014
|
-
const vfsPath = node.mount.type.realPath(node);
|
|
7015
|
-
try {
|
|
7016
|
-
const underlyingNode =
|
|
7017
|
-
node.mount.opts.fs.lookupPath(vfsPath)?.node;
|
|
7018
|
-
return !!underlyingNode?.isSharedFS;
|
|
7019
|
-
} catch (e) {
|
|
7020
|
-
return false;
|
|
7021
|
-
}
|
|
7022
|
-
},
|
|
7023
|
-
is_path_to_shared_fs(path) {
|
|
7024
|
-
const { node } = FS.lookupPath(path);
|
|
7025
|
-
return locking.is_shared_fs_node(node);
|
|
7015
|
+
return false;
|
|
7026
7016
|
},
|
|
7027
7017
|
get_fd_access_mode(fd) {
|
|
7028
7018
|
const emscripten_F_GETFL = Number('3');
|
|
@@ -7040,8 +7030,26 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
7040
7030
|
}
|
|
7041
7031
|
},
|
|
7042
7032
|
get_native_path_from_vfs_path(vfsPath) {
|
|
7043
|
-
|
|
7044
|
-
|
|
7033
|
+
// TODO: Should there be a try/catch here?
|
|
7034
|
+
const { node } = FS.lookupPath(vfsPath, {});
|
|
7035
|
+
if (node.mount.type === NODEFS) {
|
|
7036
|
+
return NODEFS.realPath(node);
|
|
7037
|
+
} else if (node.mount.type === PROXYFS) {
|
|
7038
|
+
// TODO: Tolerate ENOENT here?
|
|
7039
|
+
const { node: backingNode, path: backingPath } =
|
|
7040
|
+
node.mount.opts.fs.lookupPath(vfsPath);
|
|
7041
|
+
_js_wasm_trace(
|
|
7042
|
+
'backingNode for %s: %s',
|
|
7043
|
+
vfsPath,
|
|
7044
|
+
backingPath,
|
|
7045
|
+
backingNode
|
|
7046
|
+
);
|
|
7047
|
+
return backingNode.mount.type.realPath(backingNode);
|
|
7048
|
+
} else {
|
|
7049
|
+
throw new Error(
|
|
7050
|
+
`Unsupported filesystem type for path ${vfsPath}`
|
|
7051
|
+
);
|
|
7052
|
+
}
|
|
7045
7053
|
},
|
|
7046
7054
|
check_lock_params(fd, l_type) {
|
|
7047
7055
|
const emscripten_O_RDONLY = Number('0');
|
|
@@ -31254,13 +31262,13 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
31254
31262
|
// End JS library code
|
|
31255
31263
|
|
|
31256
31264
|
var ASM_CONSTS = {
|
|
31257
|
-
|
|
31265
|
+
16328046: ($0) => {
|
|
31258
31266
|
if (!$0) {
|
|
31259
31267
|
AL.alcErr = 0xa004;
|
|
31260
31268
|
return 1;
|
|
31261
31269
|
}
|
|
31262
31270
|
},
|
|
31263
|
-
|
|
31271
|
+
16328094: ($0) => {
|
|
31264
31272
|
if (!AL.currentCtx) {
|
|
31265
31273
|
err('alGetProcAddress() called without a valid context');
|
|
31266
31274
|
return 1;
|
|
@@ -34409,19 +34417,16 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
34409
34417
|
// We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
|
|
34410
34418
|
// nodes. This way we can tell whether file-locking is needed and possible
|
|
34411
34419
|
// for an FS node, even if wrapped with PROXYFS.
|
|
34412
|
-
const
|
|
34420
|
+
const originalNodeFsCreateNode = NODEFS.createNode;
|
|
34413
34421
|
NODEFS.createNode = function createNodeWithSharedFlag() {
|
|
34414
|
-
const node =
|
|
34422
|
+
const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
|
|
34415
34423
|
node.isSharedFS = true;
|
|
34416
34424
|
return node;
|
|
34417
34425
|
};
|
|
34418
34426
|
|
|
34419
34427
|
var originalHashAddNode = FS.hashAddNode;
|
|
34420
34428
|
FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
|
|
34421
|
-
if (
|
|
34422
|
-
typeof locking === 'object' &&
|
|
34423
|
-
locking?.is_shared_fs_node(node)
|
|
34424
|
-
) {
|
|
34429
|
+
if (node?.isSharedFS) {
|
|
34425
34430
|
// Avoid caching shared VFS nodes so multiple instances
|
|
34426
34431
|
// can access the same underlying filesystem without
|
|
34427
34432
|
// conflicting caches.
|
|
@@ -147,11 +147,18 @@ export declare class FileLock {
|
|
|
147
147
|
*/
|
|
148
148
|
private ensureCompatibleNativeLock;
|
|
149
149
|
/**
|
|
150
|
-
* Check if a
|
|
150
|
+
* Check if a lock exists that conflicts with the requested range lock.
|
|
151
151
|
*
|
|
152
152
|
* @param requestedLock The desired byte range lock.
|
|
153
153
|
* @returns True if a conflicting lock exists, false otherwise.
|
|
154
154
|
*/
|
|
155
|
-
private
|
|
155
|
+
private isThereAConflictWithRequestedRangeLock;
|
|
156
|
+
/**
|
|
157
|
+
* Check if a lock exists that conflicts with the requested whole-file lock.
|
|
158
|
+
*
|
|
159
|
+
* @param requestedLock The desired whole-file lock.
|
|
160
|
+
* @returns True if a conflicting lock exists, false otherwise.
|
|
161
|
+
*/
|
|
162
|
+
private isThereAConflictWithRequestedWholeFileLock;
|
|
156
163
|
}
|
|
157
164
|
export {};
|
package/lib/load-runtime.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SupportedPHPVersion, EmscriptenOptions, RemoteAPI } from '@php-wasm/universal';
|
|
2
2
|
import type { FileLockManager } from './file-lock-manager';
|
|
3
|
+
import type { Promised } from '@php-wasm/util';
|
|
3
4
|
export interface PHPLoaderOptions {
|
|
4
5
|
emscriptenOptions?: EmscriptenOptions;
|
|
5
6
|
followSymlinks?: boolean;
|
|
@@ -25,7 +26,7 @@ type PHPLoaderOptionsForNode = PHPLoaderOptions & {
|
|
|
25
26
|
* file lock managers are supported.
|
|
26
27
|
* When running with Asyncify, the file lock manager must be synchronous.
|
|
27
28
|
*/
|
|
28
|
-
fileLockManager?: RemoteAPI<FileLockManager> | FileLockManager;
|
|
29
|
+
fileLockManager?: RemoteAPI<FileLockManager> | Promised<FileLockManager> | FileLockManager;
|
|
29
30
|
/**
|
|
30
31
|
* An optional function to collect trace messages.
|
|
31
32
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "GPL-2.0-or-later",
|
|
40
40
|
"types": "index.d.ts",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "025d757fb86aaaae722819154a73fc8b6c728cc7",
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.18.3",
|
|
44
44
|
"npm": ">=10.1.0"
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"wasm-feature-detect": "1.8.0",
|
|
50
50
|
"ws": "8.18.1",
|
|
51
51
|
"yargs": "17.7.2",
|
|
52
|
-
"@php-wasm/node-polyfills": "2.0.
|
|
53
|
-
"@php-wasm/universal": "2.0.
|
|
54
|
-
"@php-wasm/logger": "2.0.
|
|
55
|
-
"@php-wasm/util": "2.0.
|
|
56
|
-
"@wp-playground/common": "2.0.
|
|
52
|
+
"@php-wasm/node-polyfills": "2.0.7",
|
|
53
|
+
"@php-wasm/universal": "2.0.7",
|
|
54
|
+
"@php-wasm/logger": "2.0.7",
|
|
55
|
+
"@php-wasm/util": "2.0.7",
|
|
56
|
+
"@wp-playground/common": "2.0.7"
|
|
57
57
|
},
|
|
58
58
|
"overrides": {
|
|
59
59
|
"rollup": "^4.34.6",
|