@php-wasm/node-7-4 3.1.3 → 3.1.4

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, '7_4_33', 'php_7_4.wasm');
17
17
  export { dependencyFilename };
18
- export const dependenciesTotalSize = 22948243;
18
+ export const dependenciesTotalSize = 22948201;
19
19
  const phpVersionString = '7.4.33';
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,
@@ -17044,9 +17135,9 @@ export function init(RuntimeName, PHPLoader) {
17044
17135
  if (!cp.stdin.closed) {
17045
17136
  cp.stdin.end();
17046
17137
  }
17047
- _free(buffer);
17048
- _free(iov);
17049
- _free(pnum);
17138
+ _wasm_free(buffer);
17139
+ _wasm_free(iov);
17140
+ _wasm_free(pnum);
17050
17141
  }
17051
17142
 
17052
17143
  // pump() can never alter the result of this function.
@@ -17769,7 +17860,17 @@ export function init(RuntimeName, PHPLoader) {
17769
17860
  // A true async operation was begun; start a sleep.
17770
17861
  Asyncify.state = Asyncify.State.Unwinding;
17771
17862
  // TODO: reuse, don't alloc/free every sleep
17772
- Asyncify.currData = Asyncify.allocateData();
17863
+ if (!Asyncify._cachedData) {
17864
+ Asyncify._cachedData = Asyncify.allocateData();
17865
+ } else {
17866
+ Asyncify.setDataHeader(
17867
+ Asyncify._cachedData,
17868
+ Asyncify._cachedData + 12,
17869
+ Asyncify.StackSize
17870
+ );
17871
+ Asyncify.setDataRewindFunc(Asyncify._cachedData);
17872
+ }
17873
+ Asyncify.currData = Asyncify._cachedData;
17773
17874
  if (typeof MainLoop != 'undefined' && MainLoop.func) {
17774
17875
  MainLoop.pause();
17775
17876
  }
@@ -17781,7 +17882,6 @@ export function init(RuntimeName, PHPLoader) {
17781
17882
  // Stop a resume.
17782
17883
  Asyncify.state = Asyncify.State.Normal;
17783
17884
  runAndAbortIfError(_asyncify_stop_rewind);
17784
- _free(Asyncify.currData);
17785
17885
  Asyncify.currData = null;
17786
17886
  // Call all sleep callbacks now that the sleep-resume is all done.
17787
17887
  Asyncify.sleepCallbacks.forEach(callUserCallback);
@@ -18218,10 +18318,6 @@ export function init(RuntimeName, PHPLoader) {
18218
18318
  };
18219
18319
  __emscripten_fs_load_embedded_files.sig = 'vp';
18220
18320
 
18221
- var onInits = [];
18222
-
18223
- var addOnInit = (cb) => onInits.push(cb);
18224
-
18225
18321
  var onMains = [];
18226
18322
 
18227
18323
  var addOnPreMain = (cb) => onMains.push(cb);
@@ -30737,26 +30833,6 @@ export function init(RuntimeName, PHPLoader) {
30737
30833
  });
30738
30834
  };
30739
30835
 
30740
- function _recv(sockfd, buffer, size, flags) {
30741
- return _wasm_recv(sockfd, buffer, size, flags);
30742
- }
30743
-
30744
- function _setsockopt(
30745
- socketd,
30746
- level,
30747
- optionName,
30748
- optionValuePtr,
30749
- optionLen
30750
- ) {
30751
- return _wasm_setsockopt(
30752
- socketd,
30753
- level,
30754
- optionName,
30755
- optionValuePtr,
30756
- optionLen
30757
- );
30758
- }
30759
-
30760
30836
  var _getcontext = () => abort('missing function: ${name}');
30761
30837
 
30762
30838
  var _makecontext = () => abort('missing function: ${name}');
@@ -31271,20 +31347,18 @@ 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
31279
31353
 
31280
31354
  var ASM_CONSTS = {
31281
- 11305393: ($0) => {
31355
+ 11305345: ($0) => {
31282
31356
  if (!$0) {
31283
31357
  AL.alcErr = 0xa004;
31284
31358
  return 1;
31285
31359
  }
31286
31360
  },
31287
- 11305441: ($0) => {
31361
+ 11305393: ($0) => {
31288
31362
  if (!AL.currentCtx) {
31289
31363
  err('alGetProcAddress() called without a valid context');
31290
31364
  return 1;
@@ -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'] =
@@ -34359,12 +34436,8 @@ export function init(RuntimeName, PHPLoader) {
34359
34436
  wasm_poll_socket,
34360
34437
  /** @export */
34361
34438
  wasm_recv: _wasm_recv,
34362
- /** */
34363
- recv: _recv,
34364
34439
  /** @export */
34365
34440
  wasm_setsockopt: _wasm_setsockopt,
34366
- /** */
34367
- setsockopt: _setsockopt,
34368
34441
  /** @export */
34369
34442
  wasm_shutdown: _wasm_shutdown,
34370
34443
  /** @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/7_4/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/7_4/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/7_4/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/7_4/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/7_4/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/7_4/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/7_4/intl.so");
17
+ return join(packageDir, "jspi/extensions/intl/intl.so");
18
18
  } else {
19
- return join(packageDir, "asyncify/extensions/intl/7_4/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/7_4/xdebug.so");
24
+ return join(packageDir, "jspi/extensions/xdebug/xdebug.so");
25
25
  } else {
26
- return join(packageDir, "asyncify/extensions/xdebug/7_4/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/7_4/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/7_4/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