Skip to content

Commit bedc0cf

Browse files
authored
perf(plugin-patch): remove unneeded saveAndClose (#1700)
1 parent 3c71ffa commit bedc0cf

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

.yarn/versions/92d834ce.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
releases:
2+
"@yarnpkg/cli": prerelease
3+
"@yarnpkg/plugin-patch": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-init"
11+
- "@yarnpkg/plugin-interactive-tools"
12+
- "@yarnpkg/plugin-node-modules"
13+
- "@yarnpkg/plugin-npm-cli"
14+
- "@yarnpkg/plugin-pack"
15+
- "@yarnpkg/plugin-pnp"
16+
- "@yarnpkg/plugin-stage"
17+
- "@yarnpkg/plugin-typescript"
18+
- "@yarnpkg/plugin-version"
19+
- "@yarnpkg/plugin-workspace-tools"
20+
- "@yarnpkg/builder"
21+
- "@yarnpkg/core"
22+
- "@yarnpkg/doctor"

packages/plugin-patch/sources/PatchFetcher.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,18 @@ export class PatchFetcher implements Fetcher {
4949

5050
const libzip = await getLibzipPromise();
5151

52-
const copiedPackage = new ZipFS(tmpFile, {
52+
const patchedPackage = new ZipFS(tmpFile, {
5353
libzip,
5454
create: true,
5555
level: opts.project.configuration.get(`compressionLevel`),
5656
});
5757

58-
await copiedPackage.mkdirpPromise(prefixPath);
58+
await patchedPackage.mkdirpPromise(prefixPath);
5959

6060
await miscUtils.releaseAfterUseAsync(async () => {
61-
await copiedPackage.copyPromise(prefixPath, sourceFetch.prefixPath, {baseFs: sourceFetch.packageFs, stableSort: true});
61+
await patchedPackage.copyPromise(prefixPath, sourceFetch.prefixPath, {baseFs: sourceFetch.packageFs, stableSort: true});
6262
}, sourceFetch.releaseFs);
6363

64-
copiedPackage.saveAndClose();
65-
66-
const patchedPackage = new ZipFS(tmpFile, {
67-
libzip,
68-
level: opts.project.configuration.get(`compressionLevel`),
69-
});
70-
7164
const patchFs = new CwdFS(ppath.resolve(PortablePath.root, prefixPath), {baseFs: patchedPackage});
7265

7366
for (const patchFile of patchFiles) {

0 commit comments

Comments
 (0)