@php-wasm/node 1.2.2 → 2.0.0

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.
Files changed (44) hide show
  1. package/asyncify/7_2_34/php_7_2.wasm +0 -0
  2. package/asyncify/7_3_33/php_7_3.wasm +0 -0
  3. package/asyncify/7_4_33/php_7_4.wasm +0 -0
  4. package/asyncify/8_0_30/php_8_0.wasm +0 -0
  5. package/asyncify/{8_1_23 → 8_1_33}/php_8_1.wasm +0 -0
  6. package/asyncify/{8_2_10 → 8_2_29}/php_8_2.wasm +0 -0
  7. package/asyncify/{8_3_0 → 8_3_23}/php_8_3.wasm +0 -0
  8. package/asyncify/{8_4_0 → 8_4_10}/php_8_4.wasm +0 -0
  9. package/asyncify/extensions/xdebug/7_2/xdebug.so +0 -0
  10. package/asyncify/extensions/xdebug/7_3/xdebug.so +0 -0
  11. package/asyncify/extensions/xdebug/7_4/xdebug.so +0 -0
  12. package/asyncify/extensions/xdebug/8_0/xdebug.so +0 -0
  13. package/asyncify/extensions/xdebug/8_1/xdebug.so +0 -0
  14. package/asyncify/extensions/xdebug/8_2/xdebug.so +0 -0
  15. package/asyncify/extensions/xdebug/8_3/xdebug.so +0 -0
  16. package/asyncify/extensions/xdebug/8_4/xdebug.so +0 -0
  17. package/asyncify/php_7_2.js +61 -51
  18. package/asyncify/php_7_3.js +75 -51
  19. package/asyncify/php_7_4.js +88 -51
  20. package/asyncify/php_8_0.js +79 -56
  21. package/asyncify/php_8_1.js +92 -55
  22. package/asyncify/php_8_2.js +92 -55
  23. package/asyncify/php_8_3.js +92 -55
  24. package/asyncify/php_8_4.js +90 -53
  25. package/index.cjs +906 -562
  26. package/index.js +907 -561
  27. package/jspi/7_2_34/php_7_2.wasm +0 -0
  28. package/jspi/7_3_33/php_7_3.wasm +0 -0
  29. package/jspi/7_4_33/php_7_4.wasm +0 -0
  30. package/jspi/8_0_30/php_8_0.wasm +0 -0
  31. package/jspi/{8_1_23 → 8_1_33}/php_8_1.wasm +0 -0
  32. package/jspi/{8_2_10 → 8_2_29}/php_8_2.wasm +0 -0
  33. package/jspi/{8_3_0 → 8_3_23}/php_8_3.wasm +0 -0
  34. package/jspi/{8_4_0 → 8_4_10}/php_8_4.wasm +0 -0
  35. package/jspi/php_7_2.js +29 -15
  36. package/jspi/php_7_3.js +29 -15
  37. package/jspi/php_7_4.js +29 -15
  38. package/jspi/php_8_0.js +29 -15
  39. package/jspi/php_8_1.js +30 -16
  40. package/jspi/php_8_2.js +30 -16
  41. package/jspi/php_8_3.js +30 -16
  42. package/jspi/php_8_4.js +30 -16
  43. package/lib/node-fs-mount.d.ts +1 -1
  44. package/package.json +7 -7
package/jspi/php_8_2.js CHANGED
@@ -6,9 +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_2_10', 'php_8_2.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_2_29', 'php_8_2.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 31311784;
11
+ export const dependenciesTotalSize = 31474550;
12
+ const phpVersionString = '8.2.29';
12
13
  export function init(RuntimeName, PHPLoader) {
13
14
  // The rest of the code comes from the built php.js file and esm-suffix.js
14
15
  // include: shell.js
@@ -847,7 +848,7 @@ export function init(RuntimeName, PHPLoader) {
847
848
  },
848
849
  };
849
850
 
850
- var ___heap_base = 13258656;
851
+ var ___heap_base = 14295392;
851
852
 
852
853
  var alignMemory = (size, alignment) => {
853
854
  return Math.ceil(size / alignment) * alignment;
@@ -1011,7 +1012,7 @@ export function init(RuntimeName, PHPLoader) {
1011
1012
 
1012
1013
  /** @type {WebAssembly.Table} */
1013
1014
  var wasmTable = new WebAssembly.Table({
1014
- initial: 15615,
1015
+ initial: 15696,
1015
1016
  element: 'anyfunc',
1016
1017
  });
1017
1018
  var getWasmTableEntry = (funcPtr) => {
@@ -1742,13 +1743,13 @@ export function init(RuntimeName, PHPLoader) {
1742
1743
  1024
1743
1744
  );
1744
1745
 
1745
- var ___stack_high = 13258656;
1746
+ var ___stack_high = 14295392;
1746
1747
 
1747
- var ___stack_low = 13193120;
1748
+ var ___stack_low = 13246816;
1748
1749
 
1749
1750
  var ___stack_pointer = new WebAssembly.Global(
1750
1751
  { value: 'i32', mutable: true },
1751
- 13258656
1752
+ 14295392
1752
1753
  );
1753
1754
 
1754
1755
  var PATH = {
@@ -3802,10 +3803,6 @@ export function init(RuntimeName, PHPLoader) {
3802
3803
  if (FS.isMountpoint(node)) {
3803
3804
  throw new FS.ErrnoError(10);
3804
3805
  }
3805
-
3806
- if (!FS.isDir(node.mode)) {
3807
- throw new FS.ErrnoError(54);
3808
- }
3809
3806
  }
3810
3807
 
3811
3808
  var mount = {
@@ -6885,7 +6882,7 @@ export function init(RuntimeName, PHPLoader) {
6885
6882
  }
6886
6883
  }
6887
6884
 
6888
- function _fd_close(fd) {
6885
+ var _fd_close = function fd_close(fd) {
6889
6886
  return Asyncify.handleAsync(async () => {
6890
6887
  const [vfsPath, pathResolutionErrno] =
6891
6888
  locking.get_vfs_path_from_fd(fd);
@@ -6920,7 +6917,7 @@ export function init(RuntimeName, PHPLoader) {
6920
6917
  }
6921
6918
  return result;
6922
6919
  });
6923
- }
6920
+ };
6924
6921
  _fd_close.sig = 'ii';
6925
6922
  function _builtin_fd_close(fd) {
6926
6923
  try {
@@ -19335,7 +19332,7 @@ export function init(RuntimeName, PHPLoader) {
19335
19332
 
19336
19333
  var addOnExit = (cb) => onExits.unshift(cb);
19337
19334
 
19338
- var STACK_SIZE = 65536;
19335
+ var STACK_SIZE = 1048576;
19339
19336
 
19340
19337
  var STACK_ALIGN = 16;
19341
19338
 
@@ -31256,13 +31253,13 @@ export function init(RuntimeName, PHPLoader) {
31256
31253
  // End JS library code
31257
31254
 
31258
31255
  var ASM_CONSTS = {
31259
- 12264791: ($0) => {
31256
+ 12281038: ($0) => {
31260
31257
  if (!$0) {
31261
31258
  AL.alcErr = 0xa004;
31262
31259
  return 1;
31263
31260
  }
31264
31261
  },
31265
- 12264839: ($0) => {
31262
+ 12281086: ($0) => {
31266
31263
  if (!AL.currentCtx) {
31267
31264
  err('alGetProcAddress() called without a valid context');
31268
31265
  return 1;
@@ -31390,6 +31387,9 @@ export function init(RuntimeName, PHPLoader) {
31390
31387
  while (true) {
31391
31388
  var mask = POLLNVAL;
31392
31389
  mask = SYSCALLS.DEFAULT_POLLMASK;
31390
+ if (FS.isClosed(stream)) {
31391
+ return ERRNO_CODES.EBADF;
31392
+ }
31393
31393
  if (stream.stream_ops?.poll) {
31394
31394
  mask = stream.stream_ops.poll(stream, -1);
31395
31395
  }
@@ -34100,6 +34100,11 @@ export function init(RuntimeName, PHPLoader) {
34100
34100
  var _calloc = (a0, a1) => (_calloc = wasmExports['calloc'])(a0, a1);
34101
34101
  var _flock = (Module['_flock'] = (a0, a1) =>
34102
34102
  (_flock = Module['_flock'] = wasmExports['flock'])(a0, a1));
34103
+ var _initgroups = (Module['_initgroups'] = (a0, a1) =>
34104
+ (_initgroups = Module['_initgroups'] = wasmExports['initgroups'])(
34105
+ a0,
34106
+ a1
34107
+ ));
34103
34108
  var _wasm_read = (Module['_wasm_read'] = (a0, a1, a2) =>
34104
34109
  (_wasm_read = Module['_wasm_read'] = wasmExports['wasm_read'])(
34105
34110
  a0,
@@ -34425,6 +34430,15 @@ export function init(RuntimeName, PHPLoader) {
34425
34430
  };
34426
34431
  }
34427
34432
 
34433
+ /**
34434
+ * Expose the PHP version so the PHP class can make version-specific
34435
+ * adjustments to `php.ini`.
34436
+ */
34437
+ PHPLoader['phpVersion'] = (() => {
34438
+ const [major, minor, patch] = phpVersionString.split('.').map(Number);
34439
+ return { major, minor, patch };
34440
+ })();
34441
+
34428
34442
  return PHPLoader;
34429
34443
 
34430
34444
  // Close the opening bracket from esm-prefix.js:
package/jspi/php_8_3.js CHANGED
@@ -6,9 +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_0', 'php_8_3.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_3_23', 'php_8_3.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 32388923;
11
+ export const dependenciesTotalSize = 32571921;
12
+ const phpVersionString = '8.3.23';
12
13
  export function init(RuntimeName, PHPLoader) {
13
14
  // The rest of the code comes from the built php.js file and esm-suffix.js
14
15
  // include: shell.js
@@ -847,7 +848,7 @@ export function init(RuntimeName, PHPLoader) {
847
848
  },
848
849
  };
849
850
 
850
- var ___heap_base = 14208864;
851
+ var ___heap_base = 15214368;
851
852
 
852
853
  var alignMemory = (size, alignment) => {
853
854
  return Math.ceil(size / alignment) * alignment;
@@ -1011,7 +1012,7 @@ export function init(RuntimeName, PHPLoader) {
1011
1012
 
1012
1013
  /** @type {WebAssembly.Table} */
1013
1014
  var wasmTable = new WebAssembly.Table({
1014
- initial: 15668,
1015
+ initial: 15738,
1015
1016
  element: 'anyfunc',
1016
1017
  });
1017
1018
  var getWasmTableEntry = (funcPtr) => {
@@ -1742,13 +1743,13 @@ export function init(RuntimeName, PHPLoader) {
1742
1743
  1024
1743
1744
  );
1744
1745
 
1745
- var ___stack_high = 14208864;
1746
+ var ___stack_high = 15214368;
1746
1747
 
1747
- var ___stack_low = 14143328;
1748
+ var ___stack_low = 14165792;
1748
1749
 
1749
1750
  var ___stack_pointer = new WebAssembly.Global(
1750
1751
  { value: 'i32', mutable: true },
1751
- 14208864
1752
+ 15214368
1752
1753
  );
1753
1754
 
1754
1755
  var PATH = {
@@ -3802,10 +3803,6 @@ export function init(RuntimeName, PHPLoader) {
3802
3803
  if (FS.isMountpoint(node)) {
3803
3804
  throw new FS.ErrnoError(10);
3804
3805
  }
3805
-
3806
- if (!FS.isDir(node.mode)) {
3807
- throw new FS.ErrnoError(54);
3808
- }
3809
3806
  }
3810
3807
 
3811
3808
  var mount = {
@@ -6885,7 +6882,7 @@ export function init(RuntimeName, PHPLoader) {
6885
6882
  }
6886
6883
  }
6887
6884
 
6888
- function _fd_close(fd) {
6885
+ var _fd_close = function fd_close(fd) {
6889
6886
  return Asyncify.handleAsync(async () => {
6890
6887
  const [vfsPath, pathResolutionErrno] =
6891
6888
  locking.get_vfs_path_from_fd(fd);
@@ -6920,7 +6917,7 @@ export function init(RuntimeName, PHPLoader) {
6920
6917
  }
6921
6918
  return result;
6922
6919
  });
6923
- }
6920
+ };
6924
6921
  _fd_close.sig = 'ii';
6925
6922
  function _builtin_fd_close(fd) {
6926
6923
  try {
@@ -19335,7 +19332,7 @@ export function init(RuntimeName, PHPLoader) {
19335
19332
 
19336
19333
  var addOnExit = (cb) => onExits.unshift(cb);
19337
19334
 
19338
- var STACK_SIZE = 65536;
19335
+ var STACK_SIZE = 1048576;
19339
19336
 
19340
19337
  var STACK_ALIGN = 16;
19341
19338
 
@@ -31256,13 +31253,13 @@ export function init(RuntimeName, PHPLoader) {
31256
31253
  // End JS library code
31257
31254
 
31258
31255
  var ASM_CONSTS = {
31259
- 13214775: ($0) => {
31256
+ 13232622: ($0) => {
31260
31257
  if (!$0) {
31261
31258
  AL.alcErr = 0xa004;
31262
31259
  return 1;
31263
31260
  }
31264
31261
  },
31265
- 13214823: ($0) => {
31262
+ 13232670: ($0) => {
31266
31263
  if (!AL.currentCtx) {
31267
31264
  err('alGetProcAddress() called without a valid context');
31268
31265
  return 1;
@@ -31390,6 +31387,9 @@ export function init(RuntimeName, PHPLoader) {
31390
31387
  while (true) {
31391
31388
  var mask = POLLNVAL;
31392
31389
  mask = SYSCALLS.DEFAULT_POLLMASK;
31390
+ if (FS.isClosed(stream)) {
31391
+ return ERRNO_CODES.EBADF;
31392
+ }
31393
31393
  if (stream.stream_ops?.poll) {
31394
31394
  mask = stream.stream_ops.poll(stream, -1);
31395
31395
  }
@@ -34100,6 +34100,11 @@ export function init(RuntimeName, PHPLoader) {
34100
34100
  var _calloc = (a0, a1) => (_calloc = wasmExports['calloc'])(a0, a1);
34101
34101
  var _flock = (Module['_flock'] = (a0, a1) =>
34102
34102
  (_flock = Module['_flock'] = wasmExports['flock'])(a0, a1));
34103
+ var _initgroups = (Module['_initgroups'] = (a0, a1) =>
34104
+ (_initgroups = Module['_initgroups'] = wasmExports['initgroups'])(
34105
+ a0,
34106
+ a1
34107
+ ));
34103
34108
  var _wasm_read = (Module['_wasm_read'] = (a0, a1, a2) =>
34104
34109
  (_wasm_read = Module['_wasm_read'] = wasmExports['wasm_read'])(
34105
34110
  a0,
@@ -34425,6 +34430,15 @@ export function init(RuntimeName, PHPLoader) {
34425
34430
  };
34426
34431
  }
34427
34432
 
34433
+ /**
34434
+ * Expose the PHP version so the PHP class can make version-specific
34435
+ * adjustments to `php.ini`.
34436
+ */
34437
+ PHPLoader['phpVersion'] = (() => {
34438
+ const [major, minor, patch] = phpVersionString.split('.').map(Number);
34439
+ return { major, minor, patch };
34440
+ })();
34441
+
34428
34442
  return PHPLoader;
34429
34443
 
34430
34444
  // Close the opening bracket from esm-prefix.js:
package/jspi/php_8_4.js CHANGED
@@ -6,9 +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_0', 'php_8_4.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_4_10', 'php_8_4.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 36202422;
11
+ export const dependenciesTotalSize = 36372438;
12
+ const phpVersionString = '8.4.10';
12
13
  export function init(RuntimeName, PHPLoader) {
13
14
  // The rest of the code comes from the built php.js file and esm-suffix.js
14
15
  // include: shell.js
@@ -847,7 +848,7 @@ export function init(RuntimeName, PHPLoader) {
847
848
  },
848
849
  };
849
850
 
850
- var ___heap_base = 17317728;
851
+ var ___heap_base = 18314400;
851
852
 
852
853
  var alignMemory = (size, alignment) => {
853
854
  return Math.ceil(size / alignment) * alignment;
@@ -1011,7 +1012,7 @@ export function init(RuntimeName, PHPLoader) {
1011
1012
 
1012
1013
  /** @type {WebAssembly.Table} */
1013
1014
  var wasmTable = new WebAssembly.Table({
1014
- initial: 16487,
1015
+ initial: 16555,
1015
1016
  element: 'anyfunc',
1016
1017
  });
1017
1018
  var getWasmTableEntry = (funcPtr) => {
@@ -1742,13 +1743,13 @@ export function init(RuntimeName, PHPLoader) {
1742
1743
  1024
1743
1744
  );
1744
1745
 
1745
- var ___stack_high = 17317728;
1746
+ var ___stack_high = 18314400;
1746
1747
 
1747
- var ___stack_low = 17252192;
1748
+ var ___stack_low = 17265824;
1748
1749
 
1749
1750
  var ___stack_pointer = new WebAssembly.Global(
1750
1751
  { value: 'i32', mutable: true },
1751
- 17317728
1752
+ 18314400
1752
1753
  );
1753
1754
 
1754
1755
  var PATH = {
@@ -3802,10 +3803,6 @@ export function init(RuntimeName, PHPLoader) {
3802
3803
  if (FS.isMountpoint(node)) {
3803
3804
  throw new FS.ErrnoError(10);
3804
3805
  }
3805
-
3806
- if (!FS.isDir(node.mode)) {
3807
- throw new FS.ErrnoError(54);
3808
- }
3809
3806
  }
3810
3807
 
3811
3808
  var mount = {
@@ -6885,7 +6882,7 @@ export function init(RuntimeName, PHPLoader) {
6885
6882
  }
6886
6883
  }
6887
6884
 
6888
- function _fd_close(fd) {
6885
+ var _fd_close = function fd_close(fd) {
6889
6886
  return Asyncify.handleAsync(async () => {
6890
6887
  const [vfsPath, pathResolutionErrno] =
6891
6888
  locking.get_vfs_path_from_fd(fd);
@@ -6920,7 +6917,7 @@ export function init(RuntimeName, PHPLoader) {
6920
6917
  }
6921
6918
  return result;
6922
6919
  });
6923
- }
6920
+ };
6924
6921
  _fd_close.sig = 'ii';
6925
6922
  function _builtin_fd_close(fd) {
6926
6923
  try {
@@ -19335,7 +19332,7 @@ export function init(RuntimeName, PHPLoader) {
19335
19332
 
19336
19333
  var addOnExit = (cb) => onExits.unshift(cb);
19337
19334
 
19338
- var STACK_SIZE = 65536;
19335
+ var STACK_SIZE = 1048576;
19339
19336
 
19340
19337
  var STACK_ALIGN = 16;
19341
19338
 
@@ -31256,13 +31253,13 @@ export function init(RuntimeName, PHPLoader) {
31256
31253
  // End JS library code
31257
31254
 
31258
31255
  var ASM_CONSTS = {
31259
- 16319223: ($0) => {
31256
+ 16328094: ($0) => {
31260
31257
  if (!$0) {
31261
31258
  AL.alcErr = 0xa004;
31262
31259
  return 1;
31263
31260
  }
31264
31261
  },
31265
- 16319271: ($0) => {
31262
+ 16328142: ($0) => {
31266
31263
  if (!AL.currentCtx) {
31267
31264
  err('alGetProcAddress() called without a valid context');
31268
31265
  return 1;
@@ -31390,6 +31387,9 @@ export function init(RuntimeName, PHPLoader) {
31390
31387
  while (true) {
31391
31388
  var mask = POLLNVAL;
31392
31389
  mask = SYSCALLS.DEFAULT_POLLMASK;
31390
+ if (FS.isClosed(stream)) {
31391
+ return ERRNO_CODES.EBADF;
31392
+ }
31393
31393
  if (stream.stream_ops?.poll) {
31394
31394
  mask = stream.stream_ops.poll(stream, -1);
31395
31395
  }
@@ -34100,6 +34100,11 @@ export function init(RuntimeName, PHPLoader) {
34100
34100
  (___cxa_throw = wasmExports['__cxa_throw'])(a0, a1, a2);
34101
34101
  var _flock = (Module['_flock'] = (a0, a1) =>
34102
34102
  (_flock = Module['_flock'] = wasmExports['flock'])(a0, a1));
34103
+ var _initgroups = (Module['_initgroups'] = (a0, a1) =>
34104
+ (_initgroups = Module['_initgroups'] = wasmExports['initgroups'])(
34105
+ a0,
34106
+ a1
34107
+ ));
34103
34108
  var _wasm_read = (Module['_wasm_read'] = (a0, a1, a2) =>
34104
34109
  (_wasm_read = Module['_wasm_read'] = wasmExports['wasm_read'])(
34105
34110
  a0,
@@ -34425,6 +34430,15 @@ export function init(RuntimeName, PHPLoader) {
34425
34430
  };
34426
34431
  }
34427
34432
 
34433
+ /**
34434
+ * Expose the PHP version so the PHP class can make version-specific
34435
+ * adjustments to `php.ini`.
34436
+ */
34437
+ PHPLoader['phpVersion'] = (() => {
34438
+ const [major, minor, patch] = phpVersionString.split('.').map(Number);
34439
+ return { major, minor, patch };
34440
+ })();
34441
+
34428
34442
  return PHPLoader;
34429
34443
 
34430
34444
  // Close the opening bracket from esm-prefix.js:
@@ -1,2 +1,2 @@
1
- import type { MountHandler } from '@php-wasm/universal';
1
+ import { type MountHandler } from '@php-wasm/universal';
2
2
  export declare function createNodeFsMountHandler(localPath: string): MountHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "1.2.2",
3
+ "version": "2.0.0",
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": "aca5a878610532b47b07a5922fb6056993df0642",
41
+ "gitHead": "4aa6ec4f0fe23920f735c0050228a509d94ce077",
42
42
  "engines": {
43
43
  "node": ">=20.18.3",
44
44
  "npm": ">=10.1.0"
@@ -50,11 +50,11 @@
50
50
  "wasm-feature-detect": "1.8.0",
51
51
  "ws": "8.18.1",
52
52
  "yargs": "17.7.2",
53
- "@php-wasm/node-polyfills": "1.2.2",
54
- "@php-wasm/universal": "1.2.2",
55
- "@php-wasm/logger": "1.2.2",
56
- "@php-wasm/util": "1.2.2",
57
- "@wp-playground/common": "1.2.2"
53
+ "@php-wasm/node-polyfills": "2.0.0",
54
+ "@php-wasm/universal": "2.0.0",
55
+ "@php-wasm/logger": "2.0.0",
56
+ "@php-wasm/util": "2.0.0",
57
+ "@wp-playground/common": "2.0.0"
58
58
  },
59
59
  "overrides": {
60
60
  "rollup": "^4.34.6",