@valbuild/server 0.96.1 → 0.96.3

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.
@@ -1982,7 +1982,10 @@ class ValOps {
1982
1982
  var _validationError$fixe, _validationError$fixe2, _validationError$fixe3, _validationError$fixe4, _validationError$fixe5, _validationError$fixe6, _validationError$fixe7, _validationError$fixe8;
1983
1983
  if (isOnlyFileCheckValidationError(validationError)) {
1984
1984
  if (files[sourcePath]) {
1985
- throw new Error("Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path);
1985
+ addError({
1986
+ message: "Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path
1987
+ });
1988
+ continue;
1986
1989
  }
1987
1990
  const value = validationError.value;
1988
1991
  if (isFileSource(value)) {
@@ -5911,6 +5914,7 @@ const ValServer = (valModules, options, callbacks) => {
5911
5914
  const patchAnalysis = serverOps.analyzePatches(patchOps.patches);
5912
5915
  const schemasRes = await serverOps.getSchemas();
5913
5916
  let sourcesRes = await serverOps.getSources();
5917
+ const unpatchedSources = sourcesRes.sources;
5914
5918
  const onlyPatchedTreeModules = await serverOps.getSources({
5915
5919
  ...patchAnalysis,
5916
5920
  ...patchOps
@@ -5949,7 +5953,7 @@ const ValServer = (valModules, options, callbacks) => {
5949
5953
  // TODO: currently sourcesRes contains ALL MODULES.
5950
5954
  // We should only evaluate exactly what we need
5951
5955
  if (!req.path || moduleFilePath.startsWith(req.path)) {
5952
- var _patchAnalysis$patche, _sourcesValidation$er;
5956
+ var _patchAnalysis$patche, _patchAnalysis$patche2, _sourcesValidation$er;
5953
5957
  const skippedPatches = [];
5954
5958
  const patchErrors = {};
5955
5959
  const appliedPatches = ((_patchAnalysis$patche = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche === void 0 ? void 0 : _patchAnalysis$patche.map(p => p.patchId)) || [];
@@ -5970,8 +5974,10 @@ const ValServer = (valModules, options, callbacks) => {
5970
5974
  appliedPatches.push(patchId);
5971
5975
  }
5972
5976
  }
5977
+ const hasPatches = (((_patchAnalysis$patche2 = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche2 === void 0 ? void 0 : _patchAnalysis$patche2.length) ?? 0) > 0;
5973
5978
  modules[moduleFilePath] = {
5974
5979
  source: module,
5980
+ baseSource: hasPatches ? unpatchedSources[moduleFilePath] : undefined,
5975
5981
  render: renderRes.renders[moduleFilePath] || null,
5976
5982
  patches: appliedPatches.length > 0 || skippedPatches.length > 0 || Object.keys(patchErrors).length > 0 ? {
5977
5983
  applied: appliedPatches,
@@ -1982,7 +1982,10 @@ class ValOps {
1982
1982
  var _validationError$fixe, _validationError$fixe2, _validationError$fixe3, _validationError$fixe4, _validationError$fixe5, _validationError$fixe6, _validationError$fixe7, _validationError$fixe8;
1983
1983
  if (isOnlyFileCheckValidationError(validationError)) {
1984
1984
  if (files[sourcePath]) {
1985
- throw new Error("Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path);
1985
+ addError({
1986
+ message: "Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path
1987
+ });
1988
+ continue;
1986
1989
  }
1987
1990
  const value = validationError.value;
1988
1991
  if (isFileSource(value)) {
@@ -5911,6 +5914,7 @@ const ValServer = (valModules, options, callbacks) => {
5911
5914
  const patchAnalysis = serverOps.analyzePatches(patchOps.patches);
5912
5915
  const schemasRes = await serverOps.getSchemas();
5913
5916
  let sourcesRes = await serverOps.getSources();
5917
+ const unpatchedSources = sourcesRes.sources;
5914
5918
  const onlyPatchedTreeModules = await serverOps.getSources({
5915
5919
  ...patchAnalysis,
5916
5920
  ...patchOps
@@ -5949,7 +5953,7 @@ const ValServer = (valModules, options, callbacks) => {
5949
5953
  // TODO: currently sourcesRes contains ALL MODULES.
5950
5954
  // We should only evaluate exactly what we need
5951
5955
  if (!req.path || moduleFilePath.startsWith(req.path)) {
5952
- var _patchAnalysis$patche, _sourcesValidation$er;
5956
+ var _patchAnalysis$patche, _patchAnalysis$patche2, _sourcesValidation$er;
5953
5957
  const skippedPatches = [];
5954
5958
  const patchErrors = {};
5955
5959
  const appliedPatches = ((_patchAnalysis$patche = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche === void 0 ? void 0 : _patchAnalysis$patche.map(p => p.patchId)) || [];
@@ -5970,8 +5974,10 @@ const ValServer = (valModules, options, callbacks) => {
5970
5974
  appliedPatches.push(patchId);
5971
5975
  }
5972
5976
  }
5977
+ const hasPatches = (((_patchAnalysis$patche2 = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche2 === void 0 ? void 0 : _patchAnalysis$patche2.length) ?? 0) > 0;
5973
5978
  modules[moduleFilePath] = {
5974
5979
  source: module,
5980
+ baseSource: hasPatches ? unpatchedSources[moduleFilePath] : undefined,
5975
5981
  render: renderRes.renders[moduleFilePath] || null,
5976
5982
  patches: appliedPatches.length > 0 || skippedPatches.length > 0 || Object.keys(patchErrors).length > 0 ? {
5977
5983
  applied: appliedPatches,
@@ -1951,7 +1951,10 @@ class ValOps {
1951
1951
  var _validationError$fixe, _validationError$fixe2, _validationError$fixe3, _validationError$fixe4, _validationError$fixe5, _validationError$fixe6, _validationError$fixe7, _validationError$fixe8;
1952
1952
  if (isOnlyFileCheckValidationError(validationError)) {
1953
1953
  if (files[sourcePath]) {
1954
- throw new Error("Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path);
1954
+ addError({
1955
+ message: "Cannot have multiple files with same path. Path: " + sourcePath + "; Module: " + path
1956
+ });
1957
+ continue;
1955
1958
  }
1956
1959
  const value = validationError.value;
1957
1960
  if (isFileSource(value)) {
@@ -5880,6 +5883,7 @@ const ValServer = (valModules, options, callbacks) => {
5880
5883
  const patchAnalysis = serverOps.analyzePatches(patchOps.patches);
5881
5884
  const schemasRes = await serverOps.getSchemas();
5882
5885
  let sourcesRes = await serverOps.getSources();
5886
+ const unpatchedSources = sourcesRes.sources;
5883
5887
  const onlyPatchedTreeModules = await serverOps.getSources({
5884
5888
  ...patchAnalysis,
5885
5889
  ...patchOps
@@ -5918,7 +5922,7 @@ const ValServer = (valModules, options, callbacks) => {
5918
5922
  // TODO: currently sourcesRes contains ALL MODULES.
5919
5923
  // We should only evaluate exactly what we need
5920
5924
  if (!req.path || moduleFilePath.startsWith(req.path)) {
5921
- var _patchAnalysis$patche, _sourcesValidation$er;
5925
+ var _patchAnalysis$patche, _patchAnalysis$patche2, _sourcesValidation$er;
5922
5926
  const skippedPatches = [];
5923
5927
  const patchErrors = {};
5924
5928
  const appliedPatches = ((_patchAnalysis$patche = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche === void 0 ? void 0 : _patchAnalysis$patche.map(p => p.patchId)) || [];
@@ -5939,8 +5943,10 @@ const ValServer = (valModules, options, callbacks) => {
5939
5943
  appliedPatches.push(patchId);
5940
5944
  }
5941
5945
  }
5946
+ const hasPatches = (((_patchAnalysis$patche2 = patchAnalysis.patchesByModule[moduleFilePath]) === null || _patchAnalysis$patche2 === void 0 ? void 0 : _patchAnalysis$patche2.length) ?? 0) > 0;
5942
5947
  modules[moduleFilePath] = {
5943
5948
  source: module,
5949
+ baseSource: hasPatches ? unpatchedSources[moduleFilePath] : undefined,
5944
5950
  render: renderRes.renders[moduleFilePath] || null,
5945
5951
  patches: appliedPatches.length > 0 || skippedPatches.length > 0 || Object.keys(patchErrors).length > 0 ? {
5946
5952
  applied: appliedPatches,
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "types": "dist/valbuild-server.cjs.d.ts",
19
- "version": "0.96.1",
19
+ "version": "0.96.3",
20
20
  "devDependencies": {
21
21
  "@prettier/sync": "^0.6.1",
22
22
  "@types/jest": "^30.0.0"
@@ -30,9 +30,9 @@
30
30
  "typescript": "^5.9.3",
31
31
  "zod": "^4.3.5",
32
32
  "zod-validation-error": "^5.0.0",
33
- "@valbuild/core": "0.96.0",
34
- "@valbuild/shared": "0.96.0",
35
- "@valbuild/ui": "0.96.1"
33
+ "@valbuild/core": "0.96.3",
34
+ "@valbuild/shared": "0.96.3",
35
+ "@valbuild/ui": "0.96.3"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18.17.0"