@php-wasm/node 0.1.51 → 0.1.58

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
@@ -3551,6 +3551,14 @@ __export(php_8_2_exports, {
3551
3551
  init: () => init
3552
3552
  });
3553
3553
  function init(RuntimeName, PHPLoader) {
3554
+ ExitStatus = class PHPExitStatus extends Error {
3555
+ constructor(status) {
3556
+ super(status);
3557
+ this.name = "ExitStatus";
3558
+ this.message = "Program terminated with exit(" + status + ")";
3559
+ this.status = status;
3560
+ }
3561
+ };
3554
3562
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
3555
3563
  var moduleOverrides = Object.assign({}, Module);
3556
3564
  var arguments_ = [];
@@ -10623,7 +10631,7 @@ function init(RuntimeName, PHPLoader) {
10623
10631
  run();
10624
10632
  DNS.address_map.addrs.localhost = "127.0.0.1";
10625
10633
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
10626
- if (PHPLoader.debug) {
10634
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
10627
10635
  const originalHandleSleep = Asyncify.handleSleep;
10628
10636
  Asyncify.handleSleep = function(startAsync) {
10629
10637
  if (!ABORT) {
@@ -10634,12 +10642,12 @@ function init(RuntimeName, PHPLoader) {
10634
10642
  }
10635
10643
  return PHPLoader;
10636
10644
  }
10637
- var dependenciesTotalSize, dependencyFilename;
10645
+ var dependencyFilename, dependenciesTotalSize;
10638
10646
  var init_php_8_2 = __esm({
10639
10647
  "packages/php-wasm/node/public/php_8_2.js"() {
10640
10648
  "use strict";
10641
- dependenciesTotalSize = 10302665;
10642
10649
  dependencyFilename = __dirname + "/php_8_2.wasm";
10650
+ dependenciesTotalSize = 10303112;
10643
10651
  }
10644
10652
  });
10645
10653
 
@@ -10651,6 +10659,14 @@ __export(php_8_1_exports, {
10651
10659
  init: () => init2
10652
10660
  });
10653
10661
  function init2(RuntimeName, PHPLoader) {
10662
+ ExitStatus = class PHPExitStatus extends Error {
10663
+ constructor(status) {
10664
+ super(status);
10665
+ this.name = "ExitStatus";
10666
+ this.message = "Program terminated with exit(" + status + ")";
10667
+ this.status = status;
10668
+ }
10669
+ };
10654
10670
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
10655
10671
  var moduleOverrides = Object.assign({}, Module);
10656
10672
  var arguments_ = [];
@@ -17718,7 +17734,7 @@ function init2(RuntimeName, PHPLoader) {
17718
17734
  run();
17719
17735
  DNS.address_map.addrs.localhost = "127.0.0.1";
17720
17736
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
17721
- if (PHPLoader.debug) {
17737
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
17722
17738
  const originalHandleSleep = Asyncify.handleSleep;
17723
17739
  Asyncify.handleSleep = function(startAsync) {
17724
17740
  if (!ABORT) {
@@ -17729,12 +17745,12 @@ function init2(RuntimeName, PHPLoader) {
17729
17745
  }
17730
17746
  return PHPLoader;
17731
17747
  }
17732
- var dependenciesTotalSize2, dependencyFilename2;
17748
+ var dependencyFilename2, dependenciesTotalSize2;
17733
17749
  var init_php_8_1 = __esm({
17734
17750
  "packages/php-wasm/node/public/php_8_1.js"() {
17735
17751
  "use strict";
17736
- dependenciesTotalSize2 = 10044311;
17737
17752
  dependencyFilename2 = __dirname + "/php_8_1.wasm";
17753
+ dependenciesTotalSize2 = 10044712;
17738
17754
  }
17739
17755
  });
17740
17756
 
@@ -17746,6 +17762,14 @@ __export(php_8_0_exports, {
17746
17762
  init: () => init3
17747
17763
  });
17748
17764
  function init3(RuntimeName, PHPLoader) {
17765
+ ExitStatus = class PHPExitStatus extends Error {
17766
+ constructor(status) {
17767
+ super(status);
17768
+ this.name = "ExitStatus";
17769
+ this.message = "Program terminated with exit(" + status + ")";
17770
+ this.status = status;
17771
+ }
17772
+ };
17749
17773
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
17750
17774
  var moduleOverrides = Object.assign({}, Module);
17751
17775
  var arguments_ = [];
@@ -24786,7 +24810,7 @@ function init3(RuntimeName, PHPLoader) {
24786
24810
  run();
24787
24811
  DNS.address_map.addrs.localhost = "127.0.0.1";
24788
24812
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
24789
- if (PHPLoader.debug) {
24813
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
24790
24814
  const originalHandleSleep = Asyncify.handleSleep;
24791
24815
  Asyncify.handleSleep = function(startAsync) {
24792
24816
  if (!ABORT) {
@@ -24797,12 +24821,12 @@ function init3(RuntimeName, PHPLoader) {
24797
24821
  }
24798
24822
  return PHPLoader;
24799
24823
  }
24800
- var dependenciesTotalSize3, dependencyFilename3;
24824
+ var dependencyFilename3, dependenciesTotalSize3;
24801
24825
  var init_php_8_0 = __esm({
24802
24826
  "packages/php-wasm/node/public/php_8_0.js"() {
24803
24827
  "use strict";
24804
- dependenciesTotalSize3 = 10172313;
24805
24828
  dependencyFilename3 = __dirname + "/php_8_0.wasm";
24829
+ dependenciesTotalSize3 = 10172733;
24806
24830
  }
24807
24831
  });
24808
24832
 
@@ -24814,6 +24838,14 @@ __export(php_7_4_exports, {
24814
24838
  init: () => init4
24815
24839
  });
24816
24840
  function init4(RuntimeName, PHPLoader) {
24841
+ ExitStatus = class PHPExitStatus extends Error {
24842
+ constructor(status) {
24843
+ super(status);
24844
+ this.name = "ExitStatus";
24845
+ this.message = "Program terminated with exit(" + status + ")";
24846
+ this.status = status;
24847
+ }
24848
+ };
24817
24849
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
24818
24850
  var moduleOverrides = Object.assign({}, Module);
24819
24851
  var arguments_ = [];
@@ -31839,7 +31871,7 @@ function init4(RuntimeName, PHPLoader) {
31839
31871
  run();
31840
31872
  DNS.address_map.addrs.localhost = "127.0.0.1";
31841
31873
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
31842
- if (PHPLoader.debug) {
31874
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
31843
31875
  const originalHandleSleep = Asyncify.handleSleep;
31844
31876
  Asyncify.handleSleep = function(startAsync) {
31845
31877
  if (!ABORT) {
@@ -31850,12 +31882,12 @@ function init4(RuntimeName, PHPLoader) {
31850
31882
  }
31851
31883
  return PHPLoader;
31852
31884
  }
31853
- var dependenciesTotalSize4, dependencyFilename4;
31885
+ var dependencyFilename4, dependenciesTotalSize4;
31854
31886
  var init_php_7_4 = __esm({
31855
31887
  "packages/php-wasm/node/public/php_7_4.js"() {
31856
31888
  "use strict";
31857
- dependenciesTotalSize4 = 11015985;
31858
31889
  dependencyFilename4 = __dirname + "/php_7_4.wasm";
31890
+ dependenciesTotalSize4 = 11016595;
31859
31891
  }
31860
31892
  });
31861
31893
 
@@ -31867,6 +31899,14 @@ __export(php_7_3_exports, {
31867
31899
  init: () => init5
31868
31900
  });
31869
31901
  function init5(RuntimeName, PHPLoader) {
31902
+ ExitStatus = class PHPExitStatus extends Error {
31903
+ constructor(status) {
31904
+ super(status);
31905
+ this.name = "ExitStatus";
31906
+ this.message = "Program terminated with exit(" + status + ")";
31907
+ this.status = status;
31908
+ }
31909
+ };
31870
31910
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
31871
31911
  var moduleOverrides = Object.assign({}, Module);
31872
31912
  var arguments_ = [];
@@ -38885,7 +38925,7 @@ function init5(RuntimeName, PHPLoader) {
38885
38925
  run();
38886
38926
  DNS.address_map.addrs.localhost = "127.0.0.1";
38887
38927
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
38888
- if (PHPLoader.debug) {
38928
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
38889
38929
  const originalHandleSleep = Asyncify.handleSleep;
38890
38930
  Asyncify.handleSleep = function(startAsync) {
38891
38931
  if (!ABORT) {
@@ -38896,12 +38936,12 @@ function init5(RuntimeName, PHPLoader) {
38896
38936
  }
38897
38937
  return PHPLoader;
38898
38938
  }
38899
- var dependenciesTotalSize5, dependencyFilename5;
38939
+ var dependencyFilename5, dependenciesTotalSize5;
38900
38940
  var init_php_7_3 = __esm({
38901
38941
  "packages/php-wasm/node/public/php_7_3.js"() {
38902
38942
  "use strict";
38903
- dependenciesTotalSize5 = 10916038;
38904
38943
  dependencyFilename5 = __dirname + "/php_7_3.wasm";
38944
+ dependenciesTotalSize5 = 10916623;
38905
38945
  }
38906
38946
  });
38907
38947
 
@@ -38913,6 +38953,14 @@ __export(php_7_2_exports, {
38913
38953
  init: () => init6
38914
38954
  });
38915
38955
  function init6(RuntimeName, PHPLoader) {
38956
+ ExitStatus = class PHPExitStatus extends Error {
38957
+ constructor(status) {
38958
+ super(status);
38959
+ this.name = "ExitStatus";
38960
+ this.message = "Program terminated with exit(" + status + ")";
38961
+ this.status = status;
38962
+ }
38963
+ };
38916
38964
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
38917
38965
  var moduleOverrides = Object.assign({}, Module);
38918
38966
  var arguments_ = [];
@@ -45796,7 +45844,7 @@ function init6(RuntimeName, PHPLoader) {
45796
45844
  run();
45797
45845
  DNS.address_map.addrs.localhost = "127.0.0.1";
45798
45846
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
45799
- if (PHPLoader.debug) {
45847
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
45800
45848
  const originalHandleSleep = Asyncify.handleSleep;
45801
45849
  Asyncify.handleSleep = function(startAsync) {
45802
45850
  if (!ABORT) {
@@ -45807,12 +45855,12 @@ function init6(RuntimeName, PHPLoader) {
45807
45855
  }
45808
45856
  return PHPLoader;
45809
45857
  }
45810
- var dependenciesTotalSize6, dependencyFilename6;
45858
+ var dependencyFilename6, dependenciesTotalSize6;
45811
45859
  var init_php_7_2 = __esm({
45812
45860
  "packages/php-wasm/node/public/php_7_2.js"() {
45813
45861
  "use strict";
45814
- dependenciesTotalSize6 = 10992646;
45815
45862
  dependencyFilename6 = __dirname + "/php_7_2.wasm";
45863
+ dependenciesTotalSize6 = 10993354;
45816
45864
  }
45817
45865
  });
45818
45866
 
@@ -45824,6 +45872,14 @@ __export(php_7_1_exports, {
45824
45872
  init: () => init7
45825
45873
  });
45826
45874
  function init7(RuntimeName, PHPLoader) {
45875
+ ExitStatus = class PHPExitStatus extends Error {
45876
+ constructor(status) {
45877
+ super(status);
45878
+ this.name = "ExitStatus";
45879
+ this.message = "Program terminated with exit(" + status + ")";
45880
+ this.status = status;
45881
+ }
45882
+ };
45827
45883
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
45828
45884
  var moduleOverrides = Object.assign({}, Module);
45829
45885
  var arguments_ = [];
@@ -52692,7 +52748,7 @@ function init7(RuntimeName, PHPLoader) {
52692
52748
  run();
52693
52749
  DNS.address_map.addrs.localhost = "127.0.0.1";
52694
52750
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
52695
- if (PHPLoader.debug) {
52751
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
52696
52752
  const originalHandleSleep = Asyncify.handleSleep;
52697
52753
  Asyncify.handleSleep = function(startAsync) {
52698
52754
  if (!ABORT) {
@@ -52703,12 +52759,12 @@ function init7(RuntimeName, PHPLoader) {
52703
52759
  }
52704
52760
  return PHPLoader;
52705
52761
  }
52706
- var dependenciesTotalSize7, dependencyFilename7;
52762
+ var dependencyFilename7, dependenciesTotalSize7;
52707
52763
  var init_php_7_1 = __esm({
52708
52764
  "packages/php-wasm/node/public/php_7_1.js"() {
52709
52765
  "use strict";
52710
- dependenciesTotalSize7 = 10583119;
52711
52766
  dependencyFilename7 = __dirname + "/php_7_1.wasm";
52767
+ dependenciesTotalSize7 = 10583885;
52712
52768
  }
52713
52769
  });
52714
52770
 
@@ -52720,6 +52776,14 @@ __export(php_7_0_exports, {
52720
52776
  init: () => init8
52721
52777
  });
52722
52778
  function init8(RuntimeName, PHPLoader) {
52779
+ ExitStatus = class PHPExitStatus extends Error {
52780
+ constructor(status) {
52781
+ super(status);
52782
+ this.name = "ExitStatus";
52783
+ this.message = "Program terminated with exit(" + status + ")";
52784
+ this.status = status;
52785
+ }
52786
+ };
52723
52787
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
52724
52788
  var moduleOverrides = Object.assign({}, Module);
52725
52789
  var arguments_ = [];
@@ -59602,7 +59666,7 @@ function init8(RuntimeName, PHPLoader) {
59602
59666
  run();
59603
59667
  DNS.address_map.addrs.localhost = "127.0.0.1";
59604
59668
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
59605
- if (PHPLoader.debug) {
59669
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
59606
59670
  const originalHandleSleep = Asyncify.handleSleep;
59607
59671
  Asyncify.handleSleep = function(startAsync) {
59608
59672
  if (!ABORT) {
@@ -59613,12 +59677,12 @@ function init8(RuntimeName, PHPLoader) {
59613
59677
  }
59614
59678
  return PHPLoader;
59615
59679
  }
59616
- var dependenciesTotalSize8, dependencyFilename8;
59680
+ var dependencyFilename8, dependenciesTotalSize8;
59617
59681
  var init_php_7_0 = __esm({
59618
59682
  "packages/php-wasm/node/public/php_7_0.js"() {
59619
59683
  "use strict";
59620
- dependenciesTotalSize8 = 10389492;
59621
59684
  dependencyFilename8 = __dirname + "/php_7_0.wasm";
59685
+ dependenciesTotalSize8 = 10390259;
59622
59686
  }
59623
59687
  });
59624
59688
 
@@ -59630,6 +59694,14 @@ __export(php_5_6_exports, {
59630
59694
  init: () => init9
59631
59695
  });
59632
59696
  function init9(RuntimeName, PHPLoader) {
59697
+ ExitStatus = class PHPExitStatus extends Error {
59698
+ constructor(status) {
59699
+ super(status);
59700
+ this.name = "ExitStatus";
59701
+ this.message = "Program terminated with exit(" + status + ")";
59702
+ this.status = status;
59703
+ }
59704
+ };
59633
59705
  var Module = typeof PHPLoader != "undefined" ? PHPLoader : {};
59634
59706
  var moduleOverrides = Object.assign({}, Module);
59635
59707
  var arguments_ = [];
@@ -66531,7 +66603,7 @@ function init9(RuntimeName, PHPLoader) {
66531
66603
  run();
66532
66604
  DNS.address_map.addrs.localhost = "127.0.0.1";
66533
66605
  PHPLoader.debug = "debug" in PHPLoader ? PHPLoader.debug : true;
66534
- if (PHPLoader.debug) {
66606
+ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
66535
66607
  const originalHandleSleep = Asyncify.handleSleep;
66536
66608
  Asyncify.handleSleep = function(startAsync) {
66537
66609
  if (!ABORT) {
@@ -66542,12 +66614,12 @@ function init9(RuntimeName, PHPLoader) {
66542
66614
  }
66543
66615
  return PHPLoader;
66544
66616
  }
66545
- var dependenciesTotalSize9, dependencyFilename9;
66617
+ var dependencyFilename9, dependenciesTotalSize9;
66546
66618
  var init_php_5_6 = __esm({
66547
66619
  "packages/php-wasm/node/public/php_5_6.js"() {
66548
66620
  "use strict";
66549
- dependenciesTotalSize9 = 10176192;
66550
66621
  dependencyFilename9 = __dirname + "/php_5_6.wasm";
66622
+ dependenciesTotalSize9 = 10176855;
66551
66623
  }
66552
66624
  });
66553
66625
 
@@ -67631,8 +67703,12 @@ var BasePHP2 = class {
67631
67703
  );
67632
67704
  }
67633
67705
  for (const name in headers) {
67706
+ let HTTP_prefix = "HTTP_";
67707
+ if (["content-type", "content-length"].includes(name.toLowerCase())) {
67708
+ HTTP_prefix = "";
67709
+ }
67634
67710
  this.addServerGlobalEntry(
67635
- `HTTP_${name.toUpperCase().replace(/-/g, "_")}`,
67711
+ `${HTTP_prefix}${name.toUpperCase().replace(/-/g, "_")}`,
67636
67712
  headers[name]
67637
67713
  );
67638
67714
  }
@@ -67775,7 +67851,7 @@ var BasePHP2 = class {
67775
67851
  this[__private__dont__use].FS.unlink(path);
67776
67852
  }
67777
67853
  mv(fromPath, toPath) {
67778
- this[__private__dont__use].FS.mv(fromPath, toPath);
67854
+ this[__private__dont__use].FS.rename(fromPath, toPath);
67779
67855
  }
67780
67856
  rmdir(path, options = { recursive: true }) {
67781
67857
  if (options?.recursive) {
@@ -67790,14 +67866,19 @@ var BasePHP2 = class {
67790
67866
  }
67791
67867
  this[__private__dont__use].FS.rmdir(path);
67792
67868
  }
67793
- listFiles(path) {
67869
+ listFiles(path, options = { prependPath: false }) {
67794
67870
  if (!this.fileExists(path)) {
67795
67871
  return [];
67796
67872
  }
67797
67873
  try {
67798
- return this[__private__dont__use].FS.readdir(path).filter(
67874
+ const files = this[__private__dont__use].FS.readdir(path).filter(
67799
67875
  (name) => name !== "." && name !== ".."
67800
67876
  );
67877
+ if (options.prependPath) {
67878
+ const prepend = path.replace(/\/$/, "");
67879
+ return files.map((name) => `${prepend}/${name}`);
67880
+ }
67881
+ return files;
67801
67882
  } catch (e) {
67802
67883
  console.error(e, { path });
67803
67884
  return [];
package/index.d.ts CHANGED
@@ -253,9 +253,10 @@ export interface IsomorphicLocalPHP extends RequestHandler {
253
253
  * Lists the files and directories in the given directory.
254
254
  *
255
255
  * @param path - The directory path to list.
256
+ * @param options - Options for the listing.
256
257
  * @returns The list of files and directories in the given directory.
257
258
  */
258
- listFiles(path: string): string[];
259
+ listFiles(path: string, options?: ListFilesOptions): string[];
259
260
  /**
260
261
  * Checks if a directory exists in the PHP filesystem.
261
262
  *
@@ -426,6 +427,13 @@ export interface RmDirOptions {
426
427
  */
427
428
  recursive?: boolean;
428
429
  }
430
+ export interface ListFilesOptions {
431
+ /**
432
+ * If true, prepend given folder path to all file names.
433
+ * Default: false.
434
+ */
435
+ prependPath: boolean;
436
+ }
429
437
  declare const SupportedPHPVersions: readonly [
430
438
  "8.2",
431
439
  "8.1",
@@ -593,7 +601,7 @@ declare abstract class BasePHP implements IsomorphicLocalPHP {
593
601
  /** @inheritDoc */
594
602
  rmdir(path: string, options?: RmDirOptions): void;
595
603
  /** @inheritDoc */
596
- listFiles(path: string): string[];
604
+ listFiles(path: string, options?: ListFilesOptions): string[];
597
605
  /** @inheritDoc */
598
606
  isDir(path: string): boolean;
599
607
  /** @inheritDoc */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "0.1.51",
3
+ "version": "0.1.58",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,13 +28,13 @@
28
28
  "license": "GPL-2.0-or-later",
29
29
  "main": "index.cjs",
30
30
  "types": "index.d.ts",
31
- "gitHead": "756f9e316b51bc1496982fa4ed9310a16701afa5",
31
+ "gitHead": "dbc77ed4c0b0a2625cfbe08722fade036c69a425",
32
32
  "dependencies": {
33
33
  "comlink": "^4.4.1",
34
34
  "express": "4.18.2",
35
35
  "ws": "8.13.0",
36
36
  "yargs": "17.7.2",
37
- "@php-wasm/universal": "0.1.51",
38
- "@php-wasm/util": "0.1.51"
37
+ "@php-wasm/universal": "0.1.58",
38
+ "@php-wasm/util": "0.1.58"
39
39
  }
40
40
  }
package/php_5_6.wasm CHANGED
Binary file
package/php_7_0.wasm CHANGED
Binary file
package/php_7_1.wasm CHANGED
Binary file
package/php_7_2.wasm CHANGED
Binary file
package/php_7_3.wasm CHANGED
Binary file
package/php_7_4.wasm CHANGED
Binary file
package/php_8_0.wasm CHANGED
Binary file
package/php_8_1.wasm CHANGED
Binary file
package/php_8_2.wasm CHANGED
Binary file