diff --git a/packages/php-wasm/compile/php/phpwasm-emscripten-library-file-locking-for-node.js b/packages/php-wasm/compile/php/phpwasm-emscripten-library-file-locking-for-node.js index ba8640c3bd..ecbcba7103 100644 --- a/packages/php-wasm/compile/php/phpwasm-emscripten-library-file-locking-for-node.js +++ b/packages/php-wasm/compile/php/phpwasm-emscripten-library-file-locking-for-node.js @@ -40,13 +40,21 @@ const LibraryForFileLocking = { } // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { + return false; + } }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_7_2.js b/packages/php-wasm/node/jspi/php_7_2.js index c72732cef6..a932037328 100644 --- a/packages/php-wasm/node/jspi/php_7_2.js +++ b/packages/php-wasm/node/jspi/php_7_2.js @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_7_3.js b/packages/php-wasm/node/jspi/php_7_3.js index d4f9ec00e2..a9589884e4 100644 --- a/packages/php-wasm/node/jspi/php_7_3.js +++ b/packages/php-wasm/node/jspi/php_7_3.js @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_7_4.js b/packages/php-wasm/node/jspi/php_7_4.js index 0613e02809..5f3054ed63 100644 --- a/packages/php-wasm/node/jspi/php_7_4.js +++ b/packages/php-wasm/node/jspi/php_7_4.js @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_8_0.js b/packages/php-wasm/node/jspi/php_8_0.js index cd98a81ab5..2090f2b148 100644 --- a/packages/php-wasm/node/jspi/php_8_0.js +++ b/packages/php-wasm/node/jspi/php_8_0.js @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_8_1.js b/packages/php-wasm/node/jspi/php_8_1.js index 44bcf442a9..17bc427972 100644 --- a/packages/php-wasm/node/jspi/php_8_1.js +++ b/packages/php-wasm/node/jspi/php_8_1.js @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_8_2.js b/packages/php-wasm/node/jspi/php_8_2.js index 011565e51f..464b4d25b7 100644 --- a/packages/php-wasm/node/jspi/php_8_2.js +++ b/packages/php-wasm/node/jspi/php_8_2.js @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_8_3.js b/packages/php-wasm/node/jspi/php_8_3.js index 6d9f7c574b..31f4f1f6ee 100644 --- a/packages/php-wasm/node/jspi/php_8_3.js +++ b/packages/php-wasm/node/jspi/php_8_3.js @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path); diff --git a/packages/php-wasm/node/jspi/php_8_4.js b/packages/php-wasm/node/jspi/php_8_4.js index 9c4f7a517f..d0c72492d3 100644 --- a/packages/php-wasm/node/jspi/php_8_4.js +++ b/packages/php-wasm/node/jspi/php_8_4.js @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) { if (node?.isSharedFS) { return true; } + // Handle PROXYFS nodes which wrap other nodes. - if (!node?.mount?.opts?.fs?.lookupPath) { + if ( + !node?.mount?.opts?.fs?.lookupPath || + !node?.mount?.type?.realPath + ) { + return false; + } + + // Only NODEFS can be shared between workers at the moment. + if (node.mount.type !== NODEFS) { + return false; + } + const vfsPath = node.mount.type.realPath(node); + try { + const underlyingNode = + node.mount.opts.fs.lookupPath(vfsPath)?.node; + return !!underlyingNode?.isSharedFS; + } catch (e) { return false; } - const vfsPath = NODEFS.realPath(node); - const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node; - return !!underlyingNode?.isSharedFS; }, is_path_to_shared_fs(path) { const { node } = FS.lookupPath(path);