@php-wasm/node 0.6.14 → 0.6.16

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/index.cjs CHANGED
@@ -11169,7 +11169,7 @@ var init_php_8_3 = __esm({
11169
11169
  "packages/php-wasm/node/public/php_8_3.js"() {
11170
11170
  "use strict";
11171
11171
  dependencyFilename = __dirname + "/8_3_0/php_8_3.wasm";
11172
- dependenciesTotalSize = 14212810;
11172
+ dependenciesTotalSize = 14212793;
11173
11173
  }
11174
11174
  });
11175
11175
 
@@ -26424,7 +26424,7 @@ var init_php_8_1 = __esm({
26424
26424
  "packages/php-wasm/node/public/php_8_1.js"() {
26425
26425
  "use strict";
26426
26426
  dependencyFilename3 = __dirname + "/8_1_23/php_8_1.wasm";
26427
- dependenciesTotalSize3 = 13575986;
26427
+ dependenciesTotalSize3 = 13575971;
26428
26428
  }
26429
26429
  });
26430
26430
 
@@ -34022,7 +34022,7 @@ var init_php_8_0 = __esm({
34022
34022
  "packages/php-wasm/node/public/php_8_0.js"() {
34023
34023
  "use strict";
34024
34024
  dependencyFilename4 = __dirname + "/8_0_30/php_8_0.wasm";
34025
- dependenciesTotalSize4 = 13597816;
34025
+ dependenciesTotalSize4 = 13597709;
34026
34026
  }
34027
34027
  });
34028
34028
 
@@ -41605,7 +41605,7 @@ var init_php_7_4 = __esm({
41605
41605
  "packages/php-wasm/node/public/php_7_4.js"() {
41606
41606
  "use strict";
41607
41607
  dependencyFilename5 = __dirname + "/7_4_33/php_7_4.wasm";
41608
- dependenciesTotalSize5 = 14331012;
41608
+ dependenciesTotalSize5 = 14331074;
41609
41609
  }
41610
41610
  });
41611
41611
 
@@ -49183,7 +49183,7 @@ var init_php_7_3 = __esm({
49183
49183
  "packages/php-wasm/node/public/php_7_3.js"() {
49184
49184
  "use strict";
49185
49185
  dependencyFilename6 = __dirname + "/7_3_33/php_7_3.wasm";
49186
- dependenciesTotalSize6 = 14098611;
49186
+ dependenciesTotalSize6 = 14098607;
49187
49187
  }
49188
49188
  });
49189
49189
 
@@ -56629,7 +56629,7 @@ var init_php_7_2 = __esm({
56629
56629
  "packages/php-wasm/node/public/php_7_2.js"() {
56630
56630
  "use strict";
56631
56631
  dependencyFilename7 = __dirname + "/7_2_34/php_7_2.wasm";
56632
- dependenciesTotalSize7 = 13992133;
56632
+ dependenciesTotalSize7 = 13992092;
56633
56633
  }
56634
56634
  });
56635
56635
 
@@ -64060,7 +64060,7 @@ var init_php_7_1 = __esm({
64060
64060
  "packages/php-wasm/node/public/php_7_1.js"() {
64061
64061
  "use strict";
64062
64062
  dependencyFilename8 = __dirname + "/7_1_30/php_7_1.wasm";
64063
- dependenciesTotalSize8 = 13301175;
64063
+ dependenciesTotalSize8 = 13300912;
64064
64064
  }
64065
64065
  });
64066
64066
 
@@ -71505,7 +71505,7 @@ var init_php_7_0 = __esm({
71505
71505
  "packages/php-wasm/node/public/php_7_0.js"() {
71506
71506
  "use strict";
71507
71507
  dependencyFilename9 = __dirname + "/7_0_33/php_7_0.wasm";
71508
- dependenciesTotalSize9 = 12778840;
71508
+ dependenciesTotalSize9 = 12778913;
71509
71509
  }
71510
71510
  });
71511
71511
 
@@ -72377,10 +72377,13 @@ var PHPRequestHandler = class {
72377
72377
  isAbsolute ? void 0 : DEFAULT_BASE_URL
72378
72378
  );
72379
72379
  const normalizedRequestedPath = applyRewriteRules(
72380
- removePathPrefix(requestedUrl.pathname, this.#PATHNAME),
72380
+ removePathPrefix(
72381
+ decodeURIComponent(requestedUrl.pathname),
72382
+ this.#PATHNAME
72383
+ ),
72381
72384
  this.rewriteRules
72382
72385
  );
72383
- const fsPath = `${this.#DOCROOT}${normalizedRequestedPath}`;
72386
+ const fsPath = joinPaths(this.#DOCROOT, normalizedRequestedPath);
72384
72387
  if (seemsLikeAPHPRequestHandlerPath(fsPath)) {
72385
72388
  return await this.#dispatchToPHP(request, requestedUrl);
72386
72389
  }
@@ -72459,7 +72462,9 @@ var PHPRequestHandler = class {
72459
72462
  }
72460
72463
  let scriptPath;
72461
72464
  try {
72462
- scriptPath = this.#resolvePHPFilePath(requestedUrl.pathname);
72465
+ scriptPath = this.#resolvePHPFilePath(
72466
+ decodeURIComponent(requestedUrl.pathname)
72467
+ );
72463
72468
  } catch (error) {
72464
72469
  return new PHPResponse(
72465
72470
  404,
@@ -72467,17 +72472,25 @@ var PHPRequestHandler = class {
72467
72472
  new TextEncoder().encode("404 File not found")
72468
72473
  );
72469
72474
  }
72470
- return await this.php.run({
72471
- relativeUri: ensurePathPrefix(
72472
- toRelativeUrl(requestedUrl),
72473
- this.#PATHNAME
72474
- ),
72475
- protocol: this.#PROTOCOL,
72476
- method: request.method || preferredMethod,
72477
- body,
72478
- scriptPath,
72479
- headers
72480
- });
72475
+ try {
72476
+ return await this.php.run({
72477
+ relativeUri: ensurePathPrefix(
72478
+ toRelativeUrl(requestedUrl),
72479
+ this.#PATHNAME
72480
+ ),
72481
+ protocol: this.#PROTOCOL,
72482
+ method: request.method || preferredMethod,
72483
+ body,
72484
+ scriptPath,
72485
+ headers
72486
+ });
72487
+ } catch (error) {
72488
+ const executionError = error;
72489
+ if (executionError?.response) {
72490
+ return executionError.response;
72491
+ }
72492
+ throw error;
72493
+ }
72481
72494
  } finally {
72482
72495
  release();
72483
72496
  }
@@ -72743,6 +72756,13 @@ var makePromise = () => {
72743
72756
  var STRING = "string";
72744
72757
  var NUMBER = "number";
72745
72758
  var __private__dont__use = Symbol("__private__dont__use");
72759
+ var PHPExecutionFailureError2 = class extends Error {
72760
+ constructor(message, response, source) {
72761
+ super(message);
72762
+ this.response = response;
72763
+ this.source = source;
72764
+ }
72765
+ };
72746
72766
  var BasePHP2 = class {
72747
72767
  /**
72748
72768
  * Initializes a PHP runtime.
@@ -72929,16 +72949,12 @@ var BasePHP2 = class {
72929
72949
  }
72930
72950
  const response = await this.#handleRequest();
72931
72951
  if (response.exitCode !== 0) {
72932
- const output = {
72933
- stdout: response.text,
72934
- stderr: response.errors
72935
- };
72936
- console.warn(`PHP.run() output was:`, output);
72937
- const error = new Error(
72938
- `PHP.run() failed with exit code ${response.exitCode} and the following output: ` + response.errors
72952
+ console.warn(`PHP.run() output was:`, response.text);
72953
+ const error = new PHPExecutionFailureError2(
72954
+ `PHP.run() failed with exit code ${response.exitCode} and the following output: ` + response.errors,
72955
+ response,
72956
+ "request"
72939
72957
  );
72940
- error.output = output;
72941
- error.source = "request";
72942
72958
  console.error(error);
72943
72959
  throw error;
72944
72960
  }
@@ -73247,7 +73263,7 @@ var BasePHP2 = class {
73247
73263
  }
73248
73264
  const { headers, httpStatusCode } = this.#getResponseHeaders();
73249
73265
  return new PHPResponse(
73250
- httpStatusCode,
73266
+ exitCode === 0 ? httpStatusCode : 500,
73251
73267
  headers,
73252
73268
  this.readFileAsBuffer("/internal/stdout"),
73253
73269
  this.readFileAsText("/internal/stderr"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,18 +28,17 @@
28
28
  "license": "GPL-2.0-or-later",
29
29
  "main": "index.cjs",
30
30
  "types": "index.d.ts",
31
- "gitHead": "83b6f8542937a9bea9ee6562887a511c20ac9442",
31
+ "gitHead": "1981567e7eacecbc4a18c870267c20bf489afd8f",
32
32
  "engines": {
33
- "node": ">=18.18.2",
33
+ "node": ">=18.18.0",
34
34
  "npm": ">=8.11.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "comlink": "^4.4.1",
38
- "express": "4.18.2",
39
38
  "ws": "8.13.0",
40
39
  "yargs": "17.7.2",
41
- "@php-wasm/node-polyfills": "0.6.14",
42
- "@php-wasm/universal": "0.6.14",
43
- "@php-wasm/util": "0.6.14"
40
+ "@php-wasm/node-polyfills": "0.6.16",
41
+ "@php-wasm/universal": "0.6.16",
42
+ "@php-wasm/util": "0.6.16"
44
43
  }
45
44
  }
package/php_7_0.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/7_0_33/php_7_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 12778840;
3
+ export const dependenciesTotalSize = 12778913;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_7_1.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/7_1_30/php_7_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 13301175;
3
+ export const dependenciesTotalSize = 13300912;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_7_2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/7_2_34/php_7_2.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 13992133;
3
+ export const dependenciesTotalSize = 13992092;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_7_3.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/7_3_33/php_7_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 14098611;
3
+ export const dependenciesTotalSize = 14098607;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_7_4.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/7_4_33/php_7_4.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 14331012;
3
+ export const dependenciesTotalSize = 14331074;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_8_0.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/8_0_30/php_8_0.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 13597816;
3
+ export const dependenciesTotalSize = 13597709;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_8_1.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/8_1_23/php_8_1.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 13575986;
3
+ export const dependenciesTotalSize = 13575971;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets
package/php_8_3.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const dependencyFilename = __dirname + '/8_3_0/php_8_3.wasm';
2
2
  export { dependencyFilename };
3
- export const dependenciesTotalSize = 14212810;
3
+ export const dependenciesTotalSize = 14212793;
4
4
  export function init(RuntimeName, PHPLoader) {
5
5
  /**
6
6
  * Overrides Emscripten's default ExitStatus object which gets