@wix/evalforge-evaluator 0.40.0 → 0.41.0

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.
package/build/index.js CHANGED
@@ -7347,7 +7347,7 @@ function diffSnapshots(before, after) {
7347
7347
  for (const path9 of allPaths) {
7348
7348
  const beforeContent = before[path9] ?? "";
7349
7349
  const afterContent = after[path9] ?? "";
7350
- if (beforeContent === afterContent) {
7350
+ if (before[path9] !== void 0 && beforeContent === afterContent) {
7351
7351
  continue;
7352
7352
  }
7353
7353
  const diffLines = generateDiffLines(beforeContent, afterContent);
@@ -7358,8 +7358,26 @@ function diffSnapshots(before, after) {
7358
7358
  diffLines
7359
7359
  });
7360
7360
  }
7361
- diffs.sort((a, b) => a.path.localeCompare(b.path));
7362
- return diffs;
7361
+ const deletedPaths = [...allPaths].filter((p) => after[p] === void 0);
7362
+ const addedPaths = [...allPaths].filter((p) => before[p] === void 0);
7363
+ const renamedFromByNewPath = /* @__PURE__ */ new Map();
7364
+ const deletedPathsToRemove = /* @__PURE__ */ new Set();
7365
+ for (const addedPath of addedPaths) {
7366
+ const addedContent = after[addedPath] ?? "";
7367
+ const deletedMatch = deletedPaths.find(
7368
+ (dp) => (before[dp] ?? "") === addedContent && !deletedPathsToRemove.has(dp)
7369
+ );
7370
+ if (deletedMatch) {
7371
+ renamedFromByNewPath.set(addedPath, deletedMatch);
7372
+ deletedPathsToRemove.add(deletedMatch);
7373
+ }
7374
+ }
7375
+ const result = diffs.filter((d) => !deletedPathsToRemove.has(d.path)).map((d) => {
7376
+ const renamedFrom = renamedFromByNewPath.get(d.path);
7377
+ return renamedFrom ? { ...d, renamedFrom } : d;
7378
+ });
7379
+ result.sort((a, b) => a.path.localeCompare(b.path));
7380
+ return result;
7363
7381
  }
7364
7382
  function extractTemplateFiles(before, after) {
7365
7383
  const files = [];