@lobehub/editor 4.27.1 → 4.27.2
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/package.json
CHANGED
|
@@ -245,10 +245,19 @@ function patchPackage({ displayName, fileHashes, packageName, patchFile, ...conf
|
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
// Peer-dependent editor instances can patch the same dependency concurrently.
|
|
249
|
+
// Publish a complete file so other patchers never read a partial write.
|
|
250
|
+
const temporaryPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
251
|
+
try {
|
|
252
|
+
fs.writeFileSync(
|
|
253
|
+
temporaryPath,
|
|
254
|
+
restoreLineEndings(patchedContent, detectLineEnding(currentContent)),
|
|
255
|
+
{ flag: 'wx', mode: fs.statSync(targetPath).mode },
|
|
256
|
+
);
|
|
257
|
+
fs.renameSync(temporaryPath, targetPath);
|
|
258
|
+
} finally {
|
|
259
|
+
fs.rmSync(temporaryPath, { force: true });
|
|
260
|
+
}
|
|
252
261
|
patchedFiles.push(filename);
|
|
253
262
|
}
|
|
254
263
|
|