@valbuild/server 0.62.3 → 0.62.4

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.
@@ -1516,6 +1516,7 @@ class ValOps {
1516
1516
 
1517
1517
  // #region getTree
1518
1518
  async getTree(analysis) {
1519
+ console.log("analysis", analysis);
1519
1520
  if (!analysis) {
1520
1521
  const {
1521
1522
  sources
@@ -1541,7 +1542,7 @@ class ValOps {
1541
1542
  error: new patch.PatchError(`Module at path: '${path}' not found`)
1542
1543
  });
1543
1544
  }
1544
- const source = sources[path];
1545
+ patchedSources[path] = sources[path];
1545
1546
  for (const {
1546
1547
  patchId
1547
1548
  } of patches) {
@@ -1576,7 +1577,9 @@ class ValOps {
1576
1577
  applicableOps.push(op);
1577
1578
  }
1578
1579
  }
1579
- const patchRes = patch.applyPatch(source, jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1580
+ const patchRes = patch.applyPatch(patch.deepClone(patchedSources[path]),
1581
+ // applyPatch mutates the source. On add operations it will add multiple items? There is something strange going on. DeepClone seems to fix, but is that the right?
1582
+ jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1580
1583
  if (fp.result.isErr(patchRes)) {
1581
1584
  if (!errors[path]) {
1582
1585
  errors[path] = [];
@@ -1516,6 +1516,7 @@ class ValOps {
1516
1516
 
1517
1517
  // #region getTree
1518
1518
  async getTree(analysis) {
1519
+ console.log("analysis", analysis);
1519
1520
  if (!analysis) {
1520
1521
  const {
1521
1522
  sources
@@ -1541,7 +1542,7 @@ class ValOps {
1541
1542
  error: new patch.PatchError(`Module at path: '${path}' not found`)
1542
1543
  });
1543
1544
  }
1544
- const source = sources[path];
1545
+ patchedSources[path] = sources[path];
1545
1546
  for (const {
1546
1547
  patchId
1547
1548
  } of patches) {
@@ -1576,7 +1577,9 @@ class ValOps {
1576
1577
  applicableOps.push(op);
1577
1578
  }
1578
1579
  }
1579
- const patchRes = patch.applyPatch(source, jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1580
+ const patchRes = patch.applyPatch(patch.deepClone(patchedSources[path]),
1581
+ // applyPatch mutates the source. On add operations it will add multiple items? There is something strange going on. DeepClone seems to fix, but is that the right?
1582
+ jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1580
1583
  if (fp.result.isErr(patchRes)) {
1581
1584
  if (!errors[path]) {
1582
1585
  errors[path] = [];
@@ -2,7 +2,7 @@ import { newQuickJSWASMModule } from 'quickjs-emscripten';
2
2
  import ts from 'typescript';
3
3
  import { result, pipe } from '@valbuild/core/fp';
4
4
  import { FILE_REF_PROP, FILE_REF_SUBTYPE_TAG, RT_IMAGE_TAG, VAL_EXTENSION, derefPatch, Internal, Schema, ImageSchema, FileSchema } from '@valbuild/core';
5
- import { deepEqual, isNotRoot, PatchError, parseAndValidateArrayIndex, applyPatch, JSONOps, sourceToPatchPath } from '@valbuild/core/patch';
5
+ import { deepEqual, isNotRoot, PatchError, parseAndValidateArrayIndex, applyPatch, JSONOps, deepClone, sourceToPatchPath } from '@valbuild/core/patch';
6
6
  import * as fsPath from 'path';
7
7
  import fsPath__default from 'path';
8
8
  import fs, { promises } from 'fs';
@@ -1486,6 +1486,7 @@ class ValOps {
1486
1486
 
1487
1487
  // #region getTree
1488
1488
  async getTree(analysis) {
1489
+ console.log("analysis", analysis);
1489
1490
  if (!analysis) {
1490
1491
  const {
1491
1492
  sources
@@ -1511,7 +1512,7 @@ class ValOps {
1511
1512
  error: new PatchError(`Module at path: '${path}' not found`)
1512
1513
  });
1513
1514
  }
1514
- const source = sources[path];
1515
+ patchedSources[path] = sources[path];
1515
1516
  for (const {
1516
1517
  patchId
1517
1518
  } of patches) {
@@ -1546,7 +1547,9 @@ class ValOps {
1546
1547
  applicableOps.push(op);
1547
1548
  }
1548
1549
  }
1549
- const patchRes = applyPatch(source, jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1550
+ const patchRes = applyPatch(deepClone(patchedSources[path]),
1551
+ // applyPatch mutates the source. On add operations it will add multiple items? There is something strange going on. DeepClone seems to fix, but is that the right?
1552
+ jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
1550
1553
  if (result.isErr(patchRes)) {
1551
1554
  if (!errors[path]) {
1552
1555
  errors[path] = [];
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.62.3",
15
+ "version": "0.62.4",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest",
@@ -22,9 +22,9 @@
22
22
  "@types/jest": "^29.2.5"
23
23
  },
24
24
  "dependencies": {
25
- "@valbuild/core": "~0.62.3",
26
- "@valbuild/shared": "~0.62.3",
27
- "@valbuild/ui": "~0.62.3",
25
+ "@valbuild/core": "~0.62.4",
26
+ "@valbuild/shared": "~0.62.4",
27
+ "@valbuild/ui": "~0.62.4",
28
28
  "image-size": "^1.0.2",
29
29
  "minimatch": "^3.0.4",
30
30
  "quickjs-emscripten": "^0.21.1",