@php-wasm/node 3.1.2 → 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.
- package/index.cjs +65 -40
- package/index.js +73 -42
- package/lib/extensions/xdebug/with-xdebug.d.ts +8 -2
- package/lib/load-runtime.d.ts +1 -2
- package/lib/wasm-user-space.d.ts +15 -11
- package/package.json +17 -14
package/index.cjs
CHANGED
|
@@ -430,7 +430,7 @@ var import_universal12 = require("@php-wasm/universal");
|
|
|
430
430
|
var import_promises = require("dns/promises");
|
|
431
431
|
function bindUserSpace({ fileLockManager }, {
|
|
432
432
|
pid,
|
|
433
|
-
memory
|
|
433
|
+
memory,
|
|
434
434
|
constants: {
|
|
435
435
|
F_RDLCK,
|
|
436
436
|
F_WRLCK,
|
|
@@ -470,7 +470,7 @@ function bindUserSpace({ fileLockManager }, {
|
|
|
470
470
|
}
|
|
471
471
|
getNextAsInt() {
|
|
472
472
|
const fourByteOffset = this.argsAddr >> 2;
|
|
473
|
-
const value = HEAP32
|
|
473
|
+
const value = memory.HEAP32.get(fourByteOffset);
|
|
474
474
|
this.argsAddr += 4;
|
|
475
475
|
return value;
|
|
476
476
|
}
|
|
@@ -578,58 +578,63 @@ function bindUserSpace({ fileLockManager }, {
|
|
|
578
578
|
const emscripten_flock_l_pid_offset = 24;
|
|
579
579
|
function readFlockStruct(flockStructAddress) {
|
|
580
580
|
return {
|
|
581
|
-
l_type: HEAP16
|
|
581
|
+
l_type: memory.HEAP16.get(
|
|
582
582
|
// Shift right by 1 to divide by 2^1.
|
|
583
583
|
flockStructAddress + emscripten_flock_l_type_offset >> 1
|
|
584
|
-
|
|
585
|
-
l_whence: HEAP16
|
|
584
|
+
),
|
|
585
|
+
l_whence: memory.HEAP16.get(
|
|
586
586
|
// Shift right by 1 to divide by 2^1.
|
|
587
587
|
flockStructAddress + emscripten_flock_l_whence_offset >> 1
|
|
588
|
-
|
|
589
|
-
l_start: HEAP64
|
|
588
|
+
),
|
|
589
|
+
l_start: memory.HEAP64.get(
|
|
590
590
|
// Shift right by 3 to divide by 2^3.
|
|
591
591
|
flockStructAddress + emscripten_flock_l_start_offset >> 3
|
|
592
|
-
|
|
593
|
-
l_len: HEAP64
|
|
592
|
+
),
|
|
593
|
+
l_len: memory.HEAP64.get(
|
|
594
594
|
// Shift right by 3 to divide by 2^3.
|
|
595
595
|
flockStructAddress + emscripten_flock_l_len_offset >> 3
|
|
596
|
-
|
|
597
|
-
l_pid: HEAP32
|
|
596
|
+
),
|
|
597
|
+
l_pid: memory.HEAP32.get(
|
|
598
598
|
// Shift right by 2 to divide by 2^2.
|
|
599
599
|
flockStructAddress + emscripten_flock_l_pid_offset >> 2
|
|
600
|
-
|
|
600
|
+
)
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
603
|
function updateFlockStruct(flockStructAddress, fields) {
|
|
604
604
|
if (fields.l_type !== void 0) {
|
|
605
|
-
HEAP16
|
|
605
|
+
memory.HEAP16.set(
|
|
606
606
|
// Shift right by 1 to divide by 2^1.
|
|
607
|
-
flockStructAddress + emscripten_flock_l_type_offset >> 1
|
|
608
|
-
|
|
607
|
+
flockStructAddress + emscripten_flock_l_type_offset >> 1,
|
|
608
|
+
fields.l_type
|
|
609
|
+
);
|
|
609
610
|
}
|
|
610
611
|
if (fields.l_whence !== void 0) {
|
|
611
|
-
HEAP16
|
|
612
|
+
memory.HEAP16.set(
|
|
612
613
|
// Shift right by 1 to divide by 2^1.
|
|
613
|
-
flockStructAddress + emscripten_flock_l_whence_offset >> 1
|
|
614
|
-
|
|
614
|
+
flockStructAddress + emscripten_flock_l_whence_offset >> 1,
|
|
615
|
+
fields.l_whence
|
|
616
|
+
);
|
|
615
617
|
}
|
|
616
618
|
if (fields.l_start !== void 0) {
|
|
617
|
-
HEAP64
|
|
619
|
+
memory.HEAP64.set(
|
|
618
620
|
// Shift right by 3 to divide by 2^3.
|
|
619
|
-
flockStructAddress + emscripten_flock_l_start_offset >> 3
|
|
620
|
-
|
|
621
|
+
flockStructAddress + emscripten_flock_l_start_offset >> 3,
|
|
622
|
+
fields.l_start
|
|
623
|
+
);
|
|
621
624
|
}
|
|
622
625
|
if (fields.l_len !== void 0) {
|
|
623
|
-
HEAP64
|
|
626
|
+
memory.HEAP64.set(
|
|
624
627
|
// Shift right by 3 to divide by 2^3.
|
|
625
|
-
flockStructAddress + emscripten_flock_l_len_offset >> 3
|
|
626
|
-
|
|
628
|
+
flockStructAddress + emscripten_flock_l_len_offset >> 3,
|
|
629
|
+
fields.l_len
|
|
630
|
+
);
|
|
627
631
|
}
|
|
628
632
|
if (fields.l_pid !== void 0) {
|
|
629
|
-
HEAP32
|
|
633
|
+
memory.HEAP32.set(
|
|
630
634
|
// Shift right by 2 to divide by 2^2.
|
|
631
|
-
flockStructAddress + emscripten_flock_l_pid_offset >> 2
|
|
632
|
-
|
|
635
|
+
flockStructAddress + emscripten_flock_l_pid_offset >> 2,
|
|
636
|
+
fields.l_pid
|
|
637
|
+
);
|
|
633
638
|
}
|
|
634
639
|
}
|
|
635
640
|
function getBaseAddress(fd, whence, startOffset) {
|
|
@@ -1564,6 +1569,7 @@ var FileLockManagerForWindows = class {
|
|
|
1564
1569
|
};
|
|
1565
1570
|
|
|
1566
1571
|
// packages/php-wasm/node/src/lib/extensions/xdebug/with-xdebug.ts
|
|
1572
|
+
var import_cli_util = require("@php-wasm/cli-util");
|
|
1567
1573
|
var import_universal5 = require("@php-wasm/universal");
|
|
1568
1574
|
var import_fs = __toESM(require("fs"), 1);
|
|
1569
1575
|
|
|
@@ -1623,26 +1629,39 @@ async function withXdebug(version = import_universal5.LatestSupportedPHPVersion,
|
|
|
1623
1629
|
phpRuntime.FS,
|
|
1624
1630
|
"/internal/shared/extensions/xdebug.ini"
|
|
1625
1631
|
)) {
|
|
1626
|
-
const ideKey = xdebugOptions
|
|
1632
|
+
const ideKey = xdebugOptions.ideKey || import_cli_util.DEFAULT_IDE_KEY;
|
|
1627
1633
|
phpRuntime.FS.writeFile(
|
|
1628
1634
|
"/internal/shared/extensions/xdebug.ini",
|
|
1629
1635
|
[
|
|
1630
1636
|
"zend_extension=/internal/shared/extensions/xdebug.so",
|
|
1631
1637
|
"xdebug.mode=debug,develop",
|
|
1632
1638
|
"xdebug.start_with_request=yes",
|
|
1633
|
-
`xdebug.idekey="${ideKey}"
|
|
1639
|
+
`xdebug.idekey="${ideKey}"`,
|
|
1640
|
+
// Path mapping is only available starting
|
|
1641
|
+
// from Xdebug 3.5, which is used by PHP 8.5+
|
|
1642
|
+
// Previous versions will ignore this entry.
|
|
1643
|
+
"xdebug.path_mapping=yes"
|
|
1634
1644
|
].join("\n")
|
|
1635
1645
|
);
|
|
1636
1646
|
}
|
|
1637
|
-
const
|
|
1638
|
-
if (
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1647
|
+
const isPHP85orHigher = import_universal5.SupportedPHPVersionsList.indexOf(version) <= import_universal5.SupportedPHPVersions.indexOf("8.5");
|
|
1648
|
+
if (isPHP85orHigher) {
|
|
1649
|
+
const { pathMappings, pathSkippings } = xdebugOptions;
|
|
1650
|
+
if (!pathMappings && !pathSkippings)
|
|
1651
|
+
return;
|
|
1652
|
+
phpRuntime.FS.mkdir("/.xdebug");
|
|
1653
|
+
if (pathMappings) {
|
|
1654
|
+
phpRuntime.FS.writeFile(
|
|
1655
|
+
"/.xdebug/path.map",
|
|
1656
|
+
pathMappings.map((map) => `${map.vfsPath} = ${map.hostPath}`).join("\n")
|
|
1657
|
+
);
|
|
1658
|
+
}
|
|
1659
|
+
if (pathSkippings) {
|
|
1660
|
+
phpRuntime.FS.writeFile(
|
|
1661
|
+
"/.xdebug/skip.map",
|
|
1662
|
+
pathSkippings.map((path2) => `${path2} = SKIP`).join("\n")
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1646
1665
|
}
|
|
1647
1666
|
}
|
|
1648
1667
|
};
|
|
@@ -1881,7 +1900,12 @@ async function withMemcached(version = import_universal11.LatestSupportedPHPVers
|
|
|
1881
1900
|
// packages/php-wasm/node/src/lib/load-runtime.ts
|
|
1882
1901
|
var import_util = require("@php-wasm/util");
|
|
1883
1902
|
var import_os = require("os");
|
|
1903
|
+
var dangerousDefaultProcessIdAllocator = process.env.VITEST ? new import_universal12.ProcessIdAllocator() : void 0;
|
|
1884
1904
|
async function loadNodeRuntime(phpVersion, options = {}) {
|
|
1905
|
+
const processId = options.emscriptenOptions?.processId ?? // !! Only assign a default process ID during test.
|
|
1906
|
+
// Otherwise, multiple workers with duplicate process IDs
|
|
1907
|
+
// could break file locking and lead to database corruption.
|
|
1908
|
+
(process.env.VITEST ? dangerousDefaultProcessIdAllocator.claim() : void 0);
|
|
1885
1909
|
let emscriptenOptions = {
|
|
1886
1910
|
/**
|
|
1887
1911
|
* Emscripten default behavior is to kill the process when
|
|
@@ -1900,6 +1924,7 @@ async function loadNodeRuntime(phpVersion, options = {}) {
|
|
|
1900
1924
|
return bindUserSpace({ fileLockManager }, userSpaceContext);
|
|
1901
1925
|
},
|
|
1902
1926
|
...options.emscriptenOptions || {},
|
|
1927
|
+
processId,
|
|
1903
1928
|
onRuntimeInitialized: (phpRuntime) => {
|
|
1904
1929
|
if (options?.followSymlinks === true) {
|
|
1905
1930
|
phpRuntime.FS.filesystems.NODEFS.node_ops.readlink = (node) => {
|
|
@@ -1952,11 +1977,11 @@ async function loadNodeRuntime(phpVersion, options = {}) {
|
|
|
1952
1977
|
phpRuntime.FS.root.mount.opts.root = ".";
|
|
1953
1978
|
}
|
|
1954
1979
|
};
|
|
1955
|
-
if (options?.withXdebug
|
|
1980
|
+
if (options?.withXdebug) {
|
|
1956
1981
|
emscriptenOptions = await withXdebug(
|
|
1957
1982
|
phpVersion,
|
|
1958
1983
|
emscriptenOptions,
|
|
1959
|
-
options.
|
|
1984
|
+
typeof options.withXdebug === "object" ? options.withXdebug : {}
|
|
1960
1985
|
);
|
|
1961
1986
|
}
|
|
1962
1987
|
if (options?.withIntl === true) {
|
package/index.js
CHANGED
|
@@ -393,14 +393,15 @@ async function withNetworking(phpModuleArgs = {}) {
|
|
|
393
393
|
import {
|
|
394
394
|
loadPHPRuntime,
|
|
395
395
|
FSHelpers as FSHelpers5,
|
|
396
|
-
FileLockManagerComposite
|
|
396
|
+
FileLockManagerComposite,
|
|
397
|
+
ProcessIdAllocator
|
|
397
398
|
} from "@php-wasm/universal";
|
|
398
399
|
|
|
399
400
|
// packages/php-wasm/node/src/lib/wasm-user-space.ts
|
|
400
401
|
import { lookup as lookup2 } from "dns/promises";
|
|
401
402
|
function bindUserSpace({ fileLockManager }, {
|
|
402
403
|
pid,
|
|
403
|
-
memory
|
|
404
|
+
memory,
|
|
404
405
|
constants: {
|
|
405
406
|
F_RDLCK,
|
|
406
407
|
F_WRLCK,
|
|
@@ -440,7 +441,7 @@ function bindUserSpace({ fileLockManager }, {
|
|
|
440
441
|
}
|
|
441
442
|
getNextAsInt() {
|
|
442
443
|
const fourByteOffset = this.argsAddr >> 2;
|
|
443
|
-
const value = HEAP32
|
|
444
|
+
const value = memory.HEAP32.get(fourByteOffset);
|
|
444
445
|
this.argsAddr += 4;
|
|
445
446
|
return value;
|
|
446
447
|
}
|
|
@@ -548,58 +549,63 @@ function bindUserSpace({ fileLockManager }, {
|
|
|
548
549
|
const emscripten_flock_l_pid_offset = 24;
|
|
549
550
|
function readFlockStruct(flockStructAddress) {
|
|
550
551
|
return {
|
|
551
|
-
l_type: HEAP16
|
|
552
|
+
l_type: memory.HEAP16.get(
|
|
552
553
|
// Shift right by 1 to divide by 2^1.
|
|
553
554
|
flockStructAddress + emscripten_flock_l_type_offset >> 1
|
|
554
|
-
|
|
555
|
-
l_whence: HEAP16
|
|
555
|
+
),
|
|
556
|
+
l_whence: memory.HEAP16.get(
|
|
556
557
|
// Shift right by 1 to divide by 2^1.
|
|
557
558
|
flockStructAddress + emscripten_flock_l_whence_offset >> 1
|
|
558
|
-
|
|
559
|
-
l_start: HEAP64
|
|
559
|
+
),
|
|
560
|
+
l_start: memory.HEAP64.get(
|
|
560
561
|
// Shift right by 3 to divide by 2^3.
|
|
561
562
|
flockStructAddress + emscripten_flock_l_start_offset >> 3
|
|
562
|
-
|
|
563
|
-
l_len: HEAP64
|
|
563
|
+
),
|
|
564
|
+
l_len: memory.HEAP64.get(
|
|
564
565
|
// Shift right by 3 to divide by 2^3.
|
|
565
566
|
flockStructAddress + emscripten_flock_l_len_offset >> 3
|
|
566
|
-
|
|
567
|
-
l_pid: HEAP32
|
|
567
|
+
),
|
|
568
|
+
l_pid: memory.HEAP32.get(
|
|
568
569
|
// Shift right by 2 to divide by 2^2.
|
|
569
570
|
flockStructAddress + emscripten_flock_l_pid_offset >> 2
|
|
570
|
-
|
|
571
|
+
)
|
|
571
572
|
};
|
|
572
573
|
}
|
|
573
574
|
function updateFlockStruct(flockStructAddress, fields) {
|
|
574
575
|
if (fields.l_type !== void 0) {
|
|
575
|
-
HEAP16
|
|
576
|
+
memory.HEAP16.set(
|
|
576
577
|
// Shift right by 1 to divide by 2^1.
|
|
577
|
-
flockStructAddress + emscripten_flock_l_type_offset >> 1
|
|
578
|
-
|
|
578
|
+
flockStructAddress + emscripten_flock_l_type_offset >> 1,
|
|
579
|
+
fields.l_type
|
|
580
|
+
);
|
|
579
581
|
}
|
|
580
582
|
if (fields.l_whence !== void 0) {
|
|
581
|
-
HEAP16
|
|
583
|
+
memory.HEAP16.set(
|
|
582
584
|
// Shift right by 1 to divide by 2^1.
|
|
583
|
-
flockStructAddress + emscripten_flock_l_whence_offset >> 1
|
|
584
|
-
|
|
585
|
+
flockStructAddress + emscripten_flock_l_whence_offset >> 1,
|
|
586
|
+
fields.l_whence
|
|
587
|
+
);
|
|
585
588
|
}
|
|
586
589
|
if (fields.l_start !== void 0) {
|
|
587
|
-
HEAP64
|
|
590
|
+
memory.HEAP64.set(
|
|
588
591
|
// Shift right by 3 to divide by 2^3.
|
|
589
|
-
flockStructAddress + emscripten_flock_l_start_offset >> 3
|
|
590
|
-
|
|
592
|
+
flockStructAddress + emscripten_flock_l_start_offset >> 3,
|
|
593
|
+
fields.l_start
|
|
594
|
+
);
|
|
591
595
|
}
|
|
592
596
|
if (fields.l_len !== void 0) {
|
|
593
|
-
HEAP64
|
|
597
|
+
memory.HEAP64.set(
|
|
594
598
|
// Shift right by 3 to divide by 2^3.
|
|
595
|
-
flockStructAddress + emscripten_flock_l_len_offset >> 3
|
|
596
|
-
|
|
599
|
+
flockStructAddress + emscripten_flock_l_len_offset >> 3,
|
|
600
|
+
fields.l_len
|
|
601
|
+
);
|
|
597
602
|
}
|
|
598
603
|
if (fields.l_pid !== void 0) {
|
|
599
|
-
HEAP32
|
|
604
|
+
memory.HEAP32.set(
|
|
600
605
|
// Shift right by 2 to divide by 2^2.
|
|
601
|
-
flockStructAddress + emscripten_flock_l_pid_offset >> 2
|
|
602
|
-
|
|
606
|
+
flockStructAddress + emscripten_flock_l_pid_offset >> 2,
|
|
607
|
+
fields.l_pid
|
|
608
|
+
);
|
|
603
609
|
}
|
|
604
610
|
}
|
|
605
611
|
function getBaseAddress(fd, whence, startOffset) {
|
|
@@ -1541,7 +1547,13 @@ var FileLockManagerForWindows = class {
|
|
|
1541
1547
|
};
|
|
1542
1548
|
|
|
1543
1549
|
// packages/php-wasm/node/src/lib/extensions/xdebug/with-xdebug.ts
|
|
1544
|
-
import {
|
|
1550
|
+
import { DEFAULT_IDE_KEY } from "@php-wasm/cli-util";
|
|
1551
|
+
import {
|
|
1552
|
+
FSHelpers,
|
|
1553
|
+
LatestSupportedPHPVersion as LatestSupportedPHPVersion3,
|
|
1554
|
+
SupportedPHPVersions,
|
|
1555
|
+
SupportedPHPVersionsList
|
|
1556
|
+
} from "@php-wasm/universal";
|
|
1545
1557
|
import fs from "fs";
|
|
1546
1558
|
|
|
1547
1559
|
// packages/php-wasm/node/src/lib/extensions/xdebug/get-xdebug-extension-module.ts
|
|
@@ -1600,26 +1612,39 @@ async function withXdebug(version = LatestSupportedPHPVersion3, options, xdebugO
|
|
|
1600
1612
|
phpRuntime.FS,
|
|
1601
1613
|
"/internal/shared/extensions/xdebug.ini"
|
|
1602
1614
|
)) {
|
|
1603
|
-
const ideKey = xdebugOptions
|
|
1615
|
+
const ideKey = xdebugOptions.ideKey || DEFAULT_IDE_KEY;
|
|
1604
1616
|
phpRuntime.FS.writeFile(
|
|
1605
1617
|
"/internal/shared/extensions/xdebug.ini",
|
|
1606
1618
|
[
|
|
1607
1619
|
"zend_extension=/internal/shared/extensions/xdebug.so",
|
|
1608
1620
|
"xdebug.mode=debug,develop",
|
|
1609
1621
|
"xdebug.start_with_request=yes",
|
|
1610
|
-
`xdebug.idekey="${ideKey}"
|
|
1622
|
+
`xdebug.idekey="${ideKey}"`,
|
|
1623
|
+
// Path mapping is only available starting
|
|
1624
|
+
// from Xdebug 3.5, which is used by PHP 8.5+
|
|
1625
|
+
// Previous versions will ignore this entry.
|
|
1626
|
+
"xdebug.path_mapping=yes"
|
|
1611
1627
|
].join("\n")
|
|
1612
1628
|
);
|
|
1613
1629
|
}
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1630
|
+
const isPHP85orHigher = SupportedPHPVersionsList.indexOf(version) <= SupportedPHPVersions.indexOf("8.5");
|
|
1631
|
+
if (isPHP85orHigher) {
|
|
1632
|
+
const { pathMappings, pathSkippings } = xdebugOptions;
|
|
1633
|
+
if (!pathMappings && !pathSkippings)
|
|
1634
|
+
return;
|
|
1635
|
+
phpRuntime.FS.mkdir("/.xdebug");
|
|
1636
|
+
if (pathMappings) {
|
|
1637
|
+
phpRuntime.FS.writeFile(
|
|
1638
|
+
"/.xdebug/path.map",
|
|
1639
|
+
pathMappings.map((map) => `${map.vfsPath} = ${map.hostPath}`).join("\n")
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
if (pathSkippings) {
|
|
1643
|
+
phpRuntime.FS.writeFile(
|
|
1644
|
+
"/.xdebug/skip.map",
|
|
1645
|
+
pathSkippings.map((path2) => `${path2} = SKIP`).join("\n")
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1623
1648
|
}
|
|
1624
1649
|
}
|
|
1625
1650
|
};
|
|
@@ -1857,7 +1882,12 @@ async function withMemcached(version = LatestSupportedPHPVersion9, options) {
|
|
|
1857
1882
|
// packages/php-wasm/node/src/lib/load-runtime.ts
|
|
1858
1883
|
import { dirname, joinPaths, toPosixPath } from "@php-wasm/util";
|
|
1859
1884
|
import { platform } from "os";
|
|
1885
|
+
var dangerousDefaultProcessIdAllocator = process.env.VITEST ? new ProcessIdAllocator() : void 0;
|
|
1860
1886
|
async function loadNodeRuntime(phpVersion, options = {}) {
|
|
1887
|
+
const processId = options.emscriptenOptions?.processId ?? // !! Only assign a default process ID during test.
|
|
1888
|
+
// Otherwise, multiple workers with duplicate process IDs
|
|
1889
|
+
// could break file locking and lead to database corruption.
|
|
1890
|
+
(process.env.VITEST ? dangerousDefaultProcessIdAllocator.claim() : void 0);
|
|
1861
1891
|
let emscriptenOptions = {
|
|
1862
1892
|
/**
|
|
1863
1893
|
* Emscripten default behavior is to kill the process when
|
|
@@ -1876,6 +1906,7 @@ async function loadNodeRuntime(phpVersion, options = {}) {
|
|
|
1876
1906
|
return bindUserSpace({ fileLockManager }, userSpaceContext);
|
|
1877
1907
|
},
|
|
1878
1908
|
...options.emscriptenOptions || {},
|
|
1909
|
+
processId,
|
|
1879
1910
|
onRuntimeInitialized: (phpRuntime) => {
|
|
1880
1911
|
if (options?.followSymlinks === true) {
|
|
1881
1912
|
phpRuntime.FS.filesystems.NODEFS.node_ops.readlink = (node) => {
|
|
@@ -1928,11 +1959,11 @@ async function loadNodeRuntime(phpVersion, options = {}) {
|
|
|
1928
1959
|
phpRuntime.FS.root.mount.opts.root = ".";
|
|
1929
1960
|
}
|
|
1930
1961
|
};
|
|
1931
|
-
if (options?.withXdebug
|
|
1962
|
+
if (options?.withXdebug) {
|
|
1932
1963
|
emscriptenOptions = await withXdebug(
|
|
1933
1964
|
phpVersion,
|
|
1934
1965
|
emscriptenOptions,
|
|
1935
|
-
options.
|
|
1966
|
+
typeof options.withXdebug === "object" ? options.withXdebug : {}
|
|
1936
1967
|
);
|
|
1937
1968
|
}
|
|
1938
1969
|
if (options?.withIntl === true) {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EmscriptenOptions } from '@php-wasm/universal';
|
|
2
|
+
export interface PathMapping {
|
|
3
|
+
hostPath: string;
|
|
4
|
+
vfsPath: string;
|
|
5
|
+
}
|
|
2
6
|
export interface XdebugOptions {
|
|
3
7
|
ideKey?: string;
|
|
8
|
+
pathMappings?: PathMapping[];
|
|
9
|
+
pathSkippings?: string[];
|
|
4
10
|
}
|
|
5
|
-
export declare function withXdebug(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions, xdebugOptions
|
|
11
|
+
export declare function withXdebug(version: "8.5" | "8.4" | "8.3" | "8.2" | "8.1" | "8.0" | "7.4" | undefined, options: EmscriptenOptions, xdebugOptions: XdebugOptions): Promise<EmscriptenOptions>;
|
package/lib/load-runtime.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ import type { WasmUserSpaceAPI, WasmUserSpaceContext } from './wasm-user-space';
|
|
|
3
3
|
import { type XdebugOptions } from './extensions/xdebug/with-xdebug';
|
|
4
4
|
export interface PHPLoaderOptions {
|
|
5
5
|
followSymlinks?: boolean;
|
|
6
|
-
withXdebug?: boolean;
|
|
7
|
-
xdebug?: XdebugOptions;
|
|
6
|
+
withXdebug?: boolean | XdebugOptions;
|
|
8
7
|
withIntl?: boolean;
|
|
9
8
|
withRedis?: boolean;
|
|
10
9
|
withMemcached?: boolean;
|
package/lib/wasm-user-space.d.ts
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import type { Emscripten } from '@php-wasm/universal';
|
|
8
8
|
import type { WasmKernelSpace } from './wasm-kernel-space';
|
|
9
9
|
type FSNode = Emscripten.FS.FSNode;
|
|
10
|
+
type HeapAccessor<T> = {
|
|
11
|
+
get(offset: number): T;
|
|
12
|
+
set(offset: number, value: T): void;
|
|
13
|
+
};
|
|
10
14
|
type NonZeroNumber = Exclude<number, 0>;
|
|
11
15
|
export type WasmUserSpaceContext = {
|
|
12
16
|
pid: number;
|
|
@@ -40,16 +44,16 @@ export type WasmUserSpaceContext = {
|
|
|
40
44
|
EWOULDBLOCK: NonZeroNumber;
|
|
41
45
|
};
|
|
42
46
|
memory: {
|
|
43
|
-
HEAP8:
|
|
44
|
-
HEAPU8:
|
|
45
|
-
HEAP16:
|
|
46
|
-
HEAPU16:
|
|
47
|
-
HEAP32:
|
|
48
|
-
HEAPU32:
|
|
49
|
-
HEAPF32:
|
|
50
|
-
HEAP64:
|
|
51
|
-
HEAPU64:
|
|
52
|
-
HEAPF64:
|
|
47
|
+
HEAP8: HeapAccessor<number>;
|
|
48
|
+
HEAPU8: HeapAccessor<number>;
|
|
49
|
+
HEAP16: HeapAccessor<number>;
|
|
50
|
+
HEAPU16: HeapAccessor<number>;
|
|
51
|
+
HEAP32: HeapAccessor<number>;
|
|
52
|
+
HEAPU32: HeapAccessor<number>;
|
|
53
|
+
HEAPF32: HeapAccessor<number>;
|
|
54
|
+
HEAP64: HeapAccessor<bigint>;
|
|
55
|
+
HEAPU64: HeapAccessor<bigint>;
|
|
56
|
+
HEAPF64: HeapAccessor<bigint>;
|
|
53
57
|
};
|
|
54
58
|
wasmImports: {
|
|
55
59
|
builtin_fcntl64: (fd: number, cmd: number, varargs?: any) => number;
|
|
@@ -77,5 +81,5 @@ export type WasmUserSpaceAPI = {
|
|
|
77
81
|
js_release_file_locks: () => void;
|
|
78
82
|
gethostbyname: (hostname: string) => Promise<string>;
|
|
79
83
|
};
|
|
80
|
-
export declare function bindUserSpace({ fileLockManager }: WasmKernelSpace, { pid, memory
|
|
84
|
+
export declare function bindUserSpace({ fileLockManager }: WasmKernelSpace, { pid, memory, constants: { F_RDLCK, F_WRLCK, F_UNLCK, F_GETFL, O_ACCMODE, O_RDONLY, O_WRONLY, O_APPEND, O_NONBLOCK, F_SETFL, F_GETLK, F_SETLK, F_SETLKW, SEEK_SET, SEEK_CUR, SEEK_END, LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, }, errnoCodes: { EBADF, EINVAL, EAGAIN, EWOULDBLOCK }, wasmImports: { builtin_fcntl64, builtin_fd_close, js_wasm_trace }, wasmExports: { wasm_get_end_offset }, syscalls: { getStreamFromFD }, FS, PROXYFS, NODEFS, }: WasmUserSpaceContext): WasmUserSpaceAPI;
|
|
81
85
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/node",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "PHP.wasm for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,30 +38,33 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "GPL-2.0-or-later",
|
|
40
40
|
"types": "index.d.ts",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a7cde6f2a2d3cef27f51f24e9ddadbe5ca05344b",
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.10.0",
|
|
44
44
|
"npm": ">=10.2.3"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"express": "4.22.0",
|
|
48
|
+
"fast-xml-parser": "^5.3.4",
|
|
48
49
|
"fs-ext-extra-prebuilt": "2.2.7",
|
|
49
50
|
"ini": "4.1.2",
|
|
51
|
+
"jsonc-parser": "3.3.1",
|
|
50
52
|
"wasm-feature-detect": "1.8.0",
|
|
51
53
|
"ws": "8.18.3",
|
|
52
54
|
"yargs": "17.7.2",
|
|
53
|
-
"@php-wasm/node-polyfills": "3.1.
|
|
54
|
-
"@php-wasm/universal": "3.1.
|
|
55
|
-
"@php-wasm/node-8-5": "3.1.
|
|
56
|
-
"@php-wasm/node-8-4": "3.1.
|
|
57
|
-
"@php-wasm/node-8-3": "3.1.
|
|
58
|
-
"@php-wasm/node-8-2": "3.1.
|
|
59
|
-
"@php-wasm/node-8-1": "3.1.
|
|
60
|
-
"@php-wasm/node-8-0": "3.1.
|
|
61
|
-
"@php-wasm/node-7-4": "3.1.
|
|
62
|
-
"@php-wasm/
|
|
63
|
-
"@php-wasm/
|
|
64
|
-
"@
|
|
55
|
+
"@php-wasm/node-polyfills": "3.1.4",
|
|
56
|
+
"@php-wasm/universal": "3.1.4",
|
|
57
|
+
"@php-wasm/node-8-5": "3.1.4",
|
|
58
|
+
"@php-wasm/node-8-4": "3.1.4",
|
|
59
|
+
"@php-wasm/node-8-3": "3.1.4",
|
|
60
|
+
"@php-wasm/node-8-2": "3.1.4",
|
|
61
|
+
"@php-wasm/node-8-1": "3.1.4",
|
|
62
|
+
"@php-wasm/node-8-0": "3.1.4",
|
|
63
|
+
"@php-wasm/node-7-4": "3.1.4",
|
|
64
|
+
"@php-wasm/cli-util": "3.1.4",
|
|
65
|
+
"@php-wasm/logger": "3.1.4",
|
|
66
|
+
"@php-wasm/util": "3.1.4",
|
|
67
|
+
"@wp-playground/common": "3.1.4"
|
|
65
68
|
},
|
|
66
69
|
"packageManager": "npm@10.9.2",
|
|
67
70
|
"overrides": {
|