@php-wasm/node 2.0.18 → 2.0.19

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/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, '8_4_11', 'php_8_4.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_4_12', 'php_8_4.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 29758773;
12
- const phpVersionString = '8.4.11';
11
+ export const dependenciesTotalSize = 29761007;
12
+ const phpVersionString = '8.4.12';
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
@@ -848,7 +848,7 @@ export function init(RuntimeName, PHPLoader) {
848
848
  },
849
849
  };
850
850
 
851
- var ___heap_base = 16973536;
851
+ var ___heap_base = 16973600;
852
852
 
853
853
  var alignMemory = (size, alignment) => {
854
854
  return Math.ceil(size / alignment) * alignment;
@@ -1743,13 +1743,13 @@ export function init(RuntimeName, PHPLoader) {
1743
1743
  1024
1744
1744
  );
1745
1745
 
1746
- var ___stack_high = 16973536;
1746
+ var ___stack_high = 16973600;
1747
1747
 
1748
- var ___stack_low = 15924960;
1748
+ var ___stack_low = 15925024;
1749
1749
 
1750
1750
  var ___stack_pointer = new WebAssembly.Global(
1751
1751
  { value: 'i32', mutable: true },
1752
- 16973536
1752
+ 16973600
1753
1753
  );
1754
1754
 
1755
1755
  var PATH = {
@@ -6884,26 +6884,36 @@ export function init(RuntimeName, PHPLoader) {
6884
6884
 
6885
6885
  var _fd_close = function fd_close(fd) {
6886
6886
  return Asyncify.handleAsync(async () => {
6887
- const [vfsPath, pathResolutionErrno] =
6888
- locking.get_vfs_path_from_fd(fd);
6889
- if (pathResolutionErrno !== 0) {
6890
- _js_wasm_trace(
6891
- 'fd_close(%d) get_vfs_path_from_fd error %d',
6892
- fd,
6893
- pathResolutionErrno
6894
- );
6895
- return -ERRNO_CODES.EBADF;
6896
- }
6897
-
6898
- const result = _builtin_fd_close(fd);
6899
- if (result !== 0 || !locking.maybeLockedFds.has(fd)) {
6900
- _js_wasm_trace('fd_close(%d) result %d', fd, result);
6901
- return result;
6887
+ const fdCloseResult = _builtin_fd_close(fd);
6888
+ if (fdCloseResult !== 0 || !locking.maybeLockedFds.has(fd)) {
6889
+ _js_wasm_trace('fd_close(%d) result %d', fd, fdCloseResult);
6890
+ return fdCloseResult;
6902
6891
  }
6903
- const nativeFilePath =
6904
- locking.get_native_path_from_vfs_path(vfsPath);
6905
6892
 
6906
6893
  try {
6894
+ const [vfsPath, pathResolutionErrno] =
6895
+ locking.get_vfs_path_from_fd(fd);
6896
+ if (pathResolutionErrno !== 0) {
6897
+ _js_wasm_trace(
6898
+ 'fd_close(%d) get_vfs_path_from_fd error %d',
6899
+ fd,
6900
+ pathResolutionErrno
6901
+ );
6902
+ /*
6903
+ * It looks like the file may have had an associated lock,
6904
+ * but since we cannot look up the path,
6905
+ * there is nothing more for us to do.
6906
+ *
6907
+ * NOTE: This seems possible for files that are locked and
6908
+ * then unlinked before close. It is an opportunity for a
6909
+ * lock to be orphaned in the lock manager.
6910
+ * @TODO: Explore how to ensure cleanup in this case.
6911
+ */
6912
+ return fdCloseResult;
6913
+ }
6914
+
6915
+ const nativeFilePath =
6916
+ locking.get_native_path_from_vfs_path(vfsPath);
6907
6917
  await PHPLoader.fileLockManager.releaseLocksForProcessFd(
6908
6918
  PHPLoader.processId,
6909
6919
  fd,
@@ -6915,7 +6925,7 @@ export function init(RuntimeName, PHPLoader) {
6915
6925
  } finally {
6916
6926
  locking.maybeLockedFds.delete(fd);
6917
6927
  }
6918
- return result;
6928
+ return fdCloseResult;
6919
6929
  });
6920
6930
  };
6921
6931
  _fd_close.sig = 'ii';
@@ -7030,8 +7040,12 @@ export function init(RuntimeName, PHPLoader) {
7030
7040
  }
7031
7041
  },
7032
7042
  get_native_path_from_vfs_path(vfsPath) {
7033
- // TODO: Should there be a try/catch here?
7034
- const { node } = FS.lookupPath(vfsPath, {});
7043
+ const { node } = FS.lookupPath(vfsPath, {
7044
+ noent_okay: true,
7045
+ });
7046
+ if (!node) {
7047
+ throw new Error(`No node found for VFS path ${vfsPath}`);
7048
+ }
7035
7049
  if (node.mount.type === NODEFS) {
7036
7050
  return NODEFS.realPath(node);
7037
7051
  } else if (node.mount.type === PROXYFS) {
@@ -7312,10 +7326,9 @@ export function init(RuntimeName, PHPLoader) {
7312
7326
  return -ERRNO_CODES.EINVAL;
7313
7327
  }
7314
7328
 
7315
- const nativeFilePath =
7316
- locking.get_native_path_from_vfs_path(vfsPath);
7317
-
7318
7329
  try {
7330
+ const nativeFilePath =
7331
+ locking.get_native_path_from_vfs_path(vfsPath);
7319
7332
  const conflictingLock = await Promise.resolve(
7320
7333
  PHPLoader.fileLockManager.findFirstConflictingByteRangeLock(
7321
7334
  nativeFilePath,
@@ -7451,16 +7464,16 @@ export function init(RuntimeName, PHPLoader) {
7451
7464
  pid,
7452
7465
  };
7453
7466
 
7454
- const nativeFilePath =
7455
- locking.get_native_path_from_vfs_path(vfsPath);
7456
- _js_wasm_trace(
7457
- 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7458
- fd,
7459
- vfsPath,
7460
- rangeLock
7461
- );
7462
-
7463
7467
  try {
7468
+ const nativeFilePath =
7469
+ locking.get_native_path_from_vfs_path(vfsPath);
7470
+ _js_wasm_trace(
7471
+ 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7472
+ fd,
7473
+ vfsPath,
7474
+ rangeLock
7475
+ );
7476
+
7464
7477
  const succeeded = await Promise.resolve(
7465
7478
  PHPLoader.fileLockManager.lockFileByteRange(
7466
7479
  nativeFilePath,
@@ -17371,9 +17384,9 @@ export function init(RuntimeName, PHPLoader) {
17371
17384
  return -ERRNO_CODES.EINVAL;
17372
17385
  }
17373
17386
 
17374
- const nativeFilePath =
17375
- locking.get_native_path_from_vfs_path(vfsPath);
17376
17387
  try {
17388
+ const nativeFilePath =
17389
+ locking.get_native_path_from_vfs_path(vfsPath);
17377
17390
  const obtainedLock = await Promise.resolve(
17378
17391
  PHPLoader.fileLockManager.lockWholeFile(nativeFilePath, {
17379
17392
  type: lockOpType,
@@ -17709,9 +17722,9 @@ export function init(RuntimeName, PHPLoader) {
17709
17722
  if (!cp.stdin.closed) {
17710
17723
  cp.stdin.end();
17711
17724
  }
17712
- _free(buffer);
17713
- _free(iov);
17714
- _free(pnum);
17725
+ PHPLoader['free'](buffer);
17726
+ PHPLoader['free'](iov);
17727
+ PHPLoader['free'](pnum);
17715
17728
  }
17716
17729
 
17717
17730
  // pump() can never alter the result of this function.
@@ -18366,6 +18379,11 @@ export function init(RuntimeName, PHPLoader) {
18366
18379
  return ret;
18367
18380
  };
18368
18381
 
18382
+ var setErrNo = (value) => {
18383
+ HEAP32[___errno_location() >> 2] = value;
18384
+ return value;
18385
+ };
18386
+
18369
18387
  var FS_createPath = FS.createPath;
18370
18388
 
18371
18389
  var FS_unlink = (path) => FS.unlink(path);
@@ -30790,11 +30808,6 @@ export function init(RuntimeName, PHPLoader) {
30790
30808
 
30791
30809
  var allocateUTF8 = stringToNewUTF8;
30792
30810
 
30793
- var setErrNo = (value) => {
30794
- HEAP32[___errno_location() >> 2] = value;
30795
- return value;
30796
- };
30797
-
30798
30811
  var demangle = (func) => {
30799
30812
  // If demangle has failed before, stop demangling any further function names
30800
30813
  // This avoids an infinite recursion with malloc()->abort()->stackTrace()->demangle()->malloc()->...
@@ -31262,13 +31275,13 @@ export function init(RuntimeName, PHPLoader) {
31262
31275
  // End JS library code
31263
31276
 
31264
31277
  var ASM_CONSTS = {
31265
- 15724366: ($0) => {
31278
+ 15724430: ($0) => {
31266
31279
  if (!$0) {
31267
31280
  AL.alcErr = 0xa004;
31268
31281
  return 1;
31269
31282
  }
31270
31283
  },
31271
- 15724414: ($0) => {
31284
+ 15724478: ($0) => {
31272
31285
  if (!AL.currentCtx) {
31273
31286
  err('alGetProcAddress() called without a valid context');
31274
31287
  return 1;
@@ -34263,6 +34276,7 @@ export function init(RuntimeName, PHPLoader) {
34263
34276
  Module['FS_createDevice'] = FS_createDevice;
34264
34277
  Module['FS_createDataFile'] = FS_createDataFile;
34265
34278
  Module['FS_createLazyFile'] = FS_createLazyFile;
34279
+ Module['setErrNo'] = setErrNo;
34266
34280
  Module['PROXYFS'] = PROXYFS;
34267
34281
 
34268
34282
  async function callMain(args = []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
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": "1b63e0be1a05bdd244a5c29beff2ae2c228a003e",
41
+ "gitHead": "11cac8e802cfd045c73db6f2342da8f1059c4579",
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.18",
53
- "@php-wasm/universal": "2.0.18",
54
- "@php-wasm/logger": "2.0.18",
55
- "@php-wasm/util": "2.0.18",
56
- "@wp-playground/common": "2.0.18"
52
+ "@php-wasm/node-polyfills": "2.0.19",
53
+ "@php-wasm/universal": "2.0.19",
54
+ "@php-wasm/logger": "2.0.19",
55
+ "@php-wasm/util": "2.0.19",
56
+ "@wp-playground/common": "2.0.19"
57
57
  },
58
58
  "overrides": {
59
59
  "rollup": "^4.34.6",
Binary file