@php-wasm/node 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.
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: { HEAP16, HEAP64, HEAP32 },
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[fourByteOffset];
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
- ] = fields.l_type;
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
- ] = fields.l_whence;
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
- ] = fields.l_start;
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
- ] = fields.l_len;
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
- ] = fields.l_pid;
635
+ flockStructAddress + emscripten_flock_l_pid_offset >> 2,
636
+ fields.l_pid
637
+ );
633
638
  }
634
639
  }
635
640
  function getBaseAddress(fd, whence, startOffset) {
package/index.js CHANGED
@@ -401,7 +401,7 @@ import {
401
401
  import { lookup as lookup2 } from "dns/promises";
402
402
  function bindUserSpace({ fileLockManager }, {
403
403
  pid,
404
- memory: { HEAP16, HEAP64, HEAP32 },
404
+ memory,
405
405
  constants: {
406
406
  F_RDLCK,
407
407
  F_WRLCK,
@@ -441,7 +441,7 @@ function bindUserSpace({ fileLockManager }, {
441
441
  }
442
442
  getNextAsInt() {
443
443
  const fourByteOffset = this.argsAddr >> 2;
444
- const value = HEAP32[fourByteOffset];
444
+ const value = memory.HEAP32.get(fourByteOffset);
445
445
  this.argsAddr += 4;
446
446
  return value;
447
447
  }
@@ -549,58 +549,63 @@ function bindUserSpace({ fileLockManager }, {
549
549
  const emscripten_flock_l_pid_offset = 24;
550
550
  function readFlockStruct(flockStructAddress) {
551
551
  return {
552
- l_type: HEAP16[
552
+ l_type: memory.HEAP16.get(
553
553
  // Shift right by 1 to divide by 2^1.
554
554
  flockStructAddress + emscripten_flock_l_type_offset >> 1
555
- ],
556
- l_whence: HEAP16[
555
+ ),
556
+ l_whence: memory.HEAP16.get(
557
557
  // Shift right by 1 to divide by 2^1.
558
558
  flockStructAddress + emscripten_flock_l_whence_offset >> 1
559
- ],
560
- l_start: HEAP64[
559
+ ),
560
+ l_start: memory.HEAP64.get(
561
561
  // Shift right by 3 to divide by 2^3.
562
562
  flockStructAddress + emscripten_flock_l_start_offset >> 3
563
- ],
564
- l_len: HEAP64[
563
+ ),
564
+ l_len: memory.HEAP64.get(
565
565
  // Shift right by 3 to divide by 2^3.
566
566
  flockStructAddress + emscripten_flock_l_len_offset >> 3
567
- ],
568
- l_pid: HEAP32[
567
+ ),
568
+ l_pid: memory.HEAP32.get(
569
569
  // Shift right by 2 to divide by 2^2.
570
570
  flockStructAddress + emscripten_flock_l_pid_offset >> 2
571
- ]
571
+ )
572
572
  };
573
573
  }
574
574
  function updateFlockStruct(flockStructAddress, fields) {
575
575
  if (fields.l_type !== void 0) {
576
- HEAP16[
576
+ memory.HEAP16.set(
577
577
  // Shift right by 1 to divide by 2^1.
578
- flockStructAddress + emscripten_flock_l_type_offset >> 1
579
- ] = fields.l_type;
578
+ flockStructAddress + emscripten_flock_l_type_offset >> 1,
579
+ fields.l_type
580
+ );
580
581
  }
581
582
  if (fields.l_whence !== void 0) {
582
- HEAP16[
583
+ memory.HEAP16.set(
583
584
  // Shift right by 1 to divide by 2^1.
584
- flockStructAddress + emscripten_flock_l_whence_offset >> 1
585
- ] = fields.l_whence;
585
+ flockStructAddress + emscripten_flock_l_whence_offset >> 1,
586
+ fields.l_whence
587
+ );
586
588
  }
587
589
  if (fields.l_start !== void 0) {
588
- HEAP64[
590
+ memory.HEAP64.set(
589
591
  // Shift right by 3 to divide by 2^3.
590
- flockStructAddress + emscripten_flock_l_start_offset >> 3
591
- ] = fields.l_start;
592
+ flockStructAddress + emscripten_flock_l_start_offset >> 3,
593
+ fields.l_start
594
+ );
592
595
  }
593
596
  if (fields.l_len !== void 0) {
594
- HEAP64[
597
+ memory.HEAP64.set(
595
598
  // Shift right by 3 to divide by 2^3.
596
- flockStructAddress + emscripten_flock_l_len_offset >> 3
597
- ] = fields.l_len;
599
+ flockStructAddress + emscripten_flock_l_len_offset >> 3,
600
+ fields.l_len
601
+ );
598
602
  }
599
603
  if (fields.l_pid !== void 0) {
600
- HEAP32[
604
+ memory.HEAP32.set(
601
605
  // Shift right by 2 to divide by 2^2.
602
- flockStructAddress + emscripten_flock_l_pid_offset >> 2
603
- ] = fields.l_pid;
606
+ flockStructAddress + emscripten_flock_l_pid_offset >> 2,
607
+ fields.l_pid
608
+ );
604
609
  }
605
610
  }
606
611
  function getBaseAddress(fd, whence, startOffset) {
@@ -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: Int8Array;
44
- HEAPU8: Uint8Array;
45
- HEAP16: Int16Array;
46
- HEAPU16: Uint16Array;
47
- HEAP32: Int32Array;
48
- HEAPU32: Uint32Array;
49
- HEAPF32: Float32Array;
50
- HEAP64: BigInt64Array;
51
- HEAPU64: BigUint64Array;
52
- HEAPF64: Float64Array;
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: { HEAP16, HEAP64, HEAP32 }, 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;
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",
3
+ "version": "3.1.4",
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": "54bb87ba4c9624ec02f60194a2f1938b3f42477b",
41
+ "gitHead": "a7cde6f2a2d3cef27f51f24e9ddadbe5ca05344b",
42
42
  "engines": {
43
43
  "node": ">=20.10.0",
44
44
  "npm": ">=10.2.3"
@@ -52,19 +52,19 @@
52
52
  "wasm-feature-detect": "1.8.0",
53
53
  "ws": "8.18.3",
54
54
  "yargs": "17.7.2",
55
- "@php-wasm/node-polyfills": "3.1.3",
56
- "@php-wasm/universal": "3.1.3",
57
- "@php-wasm/node-8-5": "3.1.3",
58
- "@php-wasm/node-8-4": "3.1.3",
59
- "@php-wasm/node-8-3": "3.1.3",
60
- "@php-wasm/node-8-2": "3.1.3",
61
- "@php-wasm/node-8-1": "3.1.3",
62
- "@php-wasm/node-8-0": "3.1.3",
63
- "@php-wasm/node-7-4": "3.1.3",
64
- "@php-wasm/cli-util": "3.1.3",
65
- "@php-wasm/logger": "3.1.3",
66
- "@php-wasm/util": "3.1.3",
67
- "@wp-playground/common": "3.1.3"
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"
68
68
  },
69
69
  "packageManager": "npm@10.9.2",
70
70
  "overrides": {