@yarnpkg/plugin-pnp 3.1.2-rc.4 → 3.1.2-rc.8

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.
@@ -10,6 +10,7 @@ export declare class PnpLinker implements Linker {
10
10
  findPackageLocation(locator: Locator, opts: LinkOptions): Promise<PortablePath>;
11
11
  findPackageLocator(location: PortablePath, opts: LinkOptions): Promise<Locator | null>;
12
12
  makeInstaller(opts: LinkOptions): PnpInstaller;
13
+ private isEnabled;
13
14
  }
14
15
  export declare class PnpInstaller implements Installer {
15
16
  protected opts: LinkOptions;
package/lib/PnpLinker.js CHANGED
@@ -25,13 +25,11 @@ class PnpLinker {
25
25
  this.pnpCache = new Map();
26
26
  }
27
27
  supportsPackage(pkg, opts) {
28
- if (opts.project.configuration.get(`nodeLinker`) !== `pnp`)
29
- return false;
30
- if (opts.project.configuration.get(`pnpMode`) !== this.mode)
31
- return false;
32
- return true;
28
+ return this.isEnabled(opts);
33
29
  }
34
30
  async findPackageLocation(locator, opts) {
31
+ if (!this.isEnabled(opts))
32
+ throw new Error(`Assertion failed: Expected the PnP linker to be enabled`);
35
33
  const pnpPath = (0, index_1.getPnpPath)(opts.project).cjs;
36
34
  if (!fslib_1.xfs.existsSync(pnpPath))
37
35
  throw new clipanion_1.UsageError(`The project in ${core_1.formatUtils.pretty(opts.project.configuration, `${opts.project.cwd}/package.json`, core_1.formatUtils.Type.PATH)} doesn't seem to have been installed - running an install there might help`);
@@ -45,6 +43,8 @@ class PnpLinker {
45
43
  return fslib_1.npath.toPortablePath(packageInformation.packageLocation);
46
44
  }
47
45
  async findPackageLocator(location, opts) {
46
+ if (!this.isEnabled(opts))
47
+ return null;
48
48
  const pnpPath = (0, index_1.getPnpPath)(opts.project).cjs;
49
49
  if (!fslib_1.xfs.existsSync(pnpPath))
50
50
  return null;
@@ -59,6 +59,13 @@ class PnpLinker {
59
59
  makeInstaller(opts) {
60
60
  return new PnpInstaller(opts);
61
61
  }
62
+ isEnabled(opts) {
63
+ if (opts.project.configuration.get(`nodeLinker`) !== `pnp`)
64
+ return false;
65
+ if (opts.project.configuration.get(`pnpMode`) !== this.mode)
66
+ return false;
67
+ return true;
68
+ }
62
69
  }
63
70
  exports.PnpLinker = PnpLinker;
64
71
  class PnpInstaller {
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-pnp",
3
- "version": "3.1.2-rc.4",
3
+ "version": "3.1.2-rc.8",
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.0",
8
+ "@yarnpkg/fslib": "^2.6.1-rc.3",
9
9
  "@yarnpkg/plugin-stage": "^3.1.1",
10
- "@yarnpkg/pnp": "^3.1.1-rc.4",
11
- "clipanion": "^3.0.1",
10
+ "@yarnpkg/pnp": "^3.1.1-rc.8",
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.4",
18
- "@yarnpkg/core": "^3.2.0-rc.4"
17
+ "@yarnpkg/cli": "^3.2.0-rc.8",
18
+ "@yarnpkg/core": "^3.2.0-rc.8"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/micromatch": "^4.0.1",
22
- "@yarnpkg/cli": "^3.2.0-rc.4",
23
- "@yarnpkg/core": "^3.2.0-rc.4"
22
+ "@yarnpkg/cli": "^3.2.0-rc.8",
23
+ "@yarnpkg/core": "^3.2.0-rc.8"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",