@php-wasm/node-8-1 3.1.3 → 3.1.5

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
@@ -15,7 +15,7 @@ const currentDirPath =
15
15
  : path.dirname(fileURLToPath(import.meta.url));
16
16
  const dependencyFilename = path.join(currentDirPath, '8_1_34', 'php_8_1.wasm');
17
17
  export { dependencyFilename };
18
- export const dependenciesTotalSize = 27245697;
18
+ export const dependenciesTotalSize = 27245645;
19
19
  const phpVersionString = '8.1.34';
20
20
  export function init(RuntimeName, PHPLoader) {
21
21
  // The rest of the code comes from the built php.js file and esm-suffix.js
@@ -6541,6 +6541,9 @@ export function init(RuntimeName, PHPLoader) {
6541
6541
 
6542
6542
  var allocateUTF8OnStack = (...args) => stringToUTF8OnStack(...args);
6543
6543
 
6544
+ var onInits = [];
6545
+ var addOnInit = (cb) => onInits.push(cb);
6546
+
6544
6547
  function _js_getpid() {
6545
6548
  return PHPLoader.processId ?? 42;
6546
6549
  }
@@ -6611,19 +6614,107 @@ export function init(RuntimeName, PHPLoader) {
6611
6614
  LOCK_UN: 8, // Unlock
6612
6615
  },
6613
6616
  errnoCodes: ERRNO_CODES,
6617
+ // Use get/set closures instead of exposing
6618
+ // typed arrays directly. After memory.grow(),
6619
+ // Emscripten's updateMemoryViews() reassigns
6620
+ // the module-scoped HEAP* variables. Closures
6621
+ // always reference the current value, so
6622
+ // accesses are never stale. The get/set
6623
+ // interface also prevents callers from
6624
+ // capturing a typed array reference that
6625
+ // could become stale.
6614
6626
  memory: {
6615
- HEAP8,
6616
- HEAPU8,
6617
- HEAP16,
6618
- HEAPU16,
6619
- HEAP32,
6620
- HEAPU32,
6621
- HEAPF32,
6622
- HEAP64,
6623
- HEAPU64,
6624
- HEAPF64,
6627
+ HEAP8: {
6628
+ get(offset) {
6629
+ return HEAP8[offset];
6630
+ },
6631
+ set(offset, value) {
6632
+ HEAP8[offset] = value;
6633
+ },
6634
+ },
6635
+ HEAPU8: {
6636
+ get(offset) {
6637
+ return HEAPU8[offset];
6638
+ },
6639
+ set(offset, value) {
6640
+ HEAPU8[offset] = value;
6641
+ },
6642
+ },
6643
+ HEAP16: {
6644
+ get(offset) {
6645
+ return HEAP16[offset];
6646
+ },
6647
+ set(offset, value) {
6648
+ HEAP16[offset] = value;
6649
+ },
6650
+ },
6651
+ HEAPU16: {
6652
+ get(offset) {
6653
+ return HEAPU16[offset];
6654
+ },
6655
+ set(offset, value) {
6656
+ HEAPU16[offset] = value;
6657
+ },
6658
+ },
6659
+ HEAP32: {
6660
+ get(offset) {
6661
+ return HEAP32[offset];
6662
+ },
6663
+ set(offset, value) {
6664
+ HEAP32[offset] = value;
6665
+ },
6666
+ },
6667
+ HEAPU32: {
6668
+ get(offset) {
6669
+ return HEAPU32[offset];
6670
+ },
6671
+ set(offset, value) {
6672
+ HEAPU32[offset] = value;
6673
+ },
6674
+ },
6675
+ HEAPF32: {
6676
+ get(offset) {
6677
+ return HEAPF32[offset];
6678
+ },
6679
+ set(offset, value) {
6680
+ HEAPF32[offset] = value;
6681
+ },
6682
+ },
6683
+ HEAP64: {
6684
+ get(offset) {
6685
+ return HEAP64[offset];
6686
+ },
6687
+ set(offset, value) {
6688
+ HEAP64[offset] = value;
6689
+ },
6690
+ },
6691
+ HEAPU64: {
6692
+ get(offset) {
6693
+ return HEAPU64[offset];
6694
+ },
6695
+ set(offset, value) {
6696
+ HEAPU64[offset] = value;
6697
+ },
6698
+ },
6699
+ HEAPF64: {
6700
+ get(offset) {
6701
+ return HEAPF64[offset];
6702
+ },
6703
+ set(offset, value) {
6704
+ HEAPF64[offset] = value;
6705
+ },
6706
+ },
6625
6707
  },
6626
- wasmImports,
6708
+ wasmImports: Object.assign(
6709
+ {},
6710
+ wasmImports,
6711
+ typeof _builtin_fd_close === 'function'
6712
+ ? { builtin_fd_close: _builtin_fd_close }
6713
+ : {},
6714
+ typeof _builtin_fcntl64 === 'function'
6715
+ ? { builtin_fcntl64: _builtin_fcntl64 }
6716
+ : {}
6717
+ ),
6627
6718
  wasmExports,
6628
6719
  syscalls: SYSCALLS,
6629
6720
  FS,
@@ -17046,9 +17137,9 @@ export function init(RuntimeName, PHPLoader) {
17046
17137
  if (!cp.stdin.closed) {
17047
17138
  cp.stdin.end();
17048
17139
  }
17049
- _free(buffer);
17050
- _free(iov);
17051
- _free(pnum);
17140
+ _wasm_free(buffer);
17141
+ _wasm_free(iov);
17142
+ _wasm_free(pnum);
17052
17143
  }
17053
17144
 
17054
17145
  // pump() can never alter the result of this function.
@@ -17775,7 +17866,17 @@ export function init(RuntimeName, PHPLoader) {
17775
17866
  // A true async operation was begun; start a sleep.
17776
17867
  Asyncify.state = Asyncify.State.Unwinding;
17777
17868
  // TODO: reuse, don't alloc/free every sleep
17778
- Asyncify.currData = Asyncify.allocateData();
17869
+ if (!Asyncify._cachedData) {
17870
+ Asyncify._cachedData = Asyncify.allocateData();
17871
+ } else {
17872
+ Asyncify.setDataHeader(
17873
+ Asyncify._cachedData,
17874
+ Asyncify._cachedData + 12,
17875
+ Asyncify.StackSize
17876
+ );
17877
+ Asyncify.setDataRewindFunc(Asyncify._cachedData);
17878
+ }
17879
+ Asyncify.currData = Asyncify._cachedData;
17779
17880
  if (typeof MainLoop != 'undefined' && MainLoop.func) {
17780
17881
  MainLoop.pause();
17781
17882
  }
@@ -17787,7 +17888,6 @@ export function init(RuntimeName, PHPLoader) {
17787
17888
  // Stop a resume.
17788
17889
  Asyncify.state = Asyncify.State.Normal;
17789
17890
  runAndAbortIfError(_asyncify_stop_rewind);
17790
- _free(Asyncify.currData);
17791
17891
  Asyncify.currData = null;
17792
17892
  // Call all sleep callbacks now that the sleep-resume is all done.
17793
17893
  Asyncify.sleepCallbacks.forEach(callUserCallback);
@@ -18224,10 +18324,6 @@ export function init(RuntimeName, PHPLoader) {
18224
18324
  };
18225
18325
  __emscripten_fs_load_embedded_files.sig = 'vp';
18226
18326
 
18227
- var onInits = [];
18228
-
18229
- var addOnInit = (cb) => onInits.push(cb);
18230
-
18231
18327
  var onMains = [];
18232
18328
 
18233
18329
  var addOnPreMain = (cb) => onMains.push(cb);
@@ -30743,26 +30839,6 @@ export function init(RuntimeName, PHPLoader) {
30743
30839
  });
30744
30840
  };
30745
30841
 
30746
- function _recv(sockfd, buffer, size, flags) {
30747
- return _wasm_recv(sockfd, buffer, size, flags);
30748
- }
30749
-
30750
- function _setsockopt(
30751
- socketd,
30752
- level,
30753
- optionName,
30754
- optionValuePtr,
30755
- optionLen
30756
- ) {
30757
- return _wasm_setsockopt(
30758
- socketd,
30759
- level,
30760
- optionName,
30761
- optionValuePtr,
30762
- optionLen
30763
- );
30764
- }
30765
-
30766
30842
  var _getdtablesize = () => abort('missing function: ${name}');
30767
30843
 
30768
30844
  function ___emscripten_lookup_name(namePtr) {
@@ -31271,8 +31347,6 @@ export function init(RuntimeName, PHPLoader) {
31271
31347
  Module['___cxa_rethrow_primary_exception'] =
31272
31348
  ___cxa_rethrow_primary_exception;
31273
31349
  Module['___syscall_shutdown'] = ___syscall_shutdown;
31274
- Module['_recv'] = _recv;
31275
- Module['_setsockopt'] = _setsockopt;
31276
31350
  // End JS library exports
31277
31351
 
31278
31352
  // end include: postlibrary.js
@@ -31659,7 +31733,7 @@ export function init(RuntimeName, PHPLoader) {
31659
31733
  wasmMemory;
31660
31734
 
31661
31735
  function assignWasmExports(wasmExports) {
31662
- _free = PHPLoader['free'] = wasmExports['free'];
31736
+ _free = wasmExports['free'];
31663
31737
  _memcmp = wasmExports['memcmp'];
31664
31738
  _malloc =
31665
31739
  PHPLoader['malloc'] =
@@ -31727,7 +31801,10 @@ export function init(RuntimeName, PHPLoader) {
31727
31801
  wasmExports['wasm_sapi_handle_request'];
31728
31802
  _php_wasm_init = Module['_php_wasm_init'] =
31729
31803
  wasmExports['php_wasm_init'];
31730
- _wasm_free = Module['_wasm_free'] = wasmExports['wasm_free'];
31804
+ _wasm_free =
31805
+ PHPLoader['free'] =
31806
+ Module['_wasm_free'] =
31807
+ wasmExports['wasm_free'];
31731
31808
  _wasm_get_end_offset = Module['_wasm_get_end_offset'] =
31732
31809
  wasmExports['wasm_get_end_offset'];
31733
31810
  ___wrap_getpid = Module['___wrap_getpid'] =
@@ -34373,12 +34450,8 @@ export function init(RuntimeName, PHPLoader) {
34373
34450
  wasm_poll_socket,
34374
34451
  /** @export */
34375
34452
  wasm_recv: _wasm_recv,
34376
- /** */
34377
- recv: _recv,
34378
34453
  /** @export */
34379
34454
  wasm_setsockopt: _wasm_setsockopt,
34380
- /** */
34381
- setsockopt: _setsockopt,
34382
34455
  /** @export */
34383
34456
  wasm_shutdown: _wasm_shutdown,
34384
34457
  /** @export */
package/index.cjs CHANGED
@@ -53,21 +53,21 @@ async function getPHPLoaderModule() {
53
53
  }
54
54
  async function getIntlExtensionPath() {
55
55
  if (await (0, import_wasm_feature_detect.jspi)()) {
56
- return (0, import_node_path.join)(packageDir, "jspi/extensions/intl/8_1/intl.so");
56
+ return (0, import_node_path.join)(packageDir, "jspi/extensions/intl/intl.so");
57
57
  } else {
58
- return (0, import_node_path.join)(packageDir, "asyncify/extensions/intl/8_1/intl.so");
58
+ return (0, import_node_path.join)(packageDir, "asyncify/extensions/intl/intl.so");
59
59
  }
60
60
  }
61
61
  async function getXdebugExtensionPath() {
62
62
  if (await (0, import_wasm_feature_detect.jspi)()) {
63
- return (0, import_node_path.join)(packageDir, "jspi/extensions/xdebug/8_1/xdebug.so");
63
+ return (0, import_node_path.join)(packageDir, "jspi/extensions/xdebug/xdebug.so");
64
64
  } else {
65
- return (0, import_node_path.join)(packageDir, "asyncify/extensions/xdebug/8_1/xdebug.so");
65
+ return (0, import_node_path.join)(packageDir, "asyncify/extensions/xdebug/xdebug.so");
66
66
  }
67
67
  }
68
68
  async function getRedisExtensionPath() {
69
69
  if (await (0, import_wasm_feature_detect.jspi)()) {
70
- return (0, import_node_path.join)(packageDir, "jspi/extensions/redis/8_1/redis.so");
70
+ return (0, import_node_path.join)(packageDir, "jspi/extensions/redis/redis.so");
71
71
  }
72
72
  throw new Error(
73
73
  "The Redis extension requires JSPI (JavaScript Promise Integration) support. Your current environment is using asyncify, which cannot properly handle exceptions during Redis network operations. Please use Node.js 23+ or a browser with JSPI support to use the Redis extension."
@@ -75,7 +75,7 @@ async function getRedisExtensionPath() {
75
75
  }
76
76
  async function getMemcachedExtensionPath() {
77
77
  if (await (0, import_wasm_feature_detect.jspi)()) {
78
- return (0, import_node_path.join)(packageDir, "jspi/extensions/memcached/8_1/memcached.so");
78
+ return (0, import_node_path.join)(packageDir, "jspi/extensions/memcached/memcached.so");
79
79
  }
80
80
  throw new Error(
81
81
  "The Memcached extension requires JSPI (JavaScript Promise Integration) support. Your current environment is using asyncify, which cannot properly handle exceptions during Memcached network operations. Please use Node.js 23+ or a browser with JSPI support to use the Memcached extension."
package/index.js CHANGED
@@ -14,21 +14,21 @@ async function getPHPLoaderModule() {
14
14
  }
15
15
  async function getIntlExtensionPath() {
16
16
  if (await jspi()) {
17
- return join(packageDir, "jspi/extensions/intl/8_1/intl.so");
17
+ return join(packageDir, "jspi/extensions/intl/intl.so");
18
18
  } else {
19
- return join(packageDir, "asyncify/extensions/intl/8_1/intl.so");
19
+ return join(packageDir, "asyncify/extensions/intl/intl.so");
20
20
  }
21
21
  }
22
22
  async function getXdebugExtensionPath() {
23
23
  if (await jspi()) {
24
- return join(packageDir, "jspi/extensions/xdebug/8_1/xdebug.so");
24
+ return join(packageDir, "jspi/extensions/xdebug/xdebug.so");
25
25
  } else {
26
- return join(packageDir, "asyncify/extensions/xdebug/8_1/xdebug.so");
26
+ return join(packageDir, "asyncify/extensions/xdebug/xdebug.so");
27
27
  }
28
28
  }
29
29
  async function getRedisExtensionPath() {
30
30
  if (await jspi()) {
31
- return join(packageDir, "jspi/extensions/redis/8_1/redis.so");
31
+ return join(packageDir, "jspi/extensions/redis/redis.so");
32
32
  }
33
33
  throw new Error(
34
34
  "The Redis extension requires JSPI (JavaScript Promise Integration) support. Your current environment is using asyncify, which cannot properly handle exceptions during Redis network operations. Please use Node.js 23+ or a browser with JSPI support to use the Redis extension."
@@ -36,7 +36,7 @@ async function getRedisExtensionPath() {
36
36
  }
37
37
  async function getMemcachedExtensionPath() {
38
38
  if (await jspi()) {
39
- return join(packageDir, "jspi/extensions/memcached/8_1/memcached.so");
39
+ return join(packageDir, "jspi/extensions/memcached/memcached.so");
40
40
  }
41
41
  throw new Error(
42
42
  "The Memcached extension requires JSPI (JavaScript Promise Integration) support. Your current environment is using asyncify, which cannot properly handle exceptions during Memcached network operations. Please use Node.js 23+ or a browser with JSPI support to use the Memcached extension."
Binary file