@yarnpkg/plugin-pnp 3.1.2-rc.9 → 3.2.0-rc.1
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/lib/PnpLinker.d.ts +3 -2
- package/lib/PnpLinker.js +18 -14
- package/package.json +7 -7
package/lib/PnpLinker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Descriptor, LocatorHash } from '@yarnpkg/core';
|
|
1
|
+
import { Descriptor, LocatorHash, InstallPackageExtraApi } from '@yarnpkg/core';
|
|
2
2
|
import { FetchResult, Locator, Package } from '@yarnpkg/core';
|
|
3
3
|
import { Linker, LinkOptions, MinimalLinkOptions, Installer } from '@yarnpkg/core';
|
|
4
4
|
import { PortablePath } from '@yarnpkg/fslib';
|
|
@@ -15,6 +15,7 @@ export declare class PnpLinker implements Linker {
|
|
|
15
15
|
export declare class PnpInstaller implements Installer {
|
|
16
16
|
protected opts: LinkOptions;
|
|
17
17
|
protected mode: string;
|
|
18
|
+
private readonly asyncActions;
|
|
18
19
|
private readonly packageRegistry;
|
|
19
20
|
private readonly virtualTemplates;
|
|
20
21
|
private isESMLoaderRequired;
|
|
@@ -22,7 +23,7 @@ export declare class PnpInstaller implements Installer {
|
|
|
22
23
|
getCustomDataKey(): string;
|
|
23
24
|
private customData;
|
|
24
25
|
attachCustomData(customData: any): void;
|
|
25
|
-
installPackage(pkg: Package, fetchResult: FetchResult): Promise<{
|
|
26
|
+
installPackage(pkg: Package, fetchResult: FetchResult, api: InstallPackageExtraApi): Promise<{
|
|
26
27
|
packageLocation: PortablePath;
|
|
27
28
|
buildDirective: import("@yarnpkg/core").BuildDirective[] | null;
|
|
28
29
|
}>;
|
package/lib/PnpLinker.js
CHANGED
|
@@ -72,6 +72,7 @@ class PnpInstaller {
|
|
|
72
72
|
constructor(opts) {
|
|
73
73
|
this.opts = opts;
|
|
74
74
|
this.mode = `strict`;
|
|
75
|
+
this.asyncActions = new core_1.miscUtils.AsyncActions(10);
|
|
75
76
|
this.packageRegistry = new Map();
|
|
76
77
|
this.virtualTemplates = new Map();
|
|
77
78
|
this.isESMLoaderRequired = false;
|
|
@@ -90,7 +91,7 @@ class PnpInstaller {
|
|
|
90
91
|
attachCustomData(customData) {
|
|
91
92
|
this.customData = customData;
|
|
92
93
|
}
|
|
93
|
-
async installPackage(pkg, fetchResult) {
|
|
94
|
+
async installPackage(pkg, fetchResult, api) {
|
|
94
95
|
const key1 = core_1.structUtils.stringifyIdent(pkg);
|
|
95
96
|
const key2 = pkg.reference;
|
|
96
97
|
const isWorkspace = !!this.opts.project.tryWorkspaceByLocator(pkg);
|
|
@@ -129,7 +130,7 @@ class PnpInstaller {
|
|
|
129
130
|
? jsInstallUtils.extractBuildScripts(pkg, customPackageData, dependencyMeta, { configuration: this.opts.project.configuration, report: this.opts.report })
|
|
130
131
|
: [];
|
|
131
132
|
const packageFs = mayNeedToBeUnplugged
|
|
132
|
-
? await this.unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta)
|
|
133
|
+
? await this.unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta, api)
|
|
133
134
|
: fetchResult.packageFs;
|
|
134
135
|
if (fslib_1.ppath.isAbsolute(fetchResult.prefixPath))
|
|
135
136
|
throw new Error(`Assertion failed: Expected the prefix path (${fetchResult.prefixPath}) to be relative to the parent`);
|
|
@@ -230,6 +231,7 @@ class PnpInstaller {
|
|
|
230
231
|
packageRegistry,
|
|
231
232
|
shebang,
|
|
232
233
|
});
|
|
234
|
+
await this.asyncActions.wait();
|
|
233
235
|
return {
|
|
234
236
|
customData: this.customData,
|
|
235
237
|
};
|
|
@@ -324,9 +326,9 @@ class PnpInstaller {
|
|
|
324
326
|
}
|
|
325
327
|
return nodeModules;
|
|
326
328
|
}
|
|
327
|
-
async unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta) {
|
|
329
|
+
async unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta, api) {
|
|
328
330
|
if (this.shouldBeUnplugged(pkg, customPackageData, dependencyMeta)) {
|
|
329
|
-
return this.unplugPackage(pkg, fetchResult);
|
|
331
|
+
return this.unplugPackage(pkg, fetchResult, api);
|
|
330
332
|
}
|
|
331
333
|
else {
|
|
332
334
|
return fetchResult.packageFs;
|
|
@@ -345,20 +347,22 @@ class PnpInstaller {
|
|
|
345
347
|
return true;
|
|
346
348
|
return false;
|
|
347
349
|
}
|
|
348
|
-
async unplugPackage(locator, fetchResult) {
|
|
350
|
+
async unplugPackage(locator, fetchResult, api) {
|
|
349
351
|
const unplugPath = pnpUtils.getUnpluggedPath(locator, { configuration: this.opts.project.configuration });
|
|
350
352
|
if (this.opts.project.disabledLocators.has(locator.locatorHash))
|
|
351
353
|
return new fslib_1.AliasFS(unplugPath, { baseFs: fetchResult.packageFs, pathUtils: fslib_1.ppath });
|
|
352
354
|
this.unpluggedPaths.add(unplugPath);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
355
|
+
api.holdFetchResult(this.asyncActions.set(locator.locatorHash, async () => {
|
|
356
|
+
const readyFile = fslib_1.ppath.join(unplugPath, fetchResult.prefixPath, `.ready`);
|
|
357
|
+
if (await fslib_1.xfs.existsPromise(readyFile))
|
|
358
|
+
return;
|
|
359
|
+
// Delete any build state for the locator so it can run anew, this allows users
|
|
360
|
+
// to remove `.yarn/unplugged` and have the builds run again
|
|
361
|
+
this.opts.project.storedBuildState.delete(locator.locatorHash);
|
|
362
|
+
await fslib_1.xfs.mkdirPromise(unplugPath, { recursive: true });
|
|
363
|
+
await fslib_1.xfs.copyPromise(unplugPath, fslib_1.PortablePath.dot, { baseFs: fetchResult.packageFs, overwrite: false });
|
|
364
|
+
await fslib_1.xfs.writeFilePromise(readyFile, ``);
|
|
365
|
+
}));
|
|
362
366
|
return new fslib_1.CwdFS(unplugPath);
|
|
363
367
|
}
|
|
364
368
|
getPackageInformation(locator) {
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-rc.1",
|
|
4
4
|
"license": "BSD-2-Clause",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/semver": "^7.1.0",
|
|
8
|
-
"@yarnpkg/fslib": "^2.6.1-rc.
|
|
8
|
+
"@yarnpkg/fslib": "^2.6.1-rc.6",
|
|
9
9
|
"@yarnpkg/plugin-stage": "^3.1.1",
|
|
10
|
-
"@yarnpkg/pnp": "^3.1.1-rc.
|
|
10
|
+
"@yarnpkg/pnp": "^3.1.1-rc.11",
|
|
11
11
|
"clipanion": "^3.2.0-rc.4",
|
|
12
12
|
"micromatch": "^4.0.2",
|
|
13
13
|
"semver": "^7.1.2",
|
|
14
14
|
"tslib": "^1.13.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@yarnpkg/cli": "^3.2.0-rc.
|
|
18
|
-
"@yarnpkg/core": "^3.2.0-rc.
|
|
17
|
+
"@yarnpkg/cli": "^3.2.0-rc.11",
|
|
18
|
+
"@yarnpkg/core": "^3.2.0-rc.11"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/micromatch": "^4.0.1",
|
|
22
|
-
"@yarnpkg/cli": "^3.2.0-rc.
|
|
23
|
-
"@yarnpkg/core": "^3.2.0-rc.
|
|
22
|
+
"@yarnpkg/cli": "^3.2.0-rc.11",
|
|
23
|
+
"@yarnpkg/core": "^3.2.0-rc.11"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|