@yarnpkg/plugin-pnp 3.1.2-rc.8 → 3.2.0-rc.3
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 +20 -16
- package/lib/commands/unplug.js +2 -2
- package/lib/index.js +4 -4
- package/lib/jsInstallUtils.js +2 -2
- 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
|
@@ -8,8 +8,8 @@ const fslib_1 = require("@yarnpkg/fslib");
|
|
|
8
8
|
const pnp_1 = require("@yarnpkg/pnp");
|
|
9
9
|
const clipanion_1 = require("clipanion");
|
|
10
10
|
const index_1 = require("./index");
|
|
11
|
-
const jsInstallUtils =
|
|
12
|
-
const pnpUtils =
|
|
11
|
+
const jsInstallUtils = tslib_1.__importStar(require("./jsInstallUtils"));
|
|
12
|
+
const pnpUtils = tslib_1.__importStar(require("./pnpUtils"));
|
|
13
13
|
const FORCED_UNPLUG_PACKAGES = new Set([
|
|
14
14
|
// Some packages do weird stuff and MUST be unplugged. I don't like them.
|
|
15
15
|
core_1.structUtils.makeIdent(null, `nan`).identHash,
|
|
@@ -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/lib/commands/unplug.js
CHANGED
|
@@ -5,8 +5,8 @@ const cli_1 = require("@yarnpkg/cli");
|
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const core_2 = require("@yarnpkg/core");
|
|
7
7
|
const clipanion_1 = require("clipanion");
|
|
8
|
-
const micromatch_1 =
|
|
9
|
-
const pnpUtils =
|
|
8
|
+
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
|
|
9
|
+
const pnpUtils = tslib_1.__importStar(require("../pnpUtils"));
|
|
10
10
|
// eslint-disable-next-line arca/no-default-export
|
|
11
11
|
class UnplugCommand extends cli_1.BaseCommand {
|
|
12
12
|
constructor() {
|
package/lib/index.js
CHANGED
|
@@ -4,13 +4,13 @@ exports.PnpLinker = exports.PnpInstaller = exports.quotePathIfNeeded = exports.g
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
7
|
-
const semver_1 =
|
|
7
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
8
|
const url_1 = require("url");
|
|
9
9
|
const PnpLinker_1 = require("./PnpLinker");
|
|
10
|
-
const unplug_1 =
|
|
11
|
-
const jsInstallUtils =
|
|
10
|
+
const unplug_1 = tslib_1.__importDefault(require("./commands/unplug"));
|
|
11
|
+
const jsInstallUtils = tslib_1.__importStar(require("./jsInstallUtils"));
|
|
12
12
|
exports.jsInstallUtils = jsInstallUtils;
|
|
13
|
-
const pnpUtils =
|
|
13
|
+
const pnpUtils = tslib_1.__importStar(require("./pnpUtils"));
|
|
14
14
|
exports.pnpUtils = pnpUtils;
|
|
15
15
|
const getPnpPath = (project) => {
|
|
16
16
|
return {
|
package/lib/jsInstallUtils.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.hasBindingGyp = exports.getExtractHint = exports.extractBuildScripts = e
|
|
|
4
4
|
const core_1 = require("@yarnpkg/core");
|
|
5
5
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
6
6
|
function checkManifestCompatibility(pkg) {
|
|
7
|
-
return core_1.structUtils.isPackageCompatible(pkg,
|
|
7
|
+
return core_1.structUtils.isPackageCompatible(pkg, core_1.nodeUtils.getArchitectureSet());
|
|
8
8
|
}
|
|
9
9
|
exports.checkManifestCompatibility = checkManifestCompatibility;
|
|
10
10
|
function checkAndReportManifestCompatibility(pkg, label, { configuration, report }) {
|
|
11
11
|
if (!checkManifestCompatibility(pkg)) {
|
|
12
|
-
report === null || report === void 0 ? void 0 : report.reportWarningOnce(core_1.MessageName.INCOMPATIBLE_ARCHITECTURE, `${core_1.structUtils.prettyLocator(configuration, pkg)} The ${
|
|
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
13
|
return false;
|
|
14
14
|
}
|
|
15
15
|
return true;
|
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.3",
|
|
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.8",
|
|
9
9
|
"@yarnpkg/plugin-stage": "^3.1.1",
|
|
10
|
-
"@yarnpkg/pnp": "^3.1.1-rc.
|
|
10
|
+
"@yarnpkg/pnp": "^3.1.1-rc.13",
|
|
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.13",
|
|
18
|
+
"@yarnpkg/core": "^3.2.0-rc.13"
|
|
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.13",
|
|
23
|
+
"@yarnpkg/core": "^3.2.0-rc.13"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|