@php-wasm/node 3.1.38 → 3.1.40

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.
Files changed (3) hide show
  1. package/index.cjs +26 -2
  2. package/index.js +26 -2
  3. package/package.json +15 -15
package/index.cjs CHANGED
@@ -2018,9 +2018,19 @@ var import_path3 = require("path");
2018
2018
  function createNodeFsMountHandler(localPath) {
2019
2019
  return function(php, FS, vfsMountPoint) {
2020
2020
  let removeVfsNode = false;
2021
- const mountRoot = (0, import_fs3.realpathSync)(localPath);
2021
+ let mountRoot;
2022
+ try {
2023
+ mountRoot = (0, import_fs3.realpathSync)(localPath);
2024
+ } catch (e) {
2025
+ throw markMissingMountSource(e, localPath);
2026
+ }
2022
2027
  if (!import_universal10.FSHelpers.fileExists(FS, vfsMountPoint)) {
2023
- const stat = (0, import_fs3.statSync)(mountRoot);
2028
+ let stat;
2029
+ try {
2030
+ stat = (0, import_fs3.statSync)(mountRoot);
2031
+ } catch (e) {
2032
+ throw markMissingMountSource(e, localPath);
2033
+ }
2024
2034
  if (stat.isFile()) {
2025
2035
  FS.mkdirTree((0, import_path3.dirname)(vfsMountPoint));
2026
2036
  FS.writeFile(vfsMountPoint, "");
@@ -2063,6 +2073,20 @@ function createNodeFsMountHandler(localPath) {
2063
2073
  };
2064
2074
  };
2065
2075
  }
2076
+ function markMissingMountSource(error, localPath) {
2077
+ const errnoError = error;
2078
+ if (errnoError.code === "ENOENT") {
2079
+ const missingSourceError = new Error(
2080
+ `Unable to mount ${localPath}: source path does not exist.`,
2081
+ { cause: error }
2082
+ );
2083
+ missingSourceError.code = "ENOENT";
2084
+ missingSourceError.path = localPath;
2085
+ missingSourceError.phpWasmMountSourceMissing = true;
2086
+ return missingSourceError;
2087
+ }
2088
+ return error;
2089
+ }
2066
2090
 
2067
2091
  // packages/php-wasm/node/src/lib/use-host-filesystem.ts
2068
2092
  function useHostFilesystem(php) {
package/index.js CHANGED
@@ -2001,9 +2001,19 @@ import { dirname as dirname2 } from "path";
2001
2001
  function createNodeFsMountHandler(localPath) {
2002
2002
  return function(php, FS, vfsMountPoint) {
2003
2003
  let removeVfsNode = false;
2004
- const mountRoot = realpathSync(localPath);
2004
+ let mountRoot;
2005
+ try {
2006
+ mountRoot = realpathSync(localPath);
2007
+ } catch (e) {
2008
+ throw markMissingMountSource(e, localPath);
2009
+ }
2005
2010
  if (!FSHelpers2.fileExists(FS, vfsMountPoint)) {
2006
- const stat = statSync(mountRoot);
2011
+ let stat;
2012
+ try {
2013
+ stat = statSync(mountRoot);
2014
+ } catch (e) {
2015
+ throw markMissingMountSource(e, localPath);
2016
+ }
2007
2017
  if (stat.isFile()) {
2008
2018
  FS.mkdirTree(dirname2(vfsMountPoint));
2009
2019
  FS.writeFile(vfsMountPoint, "");
@@ -2046,6 +2056,20 @@ function createNodeFsMountHandler(localPath) {
2046
2056
  };
2047
2057
  };
2048
2058
  }
2059
+ function markMissingMountSource(error, localPath) {
2060
+ const errnoError = error;
2061
+ if (errnoError.code === "ENOENT") {
2062
+ const missingSourceError = new Error(
2063
+ `Unable to mount ${localPath}: source path does not exist.`,
2064
+ { cause: error }
2065
+ );
2066
+ missingSourceError.code = "ENOENT";
2067
+ missingSourceError.path = localPath;
2068
+ missingSourceError.phpWasmMountSourceMissing = true;
2069
+ return missingSourceError;
2070
+ }
2071
+ return error;
2072
+ }
2049
2073
 
2050
2074
  // packages/php-wasm/node/src/lib/use-host-filesystem.ts
2051
2075
  function useHostFilesystem(php) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "3.1.38",
3
+ "version": "3.1.40",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,20 +42,20 @@
42
42
  "fs-ext-extra-prebuilt": "2.2.7",
43
43
  "wasm-feature-detect": "1.8.0",
44
44
  "ws": "8.21.0",
45
- "@php-wasm/universal": "3.1.38",
46
- "@php-wasm/node-8-5": "3.1.38",
47
- "@php-wasm/node-8-4": "3.1.38",
48
- "@php-wasm/node-8-3": "3.1.38",
49
- "@php-wasm/node-8-2": "3.1.38",
50
- "@php-wasm/node-8-1": "3.1.38",
51
- "@php-wasm/node-8-0": "3.1.38",
52
- "@php-wasm/node-7-4": "3.1.38",
53
- "@php-wasm/cli-util": "3.1.38",
54
- "@php-wasm/logger": "3.1.38",
55
- "@php-wasm/node-5-2": "3.1.38",
56
- "@php-wasm/util": "3.1.38"
45
+ "@php-wasm/universal": "3.1.40",
46
+ "@php-wasm/node-8-5": "3.1.40",
47
+ "@php-wasm/node-8-4": "3.1.40",
48
+ "@php-wasm/node-8-3": "3.1.40",
49
+ "@php-wasm/node-8-2": "3.1.40",
50
+ "@php-wasm/node-8-1": "3.1.40",
51
+ "@php-wasm/node-8-0": "3.1.40",
52
+ "@php-wasm/node-7-4": "3.1.40",
53
+ "@php-wasm/cli-util": "3.1.40",
54
+ "@php-wasm/logger": "3.1.40",
55
+ "@php-wasm/node-5-2": "3.1.40",
56
+ "@php-wasm/util": "3.1.40"
57
57
  },
58
- "gitHead": "2850a2a6f512e68e68407f4a9426dad705b426f0",
58
+ "gitHead": "6d9e3421ede727df67dc158e09c4af2e907ee605",
59
59
  "engines": {
60
60
  "node": ">=20.10.0",
61
61
  "npm": ">=10.2.3"
@@ -66,7 +66,7 @@
66
66
  "react": "18.3.1",
67
67
  "react-dom": "18.3.1",
68
68
  "typescript": "5.4.5",
69
- "@playwright/test": "1.55.1",
69
+ "@playwright/test": "1.61.0",
70
70
  "tmp": "0.2.5",
71
71
  "form-data": "^4.0.4",
72
72
  "lodash": "^4.17.23",