@yarnpkg/plugin-pnp 3.1.0-rc.6 → 3.1.2-rc.10
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 +1 -0
- package/lib/PnpLinker.js +14 -7
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/jsInstallUtils.d.ts +1 -0
- package/lib/jsInstallUtils.js +6 -2
- package/package.json +10 -10
package/lib/PnpLinker.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
@@ -231,8 +238,8 @@ class PnpInstaller {
|
|
|
231
238
|
// Nothing to transform
|
|
232
239
|
}
|
|
233
240
|
isEsmEnabled() {
|
|
234
|
-
if (this.opts.project.configuration.sources.has(`
|
|
235
|
-
return this.opts.project.configuration.get(`
|
|
241
|
+
if (this.opts.project.configuration.sources.has(`pnpEnableEsmLoader`))
|
|
242
|
+
return this.opts.project.configuration.get(`pnpEnableEsmLoader`);
|
|
236
243
|
if (this.isESMLoaderRequired)
|
|
237
244
|
return true;
|
|
238
245
|
for (const workspace of this.opts.project.workspaces) {
|
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare module '@yarnpkg/core' {
|
|
|
17
17
|
pnpMode: string;
|
|
18
18
|
pnpShebang: string;
|
|
19
19
|
pnpIgnorePatterns: Array<string>;
|
|
20
|
-
|
|
20
|
+
pnpEnableEsmLoader: boolean;
|
|
21
21
|
pnpEnableInlining: boolean;
|
|
22
22
|
pnpFallbackMode: string;
|
|
23
23
|
pnpUnpluggedFolder: PortablePath;
|
package/lib/index.js
CHANGED
|
@@ -76,7 +76,7 @@ const plugin = {
|
|
|
76
76
|
default: [],
|
|
77
77
|
isArray: true,
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
pnpEnableEsmLoader: {
|
|
80
80
|
description: `If true, Yarn will generate an ESM loader (\`.pnp.loader.mjs\`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.`,
|
|
81
81
|
type: core_1.SettingsType.BOOLEAN,
|
|
82
82
|
default: false,
|
package/lib/jsInstallUtils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildDirective, Configuration, DependencyMeta, FetchResult, Manifest, Package, Report } from '@yarnpkg/core';
|
|
2
|
+
export declare function checkManifestCompatibility(pkg: Package): boolean;
|
|
2
3
|
export declare function checkAndReportManifestCompatibility(pkg: Package, label: string, { configuration, report }: {
|
|
3
4
|
configuration: Configuration;
|
|
4
5
|
report?: Report | null;
|
package/lib/jsInstallUtils.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasBindingGyp = exports.getExtractHint = exports.extractBuildScripts = exports.checkAndReportManifestCompatibility = void 0;
|
|
3
|
+
exports.hasBindingGyp = exports.getExtractHint = exports.extractBuildScripts = exports.checkAndReportManifestCompatibility = exports.checkManifestCompatibility = void 0;
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
5
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
6
|
+
function checkManifestCompatibility(pkg) {
|
|
7
|
+
return core_1.structUtils.isPackageCompatible(pkg, { os: [process.platform], cpu: [process.arch] });
|
|
8
|
+
}
|
|
9
|
+
exports.checkManifestCompatibility = checkManifestCompatibility;
|
|
6
10
|
function checkAndReportManifestCompatibility(pkg, label, { configuration, report }) {
|
|
7
|
-
if (!
|
|
11
|
+
if (!checkManifestCompatibility(pkg)) {
|
|
8
12
|
report === null || report === void 0 ? void 0 : report.reportWarningOnce(core_1.MessageName.INCOMPATIBLE_ARCHITECTURE, `${core_1.structUtils.prettyLocator(configuration, pkg)} The ${process.platform}-${process.arch} architecture is incompatible with this module, ${label} skipped.`);
|
|
9
13
|
return false;
|
|
10
14
|
}
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnp",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2-rc.10",
|
|
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.
|
|
9
|
-
"@yarnpkg/plugin-stage": "^3.1.
|
|
10
|
-
"@yarnpkg/pnp": "^3.1.
|
|
11
|
-
"clipanion": "^3.0.
|
|
8
|
+
"@yarnpkg/fslib": "^2.6.1-rc.5",
|
|
9
|
+
"@yarnpkg/plugin-stage": "^3.1.1",
|
|
10
|
+
"@yarnpkg/pnp": "^3.1.1-rc.10",
|
|
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.
|
|
18
|
-
"@yarnpkg/core": "^3.
|
|
17
|
+
"@yarnpkg/cli": "^3.2.0-rc.10",
|
|
18
|
+
"@yarnpkg/core": "^3.2.0-rc.10"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/micromatch": "^4.0.1",
|
|
22
|
-
"@yarnpkg/cli": "^3.
|
|
23
|
-
"@yarnpkg/core": "^3.
|
|
22
|
+
"@yarnpkg/cli": "^3.2.0-rc.10",
|
|
23
|
+
"@yarnpkg/core": "^3.2.0-rc.10"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=12 <14 || 14.2 - 14.9 || >14.10.0"
|
|
43
43
|
},
|
|
44
|
-
"stableVersion": "3.
|
|
44
|
+
"stableVersion": "3.1.1",
|
|
45
45
|
"typings": "./lib/index.d.ts"
|
|
46
46
|
}
|