@yarnpkg/plugin-pnp 4.0.0-rc.46 → 4.0.0-rc.48
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 -1
- package/lib/PnpLinker.js +6 -5
- package/lib/commands/unplug.js +12 -4
- package/lib/jsInstallUtils.d.ts +3 -8
- package/lib/jsInstallUtils.js +17 -32
- package/package.json +10 -10
package/lib/PnpLinker.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare class PnpInstaller implements Installer {
|
|
|
25
25
|
attachCustomData(customData: any): void;
|
|
26
26
|
installPackage(pkg: Package, fetchResult: FetchResult, api: InstallPackageExtraApi): Promise<{
|
|
27
27
|
packageLocation: PortablePath;
|
|
28
|
-
|
|
28
|
+
buildRequest: import("@yarnpkg/core").BuildRequest | null;
|
|
29
29
|
}>;
|
|
30
30
|
attachInternalDependencies(locator: Locator, dependencies: Array<[Descriptor, Locator]>): Promise<void>;
|
|
31
31
|
attachExternalDependents(locator: Locator, dependentPaths: Array<PortablePath>): Promise<void>;
|
package/lib/PnpLinker.js
CHANGED
|
@@ -122,9 +122,9 @@ class PnpInstaller {
|
|
|
122
122
|
this.isESMLoaderRequired = true;
|
|
123
123
|
dependencyMeta = this.opts.project.getDependencyMeta(devirtualizedLocator, pkg.version);
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
? jsInstallUtils.
|
|
127
|
-
:
|
|
125
|
+
const buildRequest = mayNeedToBeBuilt
|
|
126
|
+
? jsInstallUtils.extractBuildRequest(pkg, customPackageData, dependencyMeta, { configuration: this.opts.project.configuration })
|
|
127
|
+
: null;
|
|
128
128
|
const packageFs = mayNeedToBeUnplugged
|
|
129
129
|
? await this.unplugPackageIfNeeded(pkg, customPackageData, fetchResult, dependencyMeta, api)
|
|
130
130
|
: fetchResult.packageFs;
|
|
@@ -160,7 +160,7 @@ class PnpInstaller {
|
|
|
160
160
|
});
|
|
161
161
|
return {
|
|
162
162
|
packageLocation: packageRawLocation,
|
|
163
|
-
|
|
163
|
+
buildRequest,
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
async attachInternalDependencies(locator, dependencies) {
|
|
@@ -334,7 +334,8 @@ class PnpInstaller {
|
|
|
334
334
|
return true;
|
|
335
335
|
if (customPackageData.manifest.preferUnplugged !== null)
|
|
336
336
|
return customPackageData.manifest.preferUnplugged;
|
|
337
|
-
|
|
337
|
+
const buildRequest = jsInstallUtils.extractBuildRequest(pkg, customPackageData, dependencyMeta, { configuration: this.opts.project.configuration });
|
|
338
|
+
if ((buildRequest === null || buildRequest === void 0 ? void 0 : buildRequest.skipped) === false || customPackageData.misc.extractHint)
|
|
338
339
|
return true;
|
|
339
340
|
return false;
|
|
340
341
|
}
|
package/lib/commands/unplug.js
CHANGED
|
@@ -109,7 +109,7 @@ class UnplugCommand extends cli_1.BaseCommand {
|
|
|
109
109
|
selection = core_1.miscUtils.sortMap(selection, pkg => {
|
|
110
110
|
return core_2.structUtils.stringifyLocator(pkg);
|
|
111
111
|
});
|
|
112
|
-
const
|
|
112
|
+
const unplugReport = await core_1.StreamReport.start({
|
|
113
113
|
configuration,
|
|
114
114
|
stdout: this.context.stdout,
|
|
115
115
|
json: this.json,
|
|
@@ -126,10 +126,18 @@ class UnplugCommand extends cli_1.BaseCommand {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
await project.topLevelWorkspace.persistManifest();
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
if (!this.json) {
|
|
130
|
+
report.reportSeparator();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
if (unplugReport.hasErrors())
|
|
134
|
+
return unplugReport.exitCode();
|
|
135
|
+
return await project.installWithNewReport({
|
|
136
|
+
json: this.json,
|
|
137
|
+
stdout: this.context.stdout,
|
|
138
|
+
}, {
|
|
139
|
+
cache,
|
|
131
140
|
});
|
|
132
|
-
return report.exitCode();
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
UnplugCommand.paths = [
|
package/lib/jsInstallUtils.d.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Configuration, DependencyMeta, FetchResult, Manifest, Package, BuildRequest } from '@yarnpkg/core';
|
|
2
2
|
export declare function checkManifestCompatibility(pkg: Package): boolean;
|
|
3
|
-
export declare function checkAndReportManifestCompatibility(pkg: Package, label: string, { configuration, report }: {
|
|
4
|
-
configuration: Configuration;
|
|
5
|
-
report?: Report | null;
|
|
6
|
-
}): boolean;
|
|
7
3
|
export type ExtractBuildScriptDataRequirements = {
|
|
8
4
|
manifest: Pick<Manifest, 'scripts'>;
|
|
9
5
|
misc: {
|
|
10
6
|
hasBindingGyp: boolean;
|
|
11
7
|
};
|
|
12
8
|
};
|
|
13
|
-
export declare function
|
|
9
|
+
export declare function extractBuildRequest(pkg: Package, requirements: ExtractBuildScriptDataRequirements, dependencyMeta: DependencyMeta, { configuration }: {
|
|
14
10
|
configuration: Configuration;
|
|
15
|
-
|
|
16
|
-
}): BuildDirective[];
|
|
11
|
+
}): BuildRequest | null;
|
|
17
12
|
export declare function getExtractHint(fetchResult: FetchResult): boolean;
|
|
18
13
|
export declare function hasBindingGyp(fetchResult: FetchResult): boolean;
|
package/lib/jsInstallUtils.js
CHANGED
|
@@ -1,48 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasBindingGyp = exports.getExtractHint = exports.
|
|
3
|
+
exports.hasBindingGyp = exports.getExtractHint = exports.extractBuildRequest = exports.checkManifestCompatibility = void 0;
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
5
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
6
6
|
function checkManifestCompatibility(pkg) {
|
|
7
7
|
return core_1.structUtils.isPackageCompatible(pkg, core_1.nodeUtils.getArchitectureSet());
|
|
8
8
|
}
|
|
9
9
|
exports.checkManifestCompatibility = checkManifestCompatibility;
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
report === null || report === void 0 ? void 0 : report.reportWarningOnce(core_1.MessageName.INCOMPATIBLE_ARCHITECTURE, `${core_1.structUtils.prettyLocator(configuration, pkg)} The ${core_1.nodeUtils.getArchitectureName()} architecture is incompatible with this package, ${label} skipped.`);
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
exports.checkAndReportManifestCompatibility = checkAndReportManifestCompatibility;
|
|
18
|
-
function extractBuildScripts(pkg, requirements, dependencyMeta, { configuration, report }) {
|
|
19
|
-
const buildScripts = [];
|
|
10
|
+
function extractBuildRequest(pkg, requirements, dependencyMeta, { configuration }) {
|
|
11
|
+
const directives = [];
|
|
20
12
|
for (const scriptName of [`preinstall`, `install`, `postinstall`])
|
|
21
13
|
if (requirements.manifest.scripts.has(scriptName))
|
|
22
|
-
|
|
14
|
+
directives.push({ type: core_1.BuildDirectiveType.SCRIPT, script: scriptName });
|
|
23
15
|
// Detect cases where a package has a binding.gyp but no install script
|
|
24
16
|
if (!requirements.manifest.scripts.has(`install`) && requirements.misc.hasBindingGyp)
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
28
|
-
if (pkg.linkType !== core_1.LinkType.HARD)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
report === null || report === void 0 ? void 0 : report.reportWarningOnce(core_1.MessageName.DISABLED_BUILD_SCRIPTS, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but all build scripts have been disabled.`);
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
const isManifestCompatible = checkAndReportManifestCompatibility(pkg, `build`, { configuration, report });
|
|
41
|
-
if (!isManifestCompatible)
|
|
42
|
-
return [];
|
|
43
|
-
return buildScripts;
|
|
17
|
+
directives.push({ type: core_1.BuildDirectiveType.SHELLCODE, script: `node-gyp rebuild` });
|
|
18
|
+
if (directives.length === 0)
|
|
19
|
+
return null;
|
|
20
|
+
if (pkg.linkType !== core_1.LinkType.HARD)
|
|
21
|
+
return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.SOFT_LINK_BUILD, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`) };
|
|
22
|
+
if (dependencyMeta && dependencyMeta.built === false)
|
|
23
|
+
return { skipped: true, explain: report => report.reportInfoOnce(core_1.MessageName.BUILD_DISABLED, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but its build has been explicitly disabled through configuration.`) };
|
|
24
|
+
if (!configuration.get(`enableScripts`) && !dependencyMeta.built)
|
|
25
|
+
return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.DISABLED_BUILD_SCRIPTS, `${core_1.structUtils.prettyLocator(configuration, pkg)} lists build scripts, but all build scripts have been disabled.`) };
|
|
26
|
+
if (!checkManifestCompatibility(pkg))
|
|
27
|
+
return { skipped: true, explain: report => report.reportWarningOnce(core_1.MessageName.INCOMPATIBLE_ARCHITECTURE, `${core_1.structUtils.prettyLocator(configuration, pkg)} The ${core_1.nodeUtils.getArchitectureName()} architecture is incompatible with this package, build skipped.`) };
|
|
28
|
+
return { skipped: false, directives };
|
|
44
29
|
}
|
|
45
|
-
exports.
|
|
30
|
+
exports.extractBuildRequest = extractBuildRequest;
|
|
46
31
|
const FORCED_EXTRACT_FILETYPES = new Set([
|
|
47
32
|
// Windows can't execute exe files inside zip archives
|
|
48
33
|
`.exe`,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnp",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
4
|
-
"stableVersion": "3.2.
|
|
3
|
+
"version": "4.0.0-rc.48",
|
|
4
|
+
"stableVersion": "3.2.11",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@types/semver": "^7.1.0",
|
|
13
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
14
|
-
"@yarnpkg/plugin-stage": "^4.0.0-rc.
|
|
15
|
-
"@yarnpkg/pnp": "^4.0.0-rc.
|
|
13
|
+
"@yarnpkg/fslib": "^3.0.0-rc.48",
|
|
14
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.48",
|
|
15
|
+
"@yarnpkg/pnp": "^4.0.0-rc.48",
|
|
16
16
|
"clipanion": "^3.2.1",
|
|
17
17
|
"micromatch": "^4.0.2",
|
|
18
18
|
"semver": "^7.1.2",
|
|
19
19
|
"tslib": "^2.4.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
23
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
22
|
+
"@yarnpkg/cli": "^4.0.0-rc.48",
|
|
23
|
+
"@yarnpkg/core": "^4.0.0-rc.48"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/micromatch": "^4.0.1",
|
|
27
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
28
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
27
|
+
"@yarnpkg/cli": "^4.0.0-rc.48",
|
|
28
|
+
"@yarnpkg/core": "^4.0.0-rc.48"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"/lib/**/*"
|
|
48
48
|
],
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=18.12.0"
|
|
51
51
|
}
|
|
52
52
|
}
|