@valbuild/server 0.60.12 → 0.60.14

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.
@@ -927,7 +927,11 @@ class ValModuleLoader {
927
927
  }
928
928
  const matches = this.findMatchingJsFile(sourceFileName);
929
929
  if (matches.match === false) {
930
- throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}`);
930
+ let debugInfo = "";
931
+ if (sourceFileName.includes("val.config")) {
932
+ debugInfo = `\n@valbuild directory scan:\n${this.host.readDirectory("/", ["js", "ts", "json"], [], ["**/@valbuild/*"]).join("\n")}`;
933
+ }
934
+ throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}${debugInfo}`);
931
935
  }
932
936
  const filePath = matches.match;
933
937
  // resolve all symlinks (preconstruct for example symlinks the dist folder)
@@ -1055,7 +1059,7 @@ export const IS_DEV = false;2
1055
1059
  };
1056
1060
  } catch (e) {
1057
1061
  return {
1058
- error: Error(`Could not resolve module: '${modulePath}': `)
1062
+ error: Error(`Could not resolve module: '${modulePath}'`)
1059
1063
  };
1060
1064
  }
1061
1065
  }, (baseModuleName, requestedName) => {
@@ -2615,11 +2619,9 @@ class ProxyValServer extends ValServer {
2615
2619
  async initRemoteFS(commit, remoteFS, token) {
2616
2620
  const params = new URLSearchParams(this.apiOptions.root ? {
2617
2621
  root: this.apiOptions.root,
2618
- commit,
2619
- cwd: this.cwd
2622
+ commit
2620
2623
  } : {
2621
- commit,
2622
- cwd: this.cwd
2624
+ commit
2623
2625
  });
2624
2626
  const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
2625
2627
  try {
@@ -2658,7 +2660,8 @@ class ProxyValServer extends ValServer {
2658
2660
  }
2659
2661
  };
2660
2662
  }
2661
- remoteFS.initializeWith(json.directories);
2663
+ remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__namespace["default"].join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
2664
+ ), content])));
2662
2665
  return {
2663
2666
  status: 200
2664
2667
  };
@@ -927,7 +927,11 @@ class ValModuleLoader {
927
927
  }
928
928
  const matches = this.findMatchingJsFile(sourceFileName);
929
929
  if (matches.match === false) {
930
- throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}`);
930
+ let debugInfo = "";
931
+ if (sourceFileName.includes("val.config")) {
932
+ debugInfo = `\n@valbuild directory scan:\n${this.host.readDirectory("/", ["js", "ts", "json"], [], ["**/@valbuild/*"]).join("\n")}`;
933
+ }
934
+ throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}${debugInfo}`);
931
935
  }
932
936
  const filePath = matches.match;
933
937
  // resolve all symlinks (preconstruct for example symlinks the dist folder)
@@ -1055,7 +1059,7 @@ export const IS_DEV = false;2
1055
1059
  };
1056
1060
  } catch (e) {
1057
1061
  return {
1058
- error: Error(`Could not resolve module: '${modulePath}': `)
1062
+ error: Error(`Could not resolve module: '${modulePath}'`)
1059
1063
  };
1060
1064
  }
1061
1065
  }, (baseModuleName, requestedName) => {
@@ -2615,11 +2619,9 @@ class ProxyValServer extends ValServer {
2615
2619
  async initRemoteFS(commit, remoteFS, token) {
2616
2620
  const params = new URLSearchParams(this.apiOptions.root ? {
2617
2621
  root: this.apiOptions.root,
2618
- commit,
2619
- cwd: this.cwd
2622
+ commit
2620
2623
  } : {
2621
- commit,
2622
- cwd: this.cwd
2624
+ commit
2623
2625
  });
2624
2626
  const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
2625
2627
  try {
@@ -2658,7 +2660,8 @@ class ProxyValServer extends ValServer {
2658
2660
  }
2659
2661
  };
2660
2662
  }
2661
- remoteFS.initializeWith(json.directories);
2663
+ remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__namespace["default"].join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
2664
+ ), content])));
2662
2665
  return {
2663
2666
  status: 200
2664
2667
  };
@@ -896,7 +896,11 @@ class ValModuleLoader {
896
896
  }
897
897
  const matches = this.findMatchingJsFile(sourceFileName);
898
898
  if (matches.match === false) {
899
- throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}`);
899
+ let debugInfo = "";
900
+ if (sourceFileName.includes("val.config")) {
901
+ debugInfo = `\n@valbuild directory scan:\n${this.host.readDirectory("/", ["js", "ts", "json"], [], ["**/@valbuild/*"]).join("\n")}`;
902
+ }
903
+ throw Error(`Could not find matching js file for module "${requestedModuleName}" requested by: "${containingFilePath}". Tried:\n${matches.tried.join("\n")}${debugInfo}`);
900
904
  }
901
905
  const filePath = matches.match;
902
906
  // resolve all symlinks (preconstruct for example symlinks the dist folder)
@@ -1024,7 +1028,7 @@ export const IS_DEV = false;2
1024
1028
  };
1025
1029
  } catch (e) {
1026
1030
  return {
1027
- error: Error(`Could not resolve module: '${modulePath}': `)
1031
+ error: Error(`Could not resolve module: '${modulePath}'`)
1028
1032
  };
1029
1033
  }
1030
1034
  }, (baseModuleName, requestedName) => {
@@ -2584,11 +2588,9 @@ class ProxyValServer extends ValServer {
2584
2588
  async initRemoteFS(commit, remoteFS, token) {
2585
2589
  const params = new URLSearchParams(this.apiOptions.root ? {
2586
2590
  root: this.apiOptions.root,
2587
- commit,
2588
- cwd: this.cwd
2591
+ commit
2589
2592
  } : {
2590
- commit,
2591
- cwd: this.cwd
2593
+ commit
2592
2594
  });
2593
2595
  const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
2594
2596
  try {
@@ -2627,7 +2629,8 @@ class ProxyValServer extends ValServer {
2627
2629
  }
2628
2630
  };
2629
2631
  }
2630
- remoteFS.initializeWith(json.directories);
2632
+ remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__default.join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
2633
+ ), content])));
2631
2634
  return {
2632
2635
  status: 200
2633
2636
  };
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "./package.json": "./package.json"
13
13
  },
14
14
  "types": "dist/valbuild-server.cjs.d.ts",
15
- "version": "0.60.12",
15
+ "version": "0.60.14",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest",
@@ -24,9 +24,9 @@
24
24
  "concurrently": "^7.6.0"
25
25
  },
26
26
  "dependencies": {
27
- "@valbuild/core": "~0.60.12",
28
- "@valbuild/shared": "~0.60.12",
29
- "@valbuild/ui": "~0.60.12",
27
+ "@valbuild/core": "~0.60.14",
28
+ "@valbuild/shared": "~0.60.14",
29
+ "@valbuild/ui": "~0.60.14",
30
30
  "express": "^4.18.2",
31
31
  "image-size": "^1.0.2",
32
32
  "minimatch": "^3.0.4",