@php-wasm/node 1.1.4 → 1.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.
package/index.js CHANGED
@@ -4497,9 +4497,24 @@ function init(RuntimeName, PHPLoader) {
4497
4497
  var allocateUTF8OnStack = stringToUTF8OnStack;
4498
4498
  var PHPWASM = {
4499
4499
  init: function() {
4500
+ Module["ENV"] = Module["ENV"] || {};
4501
+ Module["ENV"]["PATH"] = [
4502
+ Module["ENV"]["PATH"],
4503
+ "/internal/shared/bin"
4504
+ ].filter(Boolean).join(":");
4500
4505
  FS.mkdir("/internal");
4501
4506
  FS.mkdir("/internal/shared");
4502
4507
  FS.mkdir("/internal/shared/preload");
4508
+ FS.mkdir("/internal/shared/bin");
4509
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
4510
+ Module["onRuntimeInitialized"] = () => {
4511
+ FS.writeFile(
4512
+ "/internal/shared/bin/php",
4513
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
4514
+ );
4515
+ FS.chmod("/internal/shared/bin/php", 493);
4516
+ originalOnRuntimeInitialized();
4517
+ };
4503
4518
  FS.registerDevice(FS.makedev(64, 0), {
4504
4519
  open: () => {
4505
4520
  },
@@ -4859,12 +4874,19 @@ function init(RuntimeName, PHPLoader) {
4859
4874
  if (node?.isSharedFS) {
4860
4875
  return true;
4861
4876
  }
4862
- if (!node?.mount?.opts?.fs?.lookupPath) {
4877
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
4878
+ return false;
4879
+ }
4880
+ if (node.mount.type !== NODEFS) {
4881
+ return false;
4882
+ }
4883
+ const vfsPath = node.mount.type.realPath(node);
4884
+ try {
4885
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
4886
+ return !!underlyingNode?.isSharedFS;
4887
+ } catch (e) {
4863
4888
  return false;
4864
4889
  }
4865
- const vfsPath = NODEFS.realPath(node);
4866
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
4867
- return !!underlyingNode?.isSharedFS;
4868
4890
  },
4869
4891
  is_path_to_shared_fs(path17) {
4870
4892
  const { node } = FS.lookupPath(path17);
@@ -12556,9 +12578,24 @@ function init2(RuntimeName, PHPLoader) {
12556
12578
  var allocateUTF8OnStack = stringToUTF8OnStack;
12557
12579
  var PHPWASM = {
12558
12580
  init: function() {
12581
+ Module["ENV"] = Module["ENV"] || {};
12582
+ Module["ENV"]["PATH"] = [
12583
+ Module["ENV"]["PATH"],
12584
+ "/internal/shared/bin"
12585
+ ].filter(Boolean).join(":");
12559
12586
  FS.mkdir("/internal");
12560
12587
  FS.mkdir("/internal/shared");
12561
12588
  FS.mkdir("/internal/shared/preload");
12589
+ FS.mkdir("/internal/shared/bin");
12590
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
12591
+ Module["onRuntimeInitialized"] = () => {
12592
+ FS.writeFile(
12593
+ "/internal/shared/bin/php",
12594
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
12595
+ );
12596
+ FS.chmod("/internal/shared/bin/php", 493);
12597
+ originalOnRuntimeInitialized();
12598
+ };
12562
12599
  FS.registerDevice(FS.makedev(64, 0), {
12563
12600
  open: () => {
12564
12601
  },
@@ -12918,12 +12955,19 @@ function init2(RuntimeName, PHPLoader) {
12918
12955
  if (node?.isSharedFS) {
12919
12956
  return true;
12920
12957
  }
12921
- if (!node?.mount?.opts?.fs?.lookupPath) {
12958
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
12959
+ return false;
12960
+ }
12961
+ if (node.mount.type !== NODEFS) {
12962
+ return false;
12963
+ }
12964
+ const vfsPath = node.mount.type.realPath(node);
12965
+ try {
12966
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
12967
+ return !!underlyingNode?.isSharedFS;
12968
+ } catch (e) {
12922
12969
  return false;
12923
12970
  }
12924
- const vfsPath = NODEFS.realPath(node);
12925
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
12926
- return !!underlyingNode?.isSharedFS;
12927
12971
  },
12928
12972
  is_path_to_shared_fs(path17) {
12929
12973
  const { node } = FS.lookupPath(path17);
@@ -20615,9 +20659,24 @@ function init3(RuntimeName, PHPLoader) {
20615
20659
  var allocateUTF8OnStack = stringToUTF8OnStack;
20616
20660
  var PHPWASM = {
20617
20661
  init: function() {
20662
+ Module["ENV"] = Module["ENV"] || {};
20663
+ Module["ENV"]["PATH"] = [
20664
+ Module["ENV"]["PATH"],
20665
+ "/internal/shared/bin"
20666
+ ].filter(Boolean).join(":");
20618
20667
  FS.mkdir("/internal");
20619
20668
  FS.mkdir("/internal/shared");
20620
20669
  FS.mkdir("/internal/shared/preload");
20670
+ FS.mkdir("/internal/shared/bin");
20671
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
20672
+ Module["onRuntimeInitialized"] = () => {
20673
+ FS.writeFile(
20674
+ "/internal/shared/bin/php",
20675
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
20676
+ );
20677
+ FS.chmod("/internal/shared/bin/php", 493);
20678
+ originalOnRuntimeInitialized();
20679
+ };
20621
20680
  FS.registerDevice(FS.makedev(64, 0), {
20622
20681
  open: () => {
20623
20682
  },
@@ -20977,12 +21036,19 @@ function init3(RuntimeName, PHPLoader) {
20977
21036
  if (node?.isSharedFS) {
20978
21037
  return true;
20979
21038
  }
20980
- if (!node?.mount?.opts?.fs?.lookupPath) {
21039
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
21040
+ return false;
21041
+ }
21042
+ if (node.mount.type !== NODEFS) {
21043
+ return false;
21044
+ }
21045
+ const vfsPath = node.mount.type.realPath(node);
21046
+ try {
21047
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
21048
+ return !!underlyingNode?.isSharedFS;
21049
+ } catch (e) {
20981
21050
  return false;
20982
21051
  }
20983
- const vfsPath = NODEFS.realPath(node);
20984
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
20985
- return !!underlyingNode?.isSharedFS;
20986
21052
  },
20987
21053
  is_path_to_shared_fs(path17) {
20988
21054
  const { node } = FS.lookupPath(path17);
@@ -28674,9 +28740,24 @@ function init4(RuntimeName, PHPLoader) {
28674
28740
  var allocateUTF8OnStack = stringToUTF8OnStack;
28675
28741
  var PHPWASM = {
28676
28742
  init: function() {
28743
+ Module["ENV"] = Module["ENV"] || {};
28744
+ Module["ENV"]["PATH"] = [
28745
+ Module["ENV"]["PATH"],
28746
+ "/internal/shared/bin"
28747
+ ].filter(Boolean).join(":");
28677
28748
  FS.mkdir("/internal");
28678
28749
  FS.mkdir("/internal/shared");
28679
28750
  FS.mkdir("/internal/shared/preload");
28751
+ FS.mkdir("/internal/shared/bin");
28752
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
28753
+ Module["onRuntimeInitialized"] = () => {
28754
+ FS.writeFile(
28755
+ "/internal/shared/bin/php",
28756
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
28757
+ );
28758
+ FS.chmod("/internal/shared/bin/php", 493);
28759
+ originalOnRuntimeInitialized();
28760
+ };
28680
28761
  FS.registerDevice(FS.makedev(64, 0), {
28681
28762
  open: () => {
28682
28763
  },
@@ -29036,12 +29117,19 @@ function init4(RuntimeName, PHPLoader) {
29036
29117
  if (node?.isSharedFS) {
29037
29118
  return true;
29038
29119
  }
29039
- if (!node?.mount?.opts?.fs?.lookupPath) {
29120
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
29121
+ return false;
29122
+ }
29123
+ if (node.mount.type !== NODEFS) {
29124
+ return false;
29125
+ }
29126
+ const vfsPath = node.mount.type.realPath(node);
29127
+ try {
29128
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
29129
+ return !!underlyingNode?.isSharedFS;
29130
+ } catch (e) {
29040
29131
  return false;
29041
29132
  }
29042
- const vfsPath = NODEFS.realPath(node);
29043
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
29044
- return !!underlyingNode?.isSharedFS;
29045
29133
  },
29046
29134
  is_path_to_shared_fs(path17) {
29047
29135
  const { node } = FS.lookupPath(path17);
@@ -36730,9 +36818,24 @@ function init5(RuntimeName, PHPLoader) {
36730
36818
  var allocateUTF8OnStack = stringToUTF8OnStack;
36731
36819
  var PHPWASM = {
36732
36820
  init: function() {
36821
+ Module["ENV"] = Module["ENV"] || {};
36822
+ Module["ENV"]["PATH"] = [
36823
+ Module["ENV"]["PATH"],
36824
+ "/internal/shared/bin"
36825
+ ].filter(Boolean).join(":");
36733
36826
  FS.mkdir("/internal");
36734
36827
  FS.mkdir("/internal/shared");
36735
36828
  FS.mkdir("/internal/shared/preload");
36829
+ FS.mkdir("/internal/shared/bin");
36830
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
36831
+ Module["onRuntimeInitialized"] = () => {
36832
+ FS.writeFile(
36833
+ "/internal/shared/bin/php",
36834
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
36835
+ );
36836
+ FS.chmod("/internal/shared/bin/php", 493);
36837
+ originalOnRuntimeInitialized();
36838
+ };
36736
36839
  FS.registerDevice(FS.makedev(64, 0), {
36737
36840
  open: () => {
36738
36841
  },
@@ -37092,12 +37195,19 @@ function init5(RuntimeName, PHPLoader) {
37092
37195
  if (node?.isSharedFS) {
37093
37196
  return true;
37094
37197
  }
37095
- if (!node?.mount?.opts?.fs?.lookupPath) {
37198
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
37199
+ return false;
37200
+ }
37201
+ if (node.mount.type !== NODEFS) {
37202
+ return false;
37203
+ }
37204
+ const vfsPath = node.mount.type.realPath(node);
37205
+ try {
37206
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
37207
+ return !!underlyingNode?.isSharedFS;
37208
+ } catch (e) {
37096
37209
  return false;
37097
37210
  }
37098
- const vfsPath = NODEFS.realPath(node);
37099
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
37100
- return !!underlyingNode?.isSharedFS;
37101
37211
  },
37102
37212
  is_path_to_shared_fs(path17) {
37103
37213
  const { node } = FS.lookupPath(path17);
@@ -44738,9 +44848,24 @@ function init6(RuntimeName, PHPLoader) {
44738
44848
  var allocateUTF8OnStack = stringToUTF8OnStack;
44739
44849
  var PHPWASM = {
44740
44850
  init: function() {
44851
+ Module["ENV"] = Module["ENV"] || {};
44852
+ Module["ENV"]["PATH"] = [
44853
+ Module["ENV"]["PATH"],
44854
+ "/internal/shared/bin"
44855
+ ].filter(Boolean).join(":");
44741
44856
  FS.mkdir("/internal");
44742
44857
  FS.mkdir("/internal/shared");
44743
44858
  FS.mkdir("/internal/shared/preload");
44859
+ FS.mkdir("/internal/shared/bin");
44860
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
44861
+ Module["onRuntimeInitialized"] = () => {
44862
+ FS.writeFile(
44863
+ "/internal/shared/bin/php",
44864
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
44865
+ );
44866
+ FS.chmod("/internal/shared/bin/php", 493);
44867
+ originalOnRuntimeInitialized();
44868
+ };
44744
44869
  FS.registerDevice(FS.makedev(64, 0), {
44745
44870
  open: () => {
44746
44871
  },
@@ -45100,12 +45225,19 @@ function init6(RuntimeName, PHPLoader) {
45100
45225
  if (node?.isSharedFS) {
45101
45226
  return true;
45102
45227
  }
45103
- if (!node?.mount?.opts?.fs?.lookupPath) {
45228
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
45229
+ return false;
45230
+ }
45231
+ if (node.mount.type !== NODEFS) {
45232
+ return false;
45233
+ }
45234
+ const vfsPath = node.mount.type.realPath(node);
45235
+ try {
45236
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
45237
+ return !!underlyingNode?.isSharedFS;
45238
+ } catch (e) {
45104
45239
  return false;
45105
45240
  }
45106
- const vfsPath = NODEFS.realPath(node);
45107
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
45108
- return !!underlyingNode?.isSharedFS;
45109
45241
  },
45110
45242
  is_path_to_shared_fs(path17) {
45111
45243
  const { node } = FS.lookupPath(path17);
@@ -52750,9 +52882,24 @@ function init7(RuntimeName, PHPLoader) {
52750
52882
  var allocateUTF8OnStack = stringToUTF8OnStack;
52751
52883
  var PHPWASM = {
52752
52884
  init: function() {
52885
+ Module["ENV"] = Module["ENV"] || {};
52886
+ Module["ENV"]["PATH"] = [
52887
+ Module["ENV"]["PATH"],
52888
+ "/internal/shared/bin"
52889
+ ].filter(Boolean).join(":");
52753
52890
  FS.mkdir("/internal");
52754
52891
  FS.mkdir("/internal/shared");
52755
52892
  FS.mkdir("/internal/shared/preload");
52893
+ FS.mkdir("/internal/shared/bin");
52894
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
52895
+ Module["onRuntimeInitialized"] = () => {
52896
+ FS.writeFile(
52897
+ "/internal/shared/bin/php",
52898
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
52899
+ );
52900
+ FS.chmod("/internal/shared/bin/php", 493);
52901
+ originalOnRuntimeInitialized();
52902
+ };
52756
52903
  FS.registerDevice(FS.makedev(64, 0), {
52757
52904
  open: () => {
52758
52905
  },
@@ -53112,12 +53259,19 @@ function init7(RuntimeName, PHPLoader) {
53112
53259
  if (node?.isSharedFS) {
53113
53260
  return true;
53114
53261
  }
53115
- if (!node?.mount?.opts?.fs?.lookupPath) {
53262
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
53263
+ return false;
53264
+ }
53265
+ if (node.mount.type !== NODEFS) {
53266
+ return false;
53267
+ }
53268
+ const vfsPath = node.mount.type.realPath(node);
53269
+ try {
53270
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
53271
+ return !!underlyingNode?.isSharedFS;
53272
+ } catch (e) {
53116
53273
  return false;
53117
53274
  }
53118
- const vfsPath = NODEFS.realPath(node);
53119
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
53120
- return !!underlyingNode?.isSharedFS;
53121
53275
  },
53122
53276
  is_path_to_shared_fs(path17) {
53123
53277
  const { node } = FS.lookupPath(path17);
@@ -60757,9 +60911,24 @@ function init8(RuntimeName, PHPLoader) {
60757
60911
  var allocateUTF8OnStack = stringToUTF8OnStack;
60758
60912
  var PHPWASM = {
60759
60913
  init: function() {
60914
+ Module["ENV"] = Module["ENV"] || {};
60915
+ Module["ENV"]["PATH"] = [
60916
+ Module["ENV"]["PATH"],
60917
+ "/internal/shared/bin"
60918
+ ].filter(Boolean).join(":");
60760
60919
  FS.mkdir("/internal");
60761
60920
  FS.mkdir("/internal/shared");
60762
60921
  FS.mkdir("/internal/shared/preload");
60922
+ FS.mkdir("/internal/shared/bin");
60923
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
60924
+ Module["onRuntimeInitialized"] = () => {
60925
+ FS.writeFile(
60926
+ "/internal/shared/bin/php",
60927
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
60928
+ );
60929
+ FS.chmod("/internal/shared/bin/php", 493);
60930
+ originalOnRuntimeInitialized();
60931
+ };
60763
60932
  FS.registerDevice(FS.makedev(64, 0), {
60764
60933
  open: () => {
60765
60934
  },
@@ -61119,12 +61288,19 @@ function init8(RuntimeName, PHPLoader) {
61119
61288
  if (node?.isSharedFS) {
61120
61289
  return true;
61121
61290
  }
61122
- if (!node?.mount?.opts?.fs?.lookupPath) {
61291
+ if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
61292
+ return false;
61293
+ }
61294
+ if (node.mount.type !== NODEFS) {
61295
+ return false;
61296
+ }
61297
+ const vfsPath = node.mount.type.realPath(node);
61298
+ try {
61299
+ const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
61300
+ return !!underlyingNode?.isSharedFS;
61301
+ } catch (e) {
61123
61302
  return false;
61124
61303
  }
61125
- const vfsPath = NODEFS.realPath(node);
61126
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
61127
- return !!underlyingNode?.isSharedFS;
61128
61304
  },
61129
61305
  is_path_to_shared_fs(path17) {
61130
61306
  const { node } = FS.lookupPath(path17);
@@ -70377,9 +70553,24 @@ function init9(RuntimeName, PHPLoader) {
70377
70553
  }
70378
70554
  var PHPWASM = {
70379
70555
  init: function() {
70556
+ Module["ENV"] = Module["ENV"] || {};
70557
+ Module["ENV"]["PATH"] = [
70558
+ Module["ENV"]["PATH"],
70559
+ "/internal/shared/bin"
70560
+ ].filter(Boolean).join(":");
70380
70561
  FS.mkdir("/internal");
70381
70562
  FS.mkdir("/internal/shared");
70382
70563
  FS.mkdir("/internal/shared/preload");
70564
+ FS.mkdir("/internal/shared/bin");
70565
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
70566
+ Module["onRuntimeInitialized"] = () => {
70567
+ FS.writeFile(
70568
+ "/internal/shared/bin/php",
70569
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
70570
+ );
70571
+ FS.chmod("/internal/shared/bin/php", 493);
70572
+ originalOnRuntimeInitialized();
70573
+ };
70383
70574
  FS.registerDevice(FS.makedev(64, 0), {
70384
70575
  open: () => {
70385
70576
  },
@@ -78630,9 +78821,24 @@ function init10(RuntimeName, PHPLoader) {
78630
78821
  }
78631
78822
  var PHPWASM = {
78632
78823
  init: function() {
78824
+ Module["ENV"] = Module["ENV"] || {};
78825
+ Module["ENV"]["PATH"] = [
78826
+ Module["ENV"]["PATH"],
78827
+ "/internal/shared/bin"
78828
+ ].filter(Boolean).join(":");
78633
78829
  FS.mkdir("/internal");
78634
78830
  FS.mkdir("/internal/shared");
78635
78831
  FS.mkdir("/internal/shared/preload");
78832
+ FS.mkdir("/internal/shared/bin");
78833
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
78834
+ Module["onRuntimeInitialized"] = () => {
78835
+ FS.writeFile(
78836
+ "/internal/shared/bin/php",
78837
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
78838
+ );
78839
+ FS.chmod("/internal/shared/bin/php", 493);
78840
+ originalOnRuntimeInitialized();
78841
+ };
78636
78842
  FS.registerDevice(FS.makedev(64, 0), {
78637
78843
  open: () => {
78638
78844
  },
@@ -86905,9 +87111,24 @@ function init11(RuntimeName, PHPLoader) {
86905
87111
  }
86906
87112
  var PHPWASM = {
86907
87113
  init: function() {
87114
+ Module["ENV"] = Module["ENV"] || {};
87115
+ Module["ENV"]["PATH"] = [
87116
+ Module["ENV"]["PATH"],
87117
+ "/internal/shared/bin"
87118
+ ].filter(Boolean).join(":");
86908
87119
  FS.mkdir("/internal");
86909
87120
  FS.mkdir("/internal/shared");
86910
87121
  FS.mkdir("/internal/shared/preload");
87122
+ FS.mkdir("/internal/shared/bin");
87123
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
87124
+ Module["onRuntimeInitialized"] = () => {
87125
+ FS.writeFile(
87126
+ "/internal/shared/bin/php",
87127
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
87128
+ );
87129
+ FS.chmod("/internal/shared/bin/php", 493);
87130
+ originalOnRuntimeInitialized();
87131
+ };
86911
87132
  FS.registerDevice(FS.makedev(64, 0), {
86912
87133
  open: () => {
86913
87134
  },
@@ -95179,9 +95400,24 @@ function init12(RuntimeName, PHPLoader) {
95179
95400
  }
95180
95401
  var PHPWASM = {
95181
95402
  init: function() {
95403
+ Module["ENV"] = Module["ENV"] || {};
95404
+ Module["ENV"]["PATH"] = [
95405
+ Module["ENV"]["PATH"],
95406
+ "/internal/shared/bin"
95407
+ ].filter(Boolean).join(":");
95182
95408
  FS.mkdir("/internal");
95183
95409
  FS.mkdir("/internal/shared");
95184
95410
  FS.mkdir("/internal/shared/preload");
95411
+ FS.mkdir("/internal/shared/bin");
95412
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
95413
+ Module["onRuntimeInitialized"] = () => {
95414
+ FS.writeFile(
95415
+ "/internal/shared/bin/php",
95416
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
95417
+ );
95418
+ FS.chmod("/internal/shared/bin/php", 493);
95419
+ originalOnRuntimeInitialized();
95420
+ };
95185
95421
  FS.registerDevice(FS.makedev(64, 0), {
95186
95422
  open: () => {
95187
95423
  },
@@ -103426,9 +103662,24 @@ function init13(RuntimeName, PHPLoader) {
103426
103662
  }
103427
103663
  var PHPWASM = {
103428
103664
  init: function() {
103665
+ Module["ENV"] = Module["ENV"] || {};
103666
+ Module["ENV"]["PATH"] = [
103667
+ Module["ENV"]["PATH"],
103668
+ "/internal/shared/bin"
103669
+ ].filter(Boolean).join(":");
103429
103670
  FS.mkdir("/internal");
103430
103671
  FS.mkdir("/internal/shared");
103431
103672
  FS.mkdir("/internal/shared/preload");
103673
+ FS.mkdir("/internal/shared/bin");
103674
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
103675
+ Module["onRuntimeInitialized"] = () => {
103676
+ FS.writeFile(
103677
+ "/internal/shared/bin/php",
103678
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
103679
+ );
103680
+ FS.chmod("/internal/shared/bin/php", 493);
103681
+ originalOnRuntimeInitialized();
103682
+ };
103432
103683
  FS.registerDevice(FS.makedev(64, 0), {
103433
103684
  open: () => {
103434
103685
  },
@@ -111664,9 +111915,24 @@ function init14(RuntimeName, PHPLoader) {
111664
111915
  }
111665
111916
  var PHPWASM = {
111666
111917
  init: function() {
111918
+ Module["ENV"] = Module["ENV"] || {};
111919
+ Module["ENV"]["PATH"] = [
111920
+ Module["ENV"]["PATH"],
111921
+ "/internal/shared/bin"
111922
+ ].filter(Boolean).join(":");
111667
111923
  FS.mkdir("/internal");
111668
111924
  FS.mkdir("/internal/shared");
111669
111925
  FS.mkdir("/internal/shared/preload");
111926
+ FS.mkdir("/internal/shared/bin");
111927
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
111928
+ Module["onRuntimeInitialized"] = () => {
111929
+ FS.writeFile(
111930
+ "/internal/shared/bin/php",
111931
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
111932
+ );
111933
+ FS.chmod("/internal/shared/bin/php", 493);
111934
+ originalOnRuntimeInitialized();
111935
+ };
111670
111936
  FS.registerDevice(FS.makedev(64, 0), {
111671
111937
  open: () => {
111672
111938
  },
@@ -119864,9 +120130,24 @@ function init15(RuntimeName, PHPLoader) {
119864
120130
  }
119865
120131
  var PHPWASM = {
119866
120132
  init: function() {
120133
+ Module["ENV"] = Module["ENV"] || {};
120134
+ Module["ENV"]["PATH"] = [
120135
+ Module["ENV"]["PATH"],
120136
+ "/internal/shared/bin"
120137
+ ].filter(Boolean).join(":");
119867
120138
  FS.mkdir("/internal");
119868
120139
  FS.mkdir("/internal/shared");
119869
120140
  FS.mkdir("/internal/shared/preload");
120141
+ FS.mkdir("/internal/shared/bin");
120142
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
120143
+ Module["onRuntimeInitialized"] = () => {
120144
+ FS.writeFile(
120145
+ "/internal/shared/bin/php",
120146
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
120147
+ );
120148
+ FS.chmod("/internal/shared/bin/php", 493);
120149
+ originalOnRuntimeInitialized();
120150
+ };
119870
120151
  FS.registerDevice(FS.makedev(64, 0), {
119871
120152
  open: () => {
119872
120153
  },
@@ -128059,9 +128340,24 @@ function init16(RuntimeName, PHPLoader) {
128059
128340
  }
128060
128341
  var PHPWASM = {
128061
128342
  init: function() {
128343
+ Module["ENV"] = Module["ENV"] || {};
128344
+ Module["ENV"]["PATH"] = [
128345
+ Module["ENV"]["PATH"],
128346
+ "/internal/shared/bin"
128347
+ ].filter(Boolean).join(":");
128062
128348
  FS.mkdir("/internal");
128063
128349
  FS.mkdir("/internal/shared");
128064
128350
  FS.mkdir("/internal/shared/preload");
128351
+ FS.mkdir("/internal/shared/bin");
128352
+ const originalOnRuntimeInitialized = Module["onRuntimeInitialized"];
128353
+ Module["onRuntimeInitialized"] = () => {
128354
+ FS.writeFile(
128355
+ "/internal/shared/bin/php",
128356
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
128357
+ );
128358
+ FS.chmod("/internal/shared/bin/php", 493);
128359
+ originalOnRuntimeInitialized();
128360
+ };
128065
128361
  FS.registerDevice(FS.makedev(64, 0), {
128066
128362
  open: () => {
128067
128363
  },
package/jspi/php_7_2.js CHANGED
@@ -5227,6 +5227,15 @@ export function init(RuntimeName, PHPLoader) {
5227
5227
 
5228
5228
  var PHPWASM = {
5229
5229
  init: function () {
5230
+ Module['ENV'] = Module['ENV'] || {};
5231
+ // Ensure a platform-level bin directory for a fallback `php` binary.
5232
+ Module['ENV']['PATH'] = [
5233
+ Module['ENV']['PATH'],
5234
+ '/internal/shared/bin',
5235
+ ]
5236
+ .filter(Boolean)
5237
+ .join(':');
5238
+
5230
5239
  // The /internal directory is required by the C module. It's where the
5231
5240
  // stdout, stderr, and headers information are written for the JavaScript
5232
5241
  // code to read later on.
@@ -5237,6 +5246,20 @@ export function init(RuntimeName, PHPLoader) {
5237
5246
  // The files from the preload directory are preloaded using the
5238
5247
  // auto_prepend_file php.ini directive.
5239
5248
  FS.mkdir('/internal/shared/preload');
5249
+ // Platform-level bin directory for a fallback `php` binary. Without it,
5250
+ // PHP may not populate the PHP_BINARY constant.
5251
+ FS.mkdir('/internal/shared/bin');
5252
+ const originalOnRuntimeInitialized = Module['onRuntimeInitialized'];
5253
+ Module['onRuntimeInitialized'] = () => {
5254
+ // Dummy PHP binary for PHP to populate the PHP_BINARY constant.
5255
+ FS.writeFile(
5256
+ '/internal/shared/bin/php',
5257
+ new TextEncoder().encode('#!/bin/sh\nphp "$@"')
5258
+ );
5259
+ // It must be executable to be used by PHP.
5260
+ FS.chmod('/internal/shared/bin/php', 0o755);
5261
+ originalOnRuntimeInitialized();
5262
+ };
5240
5263
  // Create stdout and stderr devices. We can't just use Emscripten's
5241
5264
  // default stdout and stderr devices because they stop processing data
5242
5265
  // on the first null byte. However, when dealing with binary data,
@@ -5636,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
5636
5659
  if (node?.isSharedFS) {
5637
5660
  return true;
5638
5661
  }
5662
+
5639
5663
  // Handle PROXYFS nodes which wrap other nodes.
5640
- if (!node?.mount?.opts?.fs?.lookupPath) {
5664
+ if (
5665
+ !node?.mount?.opts?.fs?.lookupPath ||
5666
+ !node?.mount?.type?.realPath
5667
+ ) {
5668
+ return false;
5669
+ }
5670
+
5671
+ // Only NODEFS can be shared between workers at the moment.
5672
+ if (node.mount.type !== NODEFS) {
5673
+ return false;
5674
+ }
5675
+ const vfsPath = node.mount.type.realPath(node);
5676
+ try {
5677
+ const underlyingNode =
5678
+ node.mount.opts.fs.lookupPath(vfsPath)?.node;
5679
+ return !!underlyingNode?.isSharedFS;
5680
+ } catch (e) {
5641
5681
  return false;
5642
5682
  }
5643
- const vfsPath = NODEFS.realPath(node);
5644
- const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
5645
- return !!underlyingNode?.isSharedFS;
5646
5683
  },
5647
5684
  is_path_to_shared_fs(path) {
5648
5685
  const { node } = FS.lookupPath(path);