@php-wasm/node-8-0 3.0.44 → 3.0.45
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/asyncify/8_0_30/php_8_0.wasm +0 -0
- package/asyncify/php_8_0.js +32022 -35259
- package/index.cjs +20 -0
- package/index.js +18 -0
- package/jspi/8_0_30/php_8_0.wasm +0 -0
- package/jspi/extensions/memcached/8_0/memcached.la +35 -0
- package/jspi/extensions/memcached/8_0/memcached.so +0 -0
- package/jspi/extensions/redis/8_0/redis.la +35 -0
- package/jspi/extensions/redis/8_0/redis.so +0 -0
- package/jspi/php_8_0.js +330 -219
- package/package.json +3 -3
package/jspi/php_8_0.js
CHANGED
|
@@ -15,7 +15,7 @@ const currentDirPath =
|
|
|
15
15
|
: path.dirname(fileURLToPath(import.meta.url));
|
|
16
16
|
const dependencyFilename = path.join(currentDirPath, '8_0_30', 'php_8_0.wasm');
|
|
17
17
|
export { dependencyFilename };
|
|
18
|
-
export const dependenciesTotalSize =
|
|
18
|
+
export const dependenciesTotalSize = 22718317;
|
|
19
19
|
const phpVersionString = '8.0.30';
|
|
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
|
|
@@ -6380,185 +6380,17 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
6380
6380
|
}
|
|
6381
6381
|
___syscall_chmod.sig = 'ipi';
|
|
6382
6382
|
|
|
6383
|
-
|
|
6384
|
-
try {
|
|
6385
|
-
var sock = getSocketFromFD(fd);
|
|
6386
|
-
var info = getSocketAddress(addr, addrlen);
|
|
6387
|
-
sock.sock_ops.connect(sock, info.addr, info.port);
|
|
6388
|
-
return 0;
|
|
6389
|
-
} catch (e) {
|
|
6390
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6391
|
-
return -e.errno;
|
|
6392
|
-
}
|
|
6393
|
-
}
|
|
6394
|
-
___syscall_connect.sig = 'iippiii';
|
|
6395
|
-
|
|
6396
|
-
function ___syscall_dup(fd) {
|
|
6397
|
-
try {
|
|
6398
|
-
var old = SYSCALLS.getStreamFromFD(fd);
|
|
6399
|
-
return FS.dupStream(old).fd;
|
|
6400
|
-
} catch (e) {
|
|
6401
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6402
|
-
return -e.errno;
|
|
6403
|
-
}
|
|
6404
|
-
}
|
|
6405
|
-
___syscall_dup.sig = 'ii';
|
|
6406
|
-
|
|
6407
|
-
function ___syscall_dup3(fd, newfd, flags) {
|
|
6408
|
-
try {
|
|
6409
|
-
var old = SYSCALLS.getStreamFromFD(fd);
|
|
6410
|
-
if (old.fd === newfd) return -28;
|
|
6411
|
-
// Check newfd is within range of valid open file descriptors.
|
|
6412
|
-
if (newfd < 0 || newfd >= FS.MAX_OPEN_FDS) return -8;
|
|
6413
|
-
var existing = FS.getStream(newfd);
|
|
6414
|
-
if (existing) FS.close(existing);
|
|
6415
|
-
return FS.dupStream(old, newfd).fd;
|
|
6416
|
-
} catch (e) {
|
|
6417
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6418
|
-
return -e.errno;
|
|
6419
|
-
}
|
|
6420
|
-
}
|
|
6421
|
-
___syscall_dup3.sig = 'iiii';
|
|
6422
|
-
|
|
6423
|
-
function ___syscall_faccessat(dirfd, path, amode, flags) {
|
|
6424
|
-
try {
|
|
6425
|
-
path = SYSCALLS.getStr(path);
|
|
6426
|
-
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6427
|
-
if (amode & ~7) {
|
|
6428
|
-
// need a valid mode
|
|
6429
|
-
return -28;
|
|
6430
|
-
}
|
|
6431
|
-
var lookup = FS.lookupPath(path, { follow: true });
|
|
6432
|
-
var node = lookup.node;
|
|
6433
|
-
if (!node) {
|
|
6434
|
-
return -44;
|
|
6435
|
-
}
|
|
6436
|
-
var perms = '';
|
|
6437
|
-
if (amode & 4) perms += 'r';
|
|
6438
|
-
if (amode & 2) perms += 'w';
|
|
6439
|
-
if (amode & 1) perms += 'x';
|
|
6440
|
-
if (
|
|
6441
|
-
perms /* otherwise, they've just passed F_OK */ &&
|
|
6442
|
-
FS.nodePermissions(node, perms)
|
|
6443
|
-
) {
|
|
6444
|
-
return -2;
|
|
6445
|
-
}
|
|
6446
|
-
return 0;
|
|
6447
|
-
} catch (e) {
|
|
6448
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6449
|
-
return -e.errno;
|
|
6450
|
-
}
|
|
6451
|
-
}
|
|
6452
|
-
___syscall_faccessat.sig = 'iipii';
|
|
6453
|
-
|
|
6454
|
-
var ___syscall_fadvise64 = (fd, offset, len, advice) => 0;
|
|
6455
|
-
___syscall_fadvise64.sig = 'iijji';
|
|
6456
|
-
|
|
6457
|
-
var INT53_MAX = 9007199254740992;
|
|
6458
|
-
|
|
6459
|
-
var INT53_MIN = -9007199254740992;
|
|
6460
|
-
var bigintToI53Checked = (num) =>
|
|
6461
|
-
num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
|
|
6462
|
-
function ___syscall_fallocate(fd, mode, offset, len) {
|
|
6463
|
-
offset = bigintToI53Checked(offset);
|
|
6464
|
-
len = bigintToI53Checked(len);
|
|
6465
|
-
|
|
6466
|
-
try {
|
|
6467
|
-
if (isNaN(offset) || isNaN(len)) return -61;
|
|
6468
|
-
if (mode != 0) {
|
|
6469
|
-
return -138;
|
|
6470
|
-
}
|
|
6471
|
-
if (offset < 0 || len < 0) {
|
|
6472
|
-
return -28;
|
|
6473
|
-
}
|
|
6474
|
-
// We only support mode == 0, which means we can implement fallocate
|
|
6475
|
-
// in terms of ftruncate.
|
|
6476
|
-
var oldSize = FS.fstat(fd).size;
|
|
6477
|
-
var newSize = offset + len;
|
|
6478
|
-
if (newSize > oldSize) {
|
|
6479
|
-
FS.ftruncate(fd, newSize);
|
|
6480
|
-
}
|
|
6481
|
-
return 0;
|
|
6482
|
-
} catch (e) {
|
|
6483
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6484
|
-
return -e.errno;
|
|
6485
|
-
}
|
|
6486
|
-
}
|
|
6487
|
-
___syscall_fallocate.sig = 'iiijj';
|
|
6488
|
-
|
|
6489
|
-
function ___syscall_fchdir(fd) {
|
|
6490
|
-
try {
|
|
6491
|
-
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
6492
|
-
FS.chdir(stream.path);
|
|
6493
|
-
return 0;
|
|
6494
|
-
} catch (e) {
|
|
6495
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6496
|
-
return -e.errno;
|
|
6497
|
-
}
|
|
6498
|
-
}
|
|
6499
|
-
___syscall_fchdir.sig = 'ii';
|
|
6500
|
-
|
|
6501
|
-
function ___syscall_fchmod(fd, mode) {
|
|
6502
|
-
try {
|
|
6503
|
-
FS.fchmod(fd, mode);
|
|
6504
|
-
return 0;
|
|
6505
|
-
} catch (e) {
|
|
6506
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6507
|
-
return -e.errno;
|
|
6508
|
-
}
|
|
6509
|
-
}
|
|
6510
|
-
___syscall_fchmod.sig = 'iii';
|
|
6511
|
-
|
|
6512
|
-
function ___syscall_fchmodat2(dirfd, path, mode, flags) {
|
|
6513
|
-
try {
|
|
6514
|
-
var nofollow = flags & 256;
|
|
6515
|
-
path = SYSCALLS.getStr(path);
|
|
6516
|
-
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6517
|
-
FS.chmod(path, mode, nofollow);
|
|
6518
|
-
return 0;
|
|
6519
|
-
} catch (e) {
|
|
6520
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6521
|
-
return -e.errno;
|
|
6522
|
-
}
|
|
6523
|
-
}
|
|
6524
|
-
___syscall_fchmodat2.sig = 'iipii';
|
|
6383
|
+
var allocateUTF8OnStack = (...args) => stringToUTF8OnStack(...args);
|
|
6525
6384
|
|
|
6526
|
-
function
|
|
6527
|
-
|
|
6528
|
-
FS.fchown(fd, owner, group);
|
|
6529
|
-
return 0;
|
|
6530
|
-
} catch (e) {
|
|
6531
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6532
|
-
return -e.errno;
|
|
6533
|
-
}
|
|
6385
|
+
function _js_getpid() {
|
|
6386
|
+
return PHPLoader.processId ?? 42;
|
|
6534
6387
|
}
|
|
6535
|
-
___syscall_fchown32.sig = 'iiii';
|
|
6536
6388
|
|
|
6537
|
-
function
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
var nofollow = flags & 256;
|
|
6541
|
-
flags = flags & ~256;
|
|
6542
|
-
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6543
|
-
(nofollow ? FS.lchown : FS.chown)(path, owner, group);
|
|
6544
|
-
return 0;
|
|
6545
|
-
} catch (e) {
|
|
6546
|
-
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6547
|
-
return -e.errno;
|
|
6389
|
+
function _js_wasm_trace(format, ...args) {
|
|
6390
|
+
if (PHPLoader.trace instanceof Function) {
|
|
6391
|
+
PHPLoader.trace(_js_getpid(), format, ...args);
|
|
6548
6392
|
}
|
|
6549
6393
|
}
|
|
6550
|
-
___syscall_fchownat.sig = 'iipiii';
|
|
6551
|
-
|
|
6552
|
-
var syscallGetVarargI = () => {
|
|
6553
|
-
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
6554
|
-
var ret = HEAP32[+SYSCALLS.varargs >> 2];
|
|
6555
|
-
SYSCALLS.varargs += 4;
|
|
6556
|
-
return ret;
|
|
6557
|
-
};
|
|
6558
|
-
var syscallGetVarargP = syscallGetVarargI;
|
|
6559
|
-
|
|
6560
|
-
var allocateUTF8OnStack = (...args) => stringToUTF8OnStack(...args);
|
|
6561
|
-
|
|
6562
6394
|
var PHPWASM = {
|
|
6563
6395
|
O_APPEND: 1024,
|
|
6564
6396
|
O_NONBLOCK: 2048,
|
|
@@ -6896,15 +6728,284 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
6896
6728
|
},
|
|
6897
6729
|
};
|
|
6898
6730
|
|
|
6899
|
-
function
|
|
6900
|
-
return
|
|
6731
|
+
var _wasm_connect = function (sockfd, addr, addrlen) {
|
|
6732
|
+
return Asyncify.handleSleep((wakeUp) => {
|
|
6733
|
+
// Get the socket
|
|
6734
|
+
let sock;
|
|
6735
|
+
try {
|
|
6736
|
+
sock = getSocketFromFD(sockfd);
|
|
6737
|
+
} catch (e) {
|
|
6738
|
+
wakeUp(-ERRNO_CODES.EBADF); // EBADF
|
|
6739
|
+
return;
|
|
6740
|
+
}
|
|
6741
|
+
|
|
6742
|
+
if (!sock) {
|
|
6743
|
+
wakeUp(-ERRNO_CODES.EBADF); // EBADF
|
|
6744
|
+
return;
|
|
6745
|
+
}
|
|
6746
|
+
|
|
6747
|
+
// Parse the address
|
|
6748
|
+
let info;
|
|
6749
|
+
try {
|
|
6750
|
+
info = getSocketAddress(addr, addrlen);
|
|
6751
|
+
} catch (e) {
|
|
6752
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) {
|
|
6753
|
+
wakeUp(-ERRNO_CODES.EFAULT); // EFAULT
|
|
6754
|
+
return;
|
|
6755
|
+
}
|
|
6756
|
+
wakeUp(-e.errno);
|
|
6757
|
+
return;
|
|
6758
|
+
}
|
|
6759
|
+
|
|
6760
|
+
// Perform the connect (this creates the WebSocket but doesn't wait)
|
|
6761
|
+
try {
|
|
6762
|
+
sock.sock_ops.connect(sock, info.addr, info.port);
|
|
6763
|
+
} catch (e) {
|
|
6764
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) {
|
|
6765
|
+
wakeUp(-ERRNO_CODES.ECONNREFUSED);
|
|
6766
|
+
return;
|
|
6767
|
+
}
|
|
6768
|
+
wakeUp(-e.errno);
|
|
6769
|
+
return;
|
|
6770
|
+
}
|
|
6771
|
+
|
|
6772
|
+
// Get all websockets for this socket
|
|
6773
|
+
const webSockets = PHPWASM.getAllWebSockets(sock);
|
|
6774
|
+
if (!webSockets.length) {
|
|
6775
|
+
// No WebSocket yet, this shouldn't happen after connect
|
|
6776
|
+
wakeUp(-ERRNO_CODES.ECONNREFUSED);
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
|
|
6780
|
+
const ws = webSockets[0];
|
|
6781
|
+
|
|
6782
|
+
// If already connected, return success
|
|
6783
|
+
if (ws.readyState === ws.OPEN) {
|
|
6784
|
+
wakeUp(0);
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
|
|
6788
|
+
// If already closed or closing, return error
|
|
6789
|
+
if (ws.readyState === ws.CLOSING || ws.readyState === ws.CLOSED) {
|
|
6790
|
+
wakeUp(-ERRNO_CODES.ECONNREFUSED);
|
|
6791
|
+
return;
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
// Wait for the connection to be established
|
|
6795
|
+
const timeout = 30000; // 30 second timeout
|
|
6796
|
+
let resolved = false;
|
|
6797
|
+
|
|
6798
|
+
const timeoutId = setTimeout(() => {
|
|
6799
|
+
if (!resolved) {
|
|
6800
|
+
resolved = true;
|
|
6801
|
+
wakeUp(-ERRNO_CODES.ETIMEDOUT);
|
|
6802
|
+
}
|
|
6803
|
+
}, timeout);
|
|
6804
|
+
|
|
6805
|
+
const handleOpen = () => {
|
|
6806
|
+
if (!resolved) {
|
|
6807
|
+
resolved = true;
|
|
6808
|
+
clearTimeout(timeoutId);
|
|
6809
|
+
ws.removeEventListener('error', handleError);
|
|
6810
|
+
ws.removeEventListener('close', handleClose);
|
|
6811
|
+
wakeUp(0);
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
|
|
6815
|
+
const handleError = () => {
|
|
6816
|
+
if (!resolved) {
|
|
6817
|
+
resolved = true;
|
|
6818
|
+
clearTimeout(timeoutId);
|
|
6819
|
+
ws.removeEventListener('open', handleOpen);
|
|
6820
|
+
ws.removeEventListener('close', handleClose);
|
|
6821
|
+
wakeUp(-ERRNO_CODES.ECONNREFUSED);
|
|
6822
|
+
}
|
|
6823
|
+
};
|
|
6824
|
+
|
|
6825
|
+
const handleClose = () => {
|
|
6826
|
+
if (!resolved) {
|
|
6827
|
+
resolved = true;
|
|
6828
|
+
clearTimeout(timeoutId);
|
|
6829
|
+
ws.removeEventListener('open', handleOpen);
|
|
6830
|
+
ws.removeEventListener('error', handleError);
|
|
6831
|
+
wakeUp(-ERRNO_CODES.ECONNREFUSED);
|
|
6832
|
+
}
|
|
6833
|
+
};
|
|
6834
|
+
|
|
6835
|
+
ws.addEventListener('open', handleOpen);
|
|
6836
|
+
ws.addEventListener('error', handleError);
|
|
6837
|
+
ws.addEventListener('close', handleClose);
|
|
6838
|
+
});
|
|
6839
|
+
};
|
|
6840
|
+
|
|
6841
|
+
function ___syscall_connect(sockfd, addr, addrlen, d1, d2, d3) {
|
|
6842
|
+
return _wasm_connect(sockfd, addr, addrlen);
|
|
6901
6843
|
}
|
|
6844
|
+
___syscall_connect.sig = 'iippiii';
|
|
6902
6845
|
|
|
6903
|
-
function
|
|
6904
|
-
|
|
6905
|
-
|
|
6846
|
+
function ___syscall_dup(fd) {
|
|
6847
|
+
try {
|
|
6848
|
+
var old = SYSCALLS.getStreamFromFD(fd);
|
|
6849
|
+
return FS.dupStream(old).fd;
|
|
6850
|
+
} catch (e) {
|
|
6851
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6852
|
+
return -e.errno;
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
___syscall_dup.sig = 'ii';
|
|
6856
|
+
|
|
6857
|
+
function ___syscall_dup3(fd, newfd, flags) {
|
|
6858
|
+
try {
|
|
6859
|
+
var old = SYSCALLS.getStreamFromFD(fd);
|
|
6860
|
+
if (old.fd === newfd) return -28;
|
|
6861
|
+
// Check newfd is within range of valid open file descriptors.
|
|
6862
|
+
if (newfd < 0 || newfd >= FS.MAX_OPEN_FDS) return -8;
|
|
6863
|
+
var existing = FS.getStream(newfd);
|
|
6864
|
+
if (existing) FS.close(existing);
|
|
6865
|
+
return FS.dupStream(old, newfd).fd;
|
|
6866
|
+
} catch (e) {
|
|
6867
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6868
|
+
return -e.errno;
|
|
6869
|
+
}
|
|
6870
|
+
}
|
|
6871
|
+
___syscall_dup3.sig = 'iiii';
|
|
6872
|
+
|
|
6873
|
+
function ___syscall_faccessat(dirfd, path, amode, flags) {
|
|
6874
|
+
try {
|
|
6875
|
+
path = SYSCALLS.getStr(path);
|
|
6876
|
+
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6877
|
+
if (amode & ~7) {
|
|
6878
|
+
// need a valid mode
|
|
6879
|
+
return -28;
|
|
6880
|
+
}
|
|
6881
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
6882
|
+
var node = lookup.node;
|
|
6883
|
+
if (!node) {
|
|
6884
|
+
return -44;
|
|
6885
|
+
}
|
|
6886
|
+
var perms = '';
|
|
6887
|
+
if (amode & 4) perms += 'r';
|
|
6888
|
+
if (amode & 2) perms += 'w';
|
|
6889
|
+
if (amode & 1) perms += 'x';
|
|
6890
|
+
if (
|
|
6891
|
+
perms /* otherwise, they've just passed F_OK */ &&
|
|
6892
|
+
FS.nodePermissions(node, perms)
|
|
6893
|
+
) {
|
|
6894
|
+
return -2;
|
|
6895
|
+
}
|
|
6896
|
+
return 0;
|
|
6897
|
+
} catch (e) {
|
|
6898
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6899
|
+
return -e.errno;
|
|
6906
6900
|
}
|
|
6907
6901
|
}
|
|
6902
|
+
___syscall_faccessat.sig = 'iipii';
|
|
6903
|
+
|
|
6904
|
+
var ___syscall_fadvise64 = (fd, offset, len, advice) => 0;
|
|
6905
|
+
___syscall_fadvise64.sig = 'iijji';
|
|
6906
|
+
|
|
6907
|
+
var INT53_MAX = 9007199254740992;
|
|
6908
|
+
|
|
6909
|
+
var INT53_MIN = -9007199254740992;
|
|
6910
|
+
var bigintToI53Checked = (num) =>
|
|
6911
|
+
num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
|
|
6912
|
+
function ___syscall_fallocate(fd, mode, offset, len) {
|
|
6913
|
+
offset = bigintToI53Checked(offset);
|
|
6914
|
+
len = bigintToI53Checked(len);
|
|
6915
|
+
|
|
6916
|
+
try {
|
|
6917
|
+
if (isNaN(offset) || isNaN(len)) return -61;
|
|
6918
|
+
if (mode != 0) {
|
|
6919
|
+
return -138;
|
|
6920
|
+
}
|
|
6921
|
+
if (offset < 0 || len < 0) {
|
|
6922
|
+
return -28;
|
|
6923
|
+
}
|
|
6924
|
+
// We only support mode == 0, which means we can implement fallocate
|
|
6925
|
+
// in terms of ftruncate.
|
|
6926
|
+
var oldSize = FS.fstat(fd).size;
|
|
6927
|
+
var newSize = offset + len;
|
|
6928
|
+
if (newSize > oldSize) {
|
|
6929
|
+
FS.ftruncate(fd, newSize);
|
|
6930
|
+
}
|
|
6931
|
+
return 0;
|
|
6932
|
+
} catch (e) {
|
|
6933
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6934
|
+
return -e.errno;
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
___syscall_fallocate.sig = 'iiijj';
|
|
6938
|
+
|
|
6939
|
+
function ___syscall_fchdir(fd) {
|
|
6940
|
+
try {
|
|
6941
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
6942
|
+
FS.chdir(stream.path);
|
|
6943
|
+
return 0;
|
|
6944
|
+
} catch (e) {
|
|
6945
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6946
|
+
return -e.errno;
|
|
6947
|
+
}
|
|
6948
|
+
}
|
|
6949
|
+
___syscall_fchdir.sig = 'ii';
|
|
6950
|
+
|
|
6951
|
+
function ___syscall_fchmod(fd, mode) {
|
|
6952
|
+
try {
|
|
6953
|
+
FS.fchmod(fd, mode);
|
|
6954
|
+
return 0;
|
|
6955
|
+
} catch (e) {
|
|
6956
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6957
|
+
return -e.errno;
|
|
6958
|
+
}
|
|
6959
|
+
}
|
|
6960
|
+
___syscall_fchmod.sig = 'iii';
|
|
6961
|
+
|
|
6962
|
+
function ___syscall_fchmodat2(dirfd, path, mode, flags) {
|
|
6963
|
+
try {
|
|
6964
|
+
var nofollow = flags & 256;
|
|
6965
|
+
path = SYSCALLS.getStr(path);
|
|
6966
|
+
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6967
|
+
FS.chmod(path, mode, nofollow);
|
|
6968
|
+
return 0;
|
|
6969
|
+
} catch (e) {
|
|
6970
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6971
|
+
return -e.errno;
|
|
6972
|
+
}
|
|
6973
|
+
}
|
|
6974
|
+
___syscall_fchmodat2.sig = 'iipii';
|
|
6975
|
+
|
|
6976
|
+
function ___syscall_fchown32(fd, owner, group) {
|
|
6977
|
+
try {
|
|
6978
|
+
FS.fchown(fd, owner, group);
|
|
6979
|
+
return 0;
|
|
6980
|
+
} catch (e) {
|
|
6981
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6982
|
+
return -e.errno;
|
|
6983
|
+
}
|
|
6984
|
+
}
|
|
6985
|
+
___syscall_fchown32.sig = 'iiii';
|
|
6986
|
+
|
|
6987
|
+
function ___syscall_fchownat(dirfd, path, owner, group, flags) {
|
|
6988
|
+
try {
|
|
6989
|
+
path = SYSCALLS.getStr(path);
|
|
6990
|
+
var nofollow = flags & 256;
|
|
6991
|
+
flags = flags & ~256;
|
|
6992
|
+
path = SYSCALLS.calculateAt(dirfd, path);
|
|
6993
|
+
(nofollow ? FS.lchown : FS.chown)(path, owner, group);
|
|
6994
|
+
return 0;
|
|
6995
|
+
} catch (e) {
|
|
6996
|
+
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6997
|
+
return -e.errno;
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
___syscall_fchownat.sig = 'iipiii';
|
|
7001
|
+
|
|
7002
|
+
var syscallGetVarargI = () => {
|
|
7003
|
+
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
7004
|
+
var ret = HEAP32[+SYSCALLS.varargs >> 2];
|
|
7005
|
+
SYSCALLS.varargs += 4;
|
|
7006
|
+
return ret;
|
|
7007
|
+
};
|
|
7008
|
+
var syscallGetVarargP = syscallGetVarargI;
|
|
6908
7009
|
|
|
6909
7010
|
var _fd_close = function fd_close(fd) {
|
|
6910
7011
|
return Asyncify.handleAsync(async () => {
|
|
@@ -17973,17 +18074,34 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
17973
18074
|
const optionValue = HEAPU8[optionValuePtr];
|
|
17974
18075
|
const SOL_SOCKET = 1;
|
|
17975
18076
|
const SO_KEEPALIVE = 9;
|
|
18077
|
+
const SO_RCVTIMEO = 66;
|
|
18078
|
+
const SO_SNDTIMEO = 67;
|
|
17976
18079
|
const IPPROTO_TCP = 6;
|
|
17977
18080
|
const TCP_NODELAY = 1;
|
|
17978
|
-
|
|
18081
|
+
|
|
18082
|
+
// Options that we can forward to the WebSocket proxy
|
|
18083
|
+
const isForwardable =
|
|
17979
18084
|
(level === SOL_SOCKET && optionName === SO_KEEPALIVE) ||
|
|
17980
18085
|
(level === IPPROTO_TCP && optionName === TCP_NODELAY);
|
|
17981
|
-
|
|
18086
|
+
|
|
18087
|
+
// Options that we acknowledge but don't actually implement
|
|
18088
|
+
// (WebSocket connections handle timeouts differently)
|
|
18089
|
+
const isIgnorable =
|
|
18090
|
+
level === SOL_SOCKET &&
|
|
18091
|
+
(optionName === SO_RCVTIMEO || optionName === SO_SNDTIMEO);
|
|
18092
|
+
|
|
18093
|
+
if (!isForwardable && !isIgnorable) {
|
|
17982
18094
|
console.warn(
|
|
17983
18095
|
`Unsupported socket option: ${level}, ${optionName}, ${optionValue}`
|
|
17984
18096
|
);
|
|
17985
18097
|
return -1;
|
|
17986
18098
|
}
|
|
18099
|
+
|
|
18100
|
+
// For ignorable options, just return success
|
|
18101
|
+
if (isIgnorable) {
|
|
18102
|
+
return 0;
|
|
18103
|
+
}
|
|
18104
|
+
|
|
17987
18105
|
const ws = PHPWASM.getAllWebSockets(socketd)[0];
|
|
17988
18106
|
if (!ws) {
|
|
17989
18107
|
return -1;
|
|
@@ -18007,7 +18125,7 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
18007
18125
|
var Asyncify = {
|
|
18008
18126
|
instrumentWasmImports(imports) {
|
|
18009
18127
|
var importPattern =
|
|
18010
|
-
/^(js_open_process|js_fd_read|js_waitpid|js_process_status|js_create_input_device|wasm_setsockopt|wasm_shutdown|wasm_close|wasm_recv|__syscall_fcntl64|
|
|
18128
|
+
/^(js_open_process|js_fd_read|js_waitpid|js_process_status|js_create_input_device|wasm_setsockopt|wasm_shutdown|wasm_close|wasm_recv|wasm_connect|recv|setsockopt|__syscall_fcntl64|js_flock|js_release_file_locks|js_waitpid|invoke_.*|__asyncjs__.*)$/;
|
|
18011
18129
|
|
|
18012
18130
|
for (let [x, original] of Object.entries(imports)) {
|
|
18013
18131
|
if (typeof original == 'function') {
|
|
@@ -18031,7 +18149,7 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
18031
18149
|
},
|
|
18032
18150
|
instrumentWasmExports(exports) {
|
|
18033
18151
|
var exportPattern =
|
|
18034
|
-
/^(php_wasm_init|wasm_sleep|wasm_read|emscripten_sleep|wasm_sapi_handle_request|wasm_sapi_request_shutdown|wasm_poll_socket|wrap_select|__wrap_select|select|php_pollfd_for|fflush|wasm_popen|wasm_read|wasm_php_exec|run_cli|wasm_recv|__wasm_call_ctors|__errno_location|__funcs_on_exit|main|__main_argc_argv)$/;
|
|
18152
|
+
/^(php_wasm_init|wasm_sleep|wasm_read|emscripten_sleep|wasm_sapi_handle_request|wasm_sapi_request_shutdown|wasm_poll_socket|wrap_select|__wrap_select|select|php_pollfd_for|fflush|wasm_popen|wasm_read|wasm_php_exec|run_cli|wasm_recv|wasm_connect|recv|setsockopt|__wasm_call_ctors|__errno_location|__funcs_on_exit|main|__main_argc_argv)$/;
|
|
18035
18153
|
Asyncify.asyncExports = new Set();
|
|
18036
18154
|
var ret = {};
|
|
18037
18155
|
for (let [x, original] of Object.entries(exports)) {
|
|
@@ -30516,6 +30634,26 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
30516
30634
|
});
|
|
30517
30635
|
};
|
|
30518
30636
|
|
|
30637
|
+
function _recv(sockfd, buffer, size, flags) {
|
|
30638
|
+
return _wasm_recv(sockfd, buffer, size, flags);
|
|
30639
|
+
}
|
|
30640
|
+
|
|
30641
|
+
function _setsockopt(
|
|
30642
|
+
socketd,
|
|
30643
|
+
level,
|
|
30644
|
+
optionName,
|
|
30645
|
+
optionValuePtr,
|
|
30646
|
+
optionLen
|
|
30647
|
+
) {
|
|
30648
|
+
return _wasm_setsockopt(
|
|
30649
|
+
socketd,
|
|
30650
|
+
level,
|
|
30651
|
+
optionName,
|
|
30652
|
+
optionValuePtr,
|
|
30653
|
+
optionLen
|
|
30654
|
+
);
|
|
30655
|
+
}
|
|
30656
|
+
|
|
30519
30657
|
var _getcontext = () => abort('missing function: ${name}');
|
|
30520
30658
|
|
|
30521
30659
|
var _makecontext = () => abort('missing function: ${name}');
|
|
@@ -30524,31 +30662,6 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
30524
30662
|
|
|
30525
30663
|
var _getdtablesize = () => abort('missing function: ${name}');
|
|
30526
30664
|
|
|
30527
|
-
var ___emscripten_lookup_name = function __emscripten_lookup_name(namePtr) {
|
|
30528
|
-
return Asyncify.handleAsync(async () => {
|
|
30529
|
-
if (!ENVIRONMENT_IS_NODE) {
|
|
30530
|
-
return original__emscripten_lookup_name(namePtr);
|
|
30531
|
-
}
|
|
30532
|
-
if (!PHPLoader.syscalls) {
|
|
30533
|
-
return original__emscripten_lookup_name(namePtr);
|
|
30534
|
-
}
|
|
30535
|
-
|
|
30536
|
-
const hostname = UTF8ToString(namePtr);
|
|
30537
|
-
|
|
30538
|
-
let ipString = '';
|
|
30539
|
-
try {
|
|
30540
|
-
ipString = await Promise.resolve(
|
|
30541
|
-
PHPLoader.syscalls.gethostbyname(hostname)
|
|
30542
|
-
);
|
|
30543
|
-
} catch (e) {
|
|
30544
|
-
// Fall through to the default synthetic mapping if native DNS fails.
|
|
30545
|
-
}
|
|
30546
|
-
|
|
30547
|
-
return inetPton4(ipString);
|
|
30548
|
-
});
|
|
30549
|
-
};
|
|
30550
|
-
___emscripten_lookup_name.sig = 'ip';
|
|
30551
|
-
|
|
30552
30665
|
var webSockets = new HandleAllocator();
|
|
30553
30666
|
|
|
30554
30667
|
var WS = {
|
|
@@ -30940,11 +31053,6 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
30940
31053
|
// invocation, so that we will immediately be able to queue the newest
|
|
30941
31054
|
// produced audio samples.
|
|
30942
31055
|
registerPostMainLoop(() => SDL.audio?.queueNewAudioData?.());
|
|
30943
|
-
const original__emscripten_lookup_name = __emscripten_lookup_name;
|
|
30944
|
-
if (typeof __emscripten_lookup_name !== 'undefined') {
|
|
30945
|
-
__emscripten_lookup_name = ___emscripten_lookup_name;
|
|
30946
|
-
}
|
|
30947
|
-
___emscripten_lookup_name.isAsync = true;
|
|
30948
31056
|
// End JS library code
|
|
30949
31057
|
|
|
30950
31058
|
// include: postlibrary.js
|
|
@@ -30980,9 +31088,6 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
30980
31088
|
Module['addRunDependency'] = addRunDependency;
|
|
30981
31089
|
Module['removeRunDependency'] = removeRunDependency;
|
|
30982
31090
|
Module['ccall'] = ccall;
|
|
30983
|
-
Module['UTF8ToString'] = UTF8ToString;
|
|
30984
|
-
Module['stringToUTF8'] = stringToUTF8;
|
|
30985
|
-
Module['lengthBytesUTF8'] = lengthBytesUTF8;
|
|
30986
31091
|
Module['FS_preloadFile'] = FS_preloadFile;
|
|
30987
31092
|
Module['FS_unlink'] = FS_unlink;
|
|
30988
31093
|
Module['FS_createPath'] = FS_createPath;
|
|
@@ -31004,6 +31109,8 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
31004
31109
|
Module['__Unwind_DeleteException'] = __Unwind_DeleteException;
|
|
31005
31110
|
Module['_sched_yield'] = _sched_yield;
|
|
31006
31111
|
Module['___syscall_shutdown'] = ___syscall_shutdown;
|
|
31112
|
+
Module['_recv'] = _recv;
|
|
31113
|
+
Module['_setsockopt'] = _setsockopt;
|
|
31007
31114
|
// End JS library exports
|
|
31008
31115
|
|
|
31009
31116
|
// end include: postlibrary.js
|
|
@@ -31943,8 +32050,6 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
31943
32050
|
/** @export */
|
|
31944
32051
|
__call_sighandler: ___call_sighandler,
|
|
31945
32052
|
/** @export */
|
|
31946
|
-
__emscripten_lookup_name: ___emscripten_lookup_name,
|
|
31947
|
-
/** @export */
|
|
31948
32053
|
__syscall__newselect: ___syscall__newselect,
|
|
31949
32054
|
/** @export */
|
|
31950
32055
|
__syscall_accept4: ___syscall_accept4,
|
|
@@ -33978,9 +34083,15 @@ export function init(RuntimeName, PHPLoader) {
|
|
|
33978
34083
|
/** @export */
|
|
33979
34084
|
wasm_close: _wasm_close,
|
|
33980
34085
|
/** @export */
|
|
34086
|
+
wasm_connect: _wasm_connect,
|
|
34087
|
+
/** @export */
|
|
33981
34088
|
wasm_recv: _wasm_recv,
|
|
34089
|
+
/** */
|
|
34090
|
+
recv: _recv,
|
|
33982
34091
|
/** @export */
|
|
33983
34092
|
wasm_setsockopt: _wasm_setsockopt,
|
|
34093
|
+
/** */
|
|
34094
|
+
setsockopt: _setsockopt,
|
|
33984
34095
|
/** @export */
|
|
33985
34096
|
wasm_shutdown: _wasm_shutdown,
|
|
33986
34097
|
/** @export */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node-8-0",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.45",
|
|
4
4
|
"description": "PHP 8.0 WebAssembly binaries for node",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"node": ">=20.18.3",
|
|
36
36
|
"npm": ">=10.1.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "90da64a5068b13069ea9faf8ff9f5b1e36fd6099",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"ini": "4.1.2",
|
|
41
41
|
"wasm-feature-detect": "1.8.0",
|
|
42
42
|
"ws": "8.18.3",
|
|
43
|
-
"@php-wasm/universal": "3.0.
|
|
43
|
+
"@php-wasm/universal": "3.0.45"
|
|
44
44
|
},
|
|
45
45
|
"packageManager": "npm@10.9.2",
|
|
46
46
|
"overrides": {
|