@php-wasm/node 2.0.5 → 2.0.8

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -8,7 +8,7 @@ import path from 'path';
8
8
 
9
9
  const dependencyFilename = path.join(__dirname, '7_2_34', 'php_7_2.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 29379142;
11
+ export const dependenciesTotalSize = 29381880;
12
12
  const phpVersionString = '7.2.34';
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
@@ -7103,35 +7103,25 @@ export function init(RuntimeName, PHPLoader) {
7103
7103
  1: 'exclusive',
7104
7104
  2: 'unlocked',
7105
7105
  },
7106
- is_shared_fs_node(node) {
7107
- if (node?.isSharedFS) {
7108
- return true;
7109
- }
7110
-
7111
- // Handle PROXYFS nodes which wrap other nodes.
7112
- if (
7113
- !node?.mount?.opts?.fs?.lookupPath ||
7114
- !node?.mount?.type?.realPath
7115
- ) {
7116
- return false;
7106
+ is_path_to_shared_fs(path) {
7107
+ _js_wasm_trace('is_path_to_shared_fs(%s)', path);
7108
+ const { node } = FS.lookupPath(path, { noent_okay: true });
7109
+ if (node.mount.type !== PROXYFS) {
7110
+ return !!node.isSharedFS;
7111
+ }
7112
+
7113
+ // This looks like a PROXYFS node. Let's try a lookup.
7114
+ const nodePath = PROXYFS.realPath(node);
7115
+ const backingFs = node?.mount?.opts?.fs;
7116
+ if (backingFs) {
7117
+ // Tolerate ENOENT because looking up a MEMFS node by path always fails.
7118
+ const { node: backingNode } = backingFs.lookupPath(nodePath, {
7119
+ noent_okay: true,
7120
+ });
7121
+ return !!backingNode?.isSharedFS;
7117
7122
  }
7118
7123
 
7119
- // Only NODEFS can be shared between workers at the moment.
7120
- if (node.mount.type !== NODEFS) {
7121
- return false;
7122
- }
7123
- const vfsPath = node.mount.type.realPath(node);
7124
- try {
7125
- const underlyingNode =
7126
- node.mount.opts.fs.lookupPath(vfsPath)?.node;
7127
- return !!underlyingNode?.isSharedFS;
7128
- } catch (e) {
7129
- return false;
7130
- }
7131
- },
7132
- is_path_to_shared_fs(path) {
7133
- const { node } = FS.lookupPath(path);
7134
- return locking.is_shared_fs_node(node);
7124
+ return false;
7135
7125
  },
7136
7126
  get_fd_access_mode(fd) {
7137
7127
  const emscripten_F_GETFL = Number('3');
@@ -7149,8 +7139,26 @@ export function init(RuntimeName, PHPLoader) {
7149
7139
  }
7150
7140
  },
7151
7141
  get_native_path_from_vfs_path(vfsPath) {
7152
- const { node } = FS.lookupPath(vfsPath);
7153
- return NODEFS.realPath(node);
7142
+ // TODO: Should there be a try/catch here?
7143
+ const { node } = FS.lookupPath(vfsPath, {});
7144
+ if (node.mount.type === NODEFS) {
7145
+ return NODEFS.realPath(node);
7146
+ } else if (node.mount.type === PROXYFS) {
7147
+ // TODO: Tolerate ENOENT here?
7148
+ const { node: backingNode, path: backingPath } =
7149
+ node.mount.opts.fs.lookupPath(vfsPath);
7150
+ _js_wasm_trace(
7151
+ 'backingNode for %s: %s',
7152
+ vfsPath,
7153
+ backingPath,
7154
+ backingNode
7155
+ );
7156
+ return backingNode.mount.type.realPath(backingNode);
7157
+ } else {
7158
+ throw new Error(
7159
+ `Unsupported filesystem type for path ${vfsPath}`
7160
+ );
7161
+ }
7154
7162
  },
7155
7163
  check_lock_params(fd, l_type) {
7156
7164
  const emscripten_O_RDONLY = Number('0');
@@ -35622,19 +35630,16 @@ export function init(RuntimeName, PHPLoader) {
35622
35630
  // We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
35623
35631
  // nodes. This way we can tell whether file-locking is needed and possible
35624
35632
  // for an FS node, even if wrapped with PROXYFS.
35625
- const originalCreateNode = NODEFS.createNode;
35633
+ const originalNodeFsCreateNode = NODEFS.createNode;
35626
35634
  NODEFS.createNode = function createNodeWithSharedFlag() {
35627
- const node = originalCreateNode.apply(NODEFS, arguments);
35635
+ const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
35628
35636
  node.isSharedFS = true;
35629
35637
  return node;
35630
35638
  };
35631
35639
 
35632
35640
  var originalHashAddNode = FS.hashAddNode;
35633
35641
  FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
35634
- if (
35635
- typeof locking === 'object' &&
35636
- locking?.is_shared_fs_node(node)
35637
- ) {
35642
+ if (node?.isSharedFS) {
35638
35643
  // Avoid caching shared VFS nodes so multiple instances
35639
35644
  // can access the same underlying filesystem without
35640
35645
  // conflicting caches.
@@ -8,7 +8,7 @@ import path from 'path';
8
8
 
9
9
  const dependencyFilename = path.join(__dirname, '7_3_33', 'php_7_3.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 29695998;
11
+ export const dependenciesTotalSize = 29698903;
12
12
  const phpVersionString = '7.3.33';
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
@@ -7103,35 +7103,25 @@ export function init(RuntimeName, PHPLoader) {
7103
7103
  1: 'exclusive',
7104
7104
  2: 'unlocked',
7105
7105
  },
7106
- is_shared_fs_node(node) {
7107
- if (node?.isSharedFS) {
7108
- return true;
7109
- }
7110
-
7111
- // Handle PROXYFS nodes which wrap other nodes.
7112
- if (
7113
- !node?.mount?.opts?.fs?.lookupPath ||
7114
- !node?.mount?.type?.realPath
7115
- ) {
7116
- return false;
7106
+ is_path_to_shared_fs(path) {
7107
+ _js_wasm_trace('is_path_to_shared_fs(%s)', path);
7108
+ const { node } = FS.lookupPath(path, { noent_okay: true });
7109
+ if (node.mount.type !== PROXYFS) {
7110
+ return !!node.isSharedFS;
7111
+ }
7112
+
7113
+ // This looks like a PROXYFS node. Let's try a lookup.
7114
+ const nodePath = PROXYFS.realPath(node);
7115
+ const backingFs = node?.mount?.opts?.fs;
7116
+ if (backingFs) {
7117
+ // Tolerate ENOENT because looking up a MEMFS node by path always fails.
7118
+ const { node: backingNode } = backingFs.lookupPath(nodePath, {
7119
+ noent_okay: true,
7120
+ });
7121
+ return !!backingNode?.isSharedFS;
7117
7122
  }
7118
7123
 
7119
- // Only NODEFS can be shared between workers at the moment.
7120
- if (node.mount.type !== NODEFS) {
7121
- return false;
7122
- }
7123
- const vfsPath = node.mount.type.realPath(node);
7124
- try {
7125
- const underlyingNode =
7126
- node.mount.opts.fs.lookupPath(vfsPath)?.node;
7127
- return !!underlyingNode?.isSharedFS;
7128
- } catch (e) {
7129
- return false;
7130
- }
7131
- },
7132
- is_path_to_shared_fs(path) {
7133
- const { node } = FS.lookupPath(path);
7134
- return locking.is_shared_fs_node(node);
7124
+ return false;
7135
7125
  },
7136
7126
  get_fd_access_mode(fd) {
7137
7127
  const emscripten_F_GETFL = Number('3');
@@ -7149,8 +7139,26 @@ export function init(RuntimeName, PHPLoader) {
7149
7139
  }
7150
7140
  },
7151
7141
  get_native_path_from_vfs_path(vfsPath) {
7152
- const { node } = FS.lookupPath(vfsPath);
7153
- return NODEFS.realPath(node);
7142
+ // TODO: Should there be a try/catch here?
7143
+ const { node } = FS.lookupPath(vfsPath, {});
7144
+ if (node.mount.type === NODEFS) {
7145
+ return NODEFS.realPath(node);
7146
+ } else if (node.mount.type === PROXYFS) {
7147
+ // TODO: Tolerate ENOENT here?
7148
+ const { node: backingNode, path: backingPath } =
7149
+ node.mount.opts.fs.lookupPath(vfsPath);
7150
+ _js_wasm_trace(
7151
+ 'backingNode for %s: %s',
7152
+ vfsPath,
7153
+ backingPath,
7154
+ backingNode
7155
+ );
7156
+ return backingNode.mount.type.realPath(backingNode);
7157
+ } else {
7158
+ throw new Error(
7159
+ `Unsupported filesystem type for path ${vfsPath}`
7160
+ );
7161
+ }
7154
7162
  },
7155
7163
  check_lock_params(fd, l_type) {
7156
7164
  const emscripten_O_RDONLY = Number('0');
@@ -35636,19 +35644,16 @@ export function init(RuntimeName, PHPLoader) {
35636
35644
  // We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
35637
35645
  // nodes. This way we can tell whether file-locking is needed and possible
35638
35646
  // for an FS node, even if wrapped with PROXYFS.
35639
- const originalCreateNode = NODEFS.createNode;
35647
+ const originalNodeFsCreateNode = NODEFS.createNode;
35640
35648
  NODEFS.createNode = function createNodeWithSharedFlag() {
35641
- const node = originalCreateNode.apply(NODEFS, arguments);
35649
+ const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
35642
35650
  node.isSharedFS = true;
35643
35651
  return node;
35644
35652
  };
35645
35653
 
35646
35654
  var originalHashAddNode = FS.hashAddNode;
35647
35655
  FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
35648
- if (
35649
- typeof locking === 'object' &&
35650
- locking?.is_shared_fs_node(node)
35651
- ) {
35656
+ if (node?.isSharedFS) {
35652
35657
  // Avoid caching shared VFS nodes so multiple instances
35653
35658
  // can access the same underlying filesystem without
35654
35659
  // conflicting caches.
@@ -8,7 +8,7 @@ import path from 'path';
8
8
 
9
9
  const dependencyFilename = path.join(__dirname, '7_4_33', 'php_7_4.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 30107713;
11
+ export const dependenciesTotalSize = 30110863;
12
12
  const phpVersionString = '7.4.33';
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
@@ -7103,35 +7103,25 @@ export function init(RuntimeName, PHPLoader) {
7103
7103
  1: 'exclusive',
7104
7104
  2: 'unlocked',
7105
7105
  },
7106
- is_shared_fs_node(node) {
7107
- if (node?.isSharedFS) {
7108
- return true;
7109
- }
7110
-
7111
- // Handle PROXYFS nodes which wrap other nodes.
7112
- if (
7113
- !node?.mount?.opts?.fs?.lookupPath ||
7114
- !node?.mount?.type?.realPath
7115
- ) {
7116
- return false;
7106
+ is_path_to_shared_fs(path) {
7107
+ _js_wasm_trace('is_path_to_shared_fs(%s)', path);
7108
+ const { node } = FS.lookupPath(path, { noent_okay: true });
7109
+ if (node.mount.type !== PROXYFS) {
7110
+ return !!node.isSharedFS;
7111
+ }
7112
+
7113
+ // This looks like a PROXYFS node. Let's try a lookup.
7114
+ const nodePath = PROXYFS.realPath(node);
7115
+ const backingFs = node?.mount?.opts?.fs;
7116
+ if (backingFs) {
7117
+ // Tolerate ENOENT because looking up a MEMFS node by path always fails.
7118
+ const { node: backingNode } = backingFs.lookupPath(nodePath, {
7119
+ noent_okay: true,
7120
+ });
7121
+ return !!backingNode?.isSharedFS;
7117
7122
  }
7118
7123
 
7119
- // Only NODEFS can be shared between workers at the moment.
7120
- if (node.mount.type !== NODEFS) {
7121
- return false;
7122
- }
7123
- const vfsPath = node.mount.type.realPath(node);
7124
- try {
7125
- const underlyingNode =
7126
- node.mount.opts.fs.lookupPath(vfsPath)?.node;
7127
- return !!underlyingNode?.isSharedFS;
7128
- } catch (e) {
7129
- return false;
7130
- }
7131
- },
7132
- is_path_to_shared_fs(path) {
7133
- const { node } = FS.lookupPath(path);
7134
- return locking.is_shared_fs_node(node);
7124
+ return false;
7135
7125
  },
7136
7126
  get_fd_access_mode(fd) {
7137
7127
  const emscripten_F_GETFL = Number('3');
@@ -7149,8 +7139,26 @@ export function init(RuntimeName, PHPLoader) {
7149
7139
  }
7150
7140
  },
7151
7141
  get_native_path_from_vfs_path(vfsPath) {
7152
- const { node } = FS.lookupPath(vfsPath);
7153
- return NODEFS.realPath(node);
7142
+ // TODO: Should there be a try/catch here?
7143
+ const { node } = FS.lookupPath(vfsPath, {});
7144
+ if (node.mount.type === NODEFS) {
7145
+ return NODEFS.realPath(node);
7146
+ } else if (node.mount.type === PROXYFS) {
7147
+ // TODO: Tolerate ENOENT here?
7148
+ const { node: backingNode, path: backingPath } =
7149
+ node.mount.opts.fs.lookupPath(vfsPath);
7150
+ _js_wasm_trace(
7151
+ 'backingNode for %s: %s',
7152
+ vfsPath,
7153
+ backingPath,
7154
+ backingNode
7155
+ );
7156
+ return backingNode.mount.type.realPath(backingNode);
7157
+ } else {
7158
+ throw new Error(
7159
+ `Unsupported filesystem type for path ${vfsPath}`
7160
+ );
7161
+ }
7154
7162
  },
7155
7163
  check_lock_params(fd, l_type) {
7156
7164
  const emscripten_O_RDONLY = Number('0');
@@ -35649,19 +35657,16 @@ export function init(RuntimeName, PHPLoader) {
35649
35657
  // We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
35650
35658
  // nodes. This way we can tell whether file-locking is needed and possible
35651
35659
  // for an FS node, even if wrapped with PROXYFS.
35652
- const originalCreateNode = NODEFS.createNode;
35660
+ const originalNodeFsCreateNode = NODEFS.createNode;
35653
35661
  NODEFS.createNode = function createNodeWithSharedFlag() {
35654
- const node = originalCreateNode.apply(NODEFS, arguments);
35662
+ const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
35655
35663
  node.isSharedFS = true;
35656
35664
  return node;
35657
35665
  };
35658
35666
 
35659
35667
  var originalHashAddNode = FS.hashAddNode;
35660
35668
  FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
35661
- if (
35662
- typeof locking === 'object' &&
35663
- locking?.is_shared_fs_node(node)
35664
- ) {
35669
+ if (node?.isSharedFS) {
35665
35670
  // Avoid caching shared VFS nodes so multiple instances
35666
35671
  // can access the same underlying filesystem without
35667
35672
  // conflicting caches.
@@ -8,7 +8,7 @@ import path from 'path';
8
8
 
9
9
  const dependencyFilename = path.join(__dirname, '8_0_30', 'php_8_0.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 31315360;
11
+ export const dependenciesTotalSize = 31318489;
12
12
  const phpVersionString = '8.0.30';
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
@@ -7103,35 +7103,25 @@ export function init(RuntimeName, PHPLoader) {
7103
7103
  1: 'exclusive',
7104
7104
  2: 'unlocked',
7105
7105
  },
7106
- is_shared_fs_node(node) {
7107
- if (node?.isSharedFS) {
7108
- return true;
7109
- }
7110
-
7111
- // Handle PROXYFS nodes which wrap other nodes.
7112
- if (
7113
- !node?.mount?.opts?.fs?.lookupPath ||
7114
- !node?.mount?.type?.realPath
7115
- ) {
7116
- return false;
7106
+ is_path_to_shared_fs(path) {
7107
+ _js_wasm_trace('is_path_to_shared_fs(%s)', path);
7108
+ const { node } = FS.lookupPath(path, { noent_okay: true });
7109
+ if (node.mount.type !== PROXYFS) {
7110
+ return !!node.isSharedFS;
7111
+ }
7112
+
7113
+ // This looks like a PROXYFS node. Let's try a lookup.
7114
+ const nodePath = PROXYFS.realPath(node);
7115
+ const backingFs = node?.mount?.opts?.fs;
7116
+ if (backingFs) {
7117
+ // Tolerate ENOENT because looking up a MEMFS node by path always fails.
7118
+ const { node: backingNode } = backingFs.lookupPath(nodePath, {
7119
+ noent_okay: true,
7120
+ });
7121
+ return !!backingNode?.isSharedFS;
7117
7122
  }
7118
7123
 
7119
- // Only NODEFS can be shared between workers at the moment.
7120
- if (node.mount.type !== NODEFS) {
7121
- return false;
7122
- }
7123
- const vfsPath = node.mount.type.realPath(node);
7124
- try {
7125
- const underlyingNode =
7126
- node.mount.opts.fs.lookupPath(vfsPath)?.node;
7127
- return !!underlyingNode?.isSharedFS;
7128
- } catch (e) {
7129
- return false;
7130
- }
7131
- },
7132
- is_path_to_shared_fs(path) {
7133
- const { node } = FS.lookupPath(path);
7134
- return locking.is_shared_fs_node(node);
7124
+ return false;
7135
7125
  },
7136
7126
  get_fd_access_mode(fd) {
7137
7127
  const emscripten_F_GETFL = Number('3');
@@ -7149,8 +7139,26 @@ export function init(RuntimeName, PHPLoader) {
7149
7139
  }
7150
7140
  },
7151
7141
  get_native_path_from_vfs_path(vfsPath) {
7152
- const { node } = FS.lookupPath(vfsPath);
7153
- return NODEFS.realPath(node);
7142
+ // TODO: Should there be a try/catch here?
7143
+ const { node } = FS.lookupPath(vfsPath, {});
7144
+ if (node.mount.type === NODEFS) {
7145
+ return NODEFS.realPath(node);
7146
+ } else if (node.mount.type === PROXYFS) {
7147
+ // TODO: Tolerate ENOENT here?
7148
+ const { node: backingNode, path: backingPath } =
7149
+ node.mount.opts.fs.lookupPath(vfsPath);
7150
+ _js_wasm_trace(
7151
+ 'backingNode for %s: %s',
7152
+ vfsPath,
7153
+ backingPath,
7154
+ backingNode
7155
+ );
7156
+ return backingNode.mount.type.realPath(backingNode);
7157
+ } else {
7158
+ throw new Error(
7159
+ `Unsupported filesystem type for path ${vfsPath}`
7160
+ );
7161
+ }
7154
7162
  },
7155
7163
  check_lock_params(fd, l_type) {
7156
7164
  const emscripten_O_RDONLY = Number('0');
@@ -35662,19 +35670,16 @@ export function init(RuntimeName, PHPLoader) {
35662
35670
  // We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
35663
35671
  // nodes. This way we can tell whether file-locking is needed and possible
35664
35672
  // for an FS node, even if wrapped with PROXYFS.
35665
- const originalCreateNode = NODEFS.createNode;
35673
+ const originalNodeFsCreateNode = NODEFS.createNode;
35666
35674
  NODEFS.createNode = function createNodeWithSharedFlag() {
35667
- const node = originalCreateNode.apply(NODEFS, arguments);
35675
+ const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
35668
35676
  node.isSharedFS = true;
35669
35677
  return node;
35670
35678
  };
35671
35679
 
35672
35680
  var originalHashAddNode = FS.hashAddNode;
35673
35681
  FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
35674
- if (
35675
- typeof locking === 'object' &&
35676
- locking?.is_shared_fs_node(node)
35677
- ) {
35682
+ if (node?.isSharedFS) {
35678
35683
  // Avoid caching shared VFS nodes so multiple instances
35679
35684
  // can access the same underlying filesystem without
35680
35685
  // conflicting caches.
@@ -8,7 +8,7 @@ import path from 'path';
8
8
 
9
9
  const dependencyFilename = path.join(__dirname, '8_1_33', 'php_8_1.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 31648487;
11
+ export const dependenciesTotalSize = 31651651;
12
12
  const phpVersionString = '8.1.33';
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
@@ -7103,35 +7103,25 @@ export function init(RuntimeName, PHPLoader) {
7103
7103
  1: 'exclusive',
7104
7104
  2: 'unlocked',
7105
7105
  },
7106
- is_shared_fs_node(node) {
7107
- if (node?.isSharedFS) {
7108
- return true;
7109
- }
7110
-
7111
- // Handle PROXYFS nodes which wrap other nodes.
7112
- if (
7113
- !node?.mount?.opts?.fs?.lookupPath ||
7114
- !node?.mount?.type?.realPath
7115
- ) {
7116
- return false;
7106
+ is_path_to_shared_fs(path) {
7107
+ _js_wasm_trace('is_path_to_shared_fs(%s)', path);
7108
+ const { node } = FS.lookupPath(path, { noent_okay: true });
7109
+ if (node.mount.type !== PROXYFS) {
7110
+ return !!node.isSharedFS;
7111
+ }
7112
+
7113
+ // This looks like a PROXYFS node. Let's try a lookup.
7114
+ const nodePath = PROXYFS.realPath(node);
7115
+ const backingFs = node?.mount?.opts?.fs;
7116
+ if (backingFs) {
7117
+ // Tolerate ENOENT because looking up a MEMFS node by path always fails.
7118
+ const { node: backingNode } = backingFs.lookupPath(nodePath, {
7119
+ noent_okay: true,
7120
+ });
7121
+ return !!backingNode?.isSharedFS;
7117
7122
  }
7118
7123
 
7119
- // Only NODEFS can be shared between workers at the moment.
7120
- if (node.mount.type !== NODEFS) {
7121
- return false;
7122
- }
7123
- const vfsPath = node.mount.type.realPath(node);
7124
- try {
7125
- const underlyingNode =
7126
- node.mount.opts.fs.lookupPath(vfsPath)?.node;
7127
- return !!underlyingNode?.isSharedFS;
7128
- } catch (e) {
7129
- return false;
7130
- }
7131
- },
7132
- is_path_to_shared_fs(path) {
7133
- const { node } = FS.lookupPath(path);
7134
- return locking.is_shared_fs_node(node);
7124
+ return false;
7135
7125
  },
7136
7126
  get_fd_access_mode(fd) {
7137
7127
  const emscripten_F_GETFL = Number('3');
@@ -7149,8 +7139,26 @@ export function init(RuntimeName, PHPLoader) {
7149
7139
  }
7150
7140
  },
7151
7141
  get_native_path_from_vfs_path(vfsPath) {
7152
- const { node } = FS.lookupPath(vfsPath);
7153
- return NODEFS.realPath(node);
7142
+ // TODO: Should there be a try/catch here?
7143
+ const { node } = FS.lookupPath(vfsPath, {});
7144
+ if (node.mount.type === NODEFS) {
7145
+ return NODEFS.realPath(node);
7146
+ } else if (node.mount.type === PROXYFS) {
7147
+ // TODO: Tolerate ENOENT here?
7148
+ const { node: backingNode, path: backingPath } =
7149
+ node.mount.opts.fs.lookupPath(vfsPath);
7150
+ _js_wasm_trace(
7151
+ 'backingNode for %s: %s',
7152
+ vfsPath,
7153
+ backingPath,
7154
+ backingNode
7155
+ );
7156
+ return backingNode.mount.type.realPath(backingNode);
7157
+ } else {
7158
+ throw new Error(
7159
+ `Unsupported filesystem type for path ${vfsPath}`
7160
+ );
7161
+ }
7154
7162
  },
7155
7163
  check_lock_params(fd, l_type) {
7156
7164
  const emscripten_O_RDONLY = Number('0');
@@ -35675,19 +35683,16 @@ export function init(RuntimeName, PHPLoader) {
35675
35683
  // We override NODEFS.createNode() to add an `isSharedFS` flag to all NODEFS
35676
35684
  // nodes. This way we can tell whether file-locking is needed and possible
35677
35685
  // for an FS node, even if wrapped with PROXYFS.
35678
- const originalCreateNode = NODEFS.createNode;
35686
+ const originalNodeFsCreateNode = NODEFS.createNode;
35679
35687
  NODEFS.createNode = function createNodeWithSharedFlag() {
35680
- const node = originalCreateNode.apply(NODEFS, arguments);
35688
+ const node = originalNodeFsCreateNode.apply(NODEFS, arguments);
35681
35689
  node.isSharedFS = true;
35682
35690
  return node;
35683
35691
  };
35684
35692
 
35685
35693
  var originalHashAddNode = FS.hashAddNode;
35686
35694
  FS.hashAddNode = function hashAddNodeIfNotSharedFS(node) {
35687
- if (
35688
- typeof locking === 'object' &&
35689
- locking?.is_shared_fs_node(node)
35690
- ) {
35695
+ if (node?.isSharedFS) {
35691
35696
  // Avoid caching shared VFS nodes so multiple instances
35692
35697
  // can access the same underlying filesystem without
35693
35698
  // conflicting caches.