@fern-api/replay 0.10.1 → 0.10.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.
package/dist/index.cjs CHANGED
@@ -1261,9 +1261,10 @@ var ReplayApplicator = class {
1261
1261
  const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
1262
1262
  const base = await this.git.showFile(baseGen.tree_hash, filePath);
1263
1263
  const theirs = await this.applyPatchToContent(base, patch.patch_content, filePath, tempGit, tempDir);
1264
- if (theirs) {
1264
+ const effectiveTheirs = theirs ?? await (0, import_promises.readFile)((0, import_node_path2.join)(this.outputDir, resolvedPath), "utf-8").catch(() => null);
1265
+ if (effectiveTheirs) {
1265
1266
  this.fileTheirsAccumulator.set(resolvedPath, {
1266
- content: theirs,
1267
+ content: effectiveTheirs,
1267
1268
  baseGeneration: patch.base_generation
1268
1269
  });
1269
1270
  }
@@ -1307,8 +1308,12 @@ var ReplayApplicator = class {
1307
1308
  };
1308
1309
  } catch {
1309
1310
  for (const [resolvedPath, content] of snapshots) {
1311
+ const fullPath = (0, import_node_path2.join)(this.outputDir, resolvedPath);
1310
1312
  if (content != null) {
1311
- await (0, import_promises.writeFile)((0, import_node_path2.join)(this.outputDir, resolvedPath), content);
1313
+ await (0, import_promises.writeFile)(fullPath, content);
1314
+ } else {
1315
+ await (0, import_promises.unlink)(fullPath).catch(() => {
1316
+ });
1312
1317
  }
1313
1318
  }
1314
1319
  }