@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.
@@ -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, '8_3_23', 'php_8_3.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_3_24', 'php_8_3.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 33145262;
12
- const phpVersionString = '8.3.23';
11
+ export const dependenciesTotalSize = 33144925;
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
@@ -831,7 +831,7 @@ export function init(RuntimeName, PHPLoader) {
831
831
  },
832
832
  };
833
833
 
834
- var ___heap_base = 15213312;
834
+ var ___heap_base = 15213248;
835
835
 
836
836
  var alignMemory = (size, alignment) => {
837
837
  return Math.ceil(size / alignment) * alignment;
@@ -995,7 +995,7 @@ export function init(RuntimeName, PHPLoader) {
995
995
 
996
996
  /** @type {WebAssembly.Table} */
997
997
  var wasmTable = new WebAssembly.Table({
998
- initial: 16130,
998
+ initial: 16131,
999
999
  element: 'anyfunc',
1000
1000
  });
1001
1001
  var getWasmTableEntry = (funcPtr) => {
@@ -1856,13 +1856,13 @@ export function init(RuntimeName, PHPLoader) {
1856
1856
  1024
1857
1857
  );
1858
1858
 
1859
- var ___stack_high = 15213312;
1859
+ var ___stack_high = 15213248;
1860
1860
 
1861
- var ___stack_low = 14164736;
1861
+ var ___stack_low = 14164672;
1862
1862
 
1863
1863
  var ___stack_pointer = new WebAssembly.Global(
1864
1864
  { value: 'i32', mutable: true },
1865
- 15213312
1865
+ 15213248
1866
1866
  );
1867
1867
 
1868
1868
  var PATH = {
@@ -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');
@@ -32092,13 +32100,13 @@ export function init(RuntimeName, PHPLoader) {
32092
32100
  // End JS library code
32093
32101
 
32094
32102
  var ASM_CONSTS = {
32095
- 13232061: ($0) => {
32103
+ 13231949: ($0) => {
32096
32104
  if (!$0) {
32097
32105
  AL.alcErr = 0xa004;
32098
32106
  return 1;
32099
32107
  }
32100
32108
  },
32101
- 13232109: ($0) => {
32109
+ 13231997: ($0) => {
32102
32110
  if (!AL.currentCtx) {
32103
32111
  err('alGetProcAddress() called without a valid context');
32104
32112
  return 1;
@@ -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.
@@ -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, '8_4_10', 'php_8_4.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_4_11', 'php_8_4.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 36942485;
12
- const phpVersionString = '8.4.10';
11
+ export const dependenciesTotalSize = 36942530;
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
@@ -995,7 +995,7 @@ export function init(RuntimeName, PHPLoader) {
995
995
 
996
996
  /** @type {WebAssembly.Table} */
997
997
  var wasmTable = new WebAssembly.Table({
998
- initial: 16954,
998
+ initial: 16955,
999
999
  element: 'anyfunc',
1000
1000
  });
1001
1001
  var getWasmTableEntry = (funcPtr) => {
@@ -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');
@@ -32092,13 +32100,13 @@ export function init(RuntimeName, PHPLoader) {
32092
32100
  // End JS library code
32093
32101
 
32094
32102
  var ASM_CONSTS = {
32095
- 16327533: ($0) => {
32103
+ 16327421: ($0) => {
32096
32104
  if (!$0) {
32097
32105
  AL.alcErr = 0xa004;
32098
32106
  return 1;
32099
32107
  }
32100
32108
  },
32101
- 16327581: ($0) => {
32109
+ 16327469: ($0) => {
32102
32110
  if (!AL.currentCtx) {
32103
32111
  err('alGetProcAddress() called without a valid context');
32104
32112
  return 1;
@@ -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.