@yarnpkg/plugin-pnpm 1.1.0 → 2.0.0-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/PnpmLinker.d.ts +1 -1
- package/lib/PnpmLinker.js +14 -16
- package/package.json +11 -10
package/lib/PnpmLinker.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare type PnpmCustomData = {
|
|
|
5
5
|
locatorByPath: Map<PortablePath, string>;
|
|
6
6
|
};
|
|
7
7
|
export declare class PnpmLinker implements Linker {
|
|
8
|
+
getCustomDataKey(): string;
|
|
8
9
|
supportsPackage(pkg: Package, opts: MinimalLinkOptions): boolean;
|
|
9
10
|
findPackageLocation(locator: Locator, opts: LinkOptions): Promise<PortablePath>;
|
|
10
11
|
findPackageLocator(location: PortablePath, opts: LinkOptions): Promise<Locator | null>;
|
|
@@ -15,7 +16,6 @@ declare class PnpmInstaller implements Installer {
|
|
|
15
16
|
private opts;
|
|
16
17
|
private readonly asyncActions;
|
|
17
18
|
constructor(opts: LinkOptions);
|
|
18
|
-
getCustomDataKey(): string;
|
|
19
19
|
private customData;
|
|
20
20
|
attachCustomData(customData: any): void;
|
|
21
21
|
installPackage(pkg: Package, fetchResult: FetchResult, api: InstallPackageExtraApi): Promise<{
|
package/lib/PnpmLinker.js
CHANGED
|
@@ -6,14 +6,20 @@ const fslib_1 = require("@yarnpkg/fslib");
|
|
|
6
6
|
const plugin_pnp_1 = require("@yarnpkg/plugin-pnp");
|
|
7
7
|
const clipanion_1 = require("clipanion");
|
|
8
8
|
class PnpmLinker {
|
|
9
|
+
getCustomDataKey() {
|
|
10
|
+
return JSON.stringify({
|
|
11
|
+
name: `PnpmLinker`,
|
|
12
|
+
version: 2,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
9
15
|
supportsPackage(pkg, opts) {
|
|
10
16
|
return this.isEnabled(opts);
|
|
11
17
|
}
|
|
12
18
|
async findPackageLocation(locator, opts) {
|
|
13
19
|
if (!this.isEnabled(opts))
|
|
14
20
|
throw new Error(`Assertion failed: Expected the pnpm linker to be enabled`);
|
|
15
|
-
const customDataKey = getCustomDataKey();
|
|
16
|
-
const customData = opts.project.
|
|
21
|
+
const customDataKey = this.getCustomDataKey();
|
|
22
|
+
const customData = opts.project.linkersCustomData.get(customDataKey);
|
|
17
23
|
if (!customData)
|
|
18
24
|
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`);
|
|
19
25
|
const packageLocation = customData.pathByLocator.get(locator.locatorHash);
|
|
@@ -24,8 +30,8 @@ class PnpmLinker {
|
|
|
24
30
|
async findPackageLocator(location, opts) {
|
|
25
31
|
if (!this.isEnabled(opts))
|
|
26
32
|
return null;
|
|
27
|
-
const customDataKey = getCustomDataKey();
|
|
28
|
-
const customData = opts.project.
|
|
33
|
+
const customDataKey = this.getCustomDataKey();
|
|
34
|
+
const customData = opts.project.linkersCustomData.get(customDataKey);
|
|
29
35
|
if (!customData)
|
|
30
36
|
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`);
|
|
31
37
|
const nmRootLocation = location.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);
|
|
@@ -65,9 +71,6 @@ class PnpmInstaller {
|
|
|
65
71
|
};
|
|
66
72
|
// Nothing to do
|
|
67
73
|
}
|
|
68
|
-
getCustomDataKey() {
|
|
69
|
-
return getCustomDataKey();
|
|
70
|
-
}
|
|
71
74
|
attachCustomData(customData) {
|
|
72
75
|
// We don't want to attach the data because it's only used in the Linker and we'll recompute it anyways in the Installer,
|
|
73
76
|
// it needs to be invalidated because otherwise we'll never prune the store or we might run into various issues.
|
|
@@ -223,20 +226,15 @@ class PnpmInstaller {
|
|
|
223
226
|
await Promise.all(removals);
|
|
224
227
|
}
|
|
225
228
|
// Wait for the package installs to catch up
|
|
226
|
-
await this.asyncActions.wait()
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
await this.asyncActions.wait();
|
|
230
|
+
await removeIfEmpty(storeLocation);
|
|
231
|
+
if (this.opts.project.configuration.get(`nodeLinker`) !== `node-modules`)
|
|
232
|
+
await removeIfEmpty(getNodeModulesLocation(this.opts.project));
|
|
229
233
|
return {
|
|
230
234
|
customData: this.customData,
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
237
|
}
|
|
234
|
-
function getCustomDataKey() {
|
|
235
|
-
return JSON.stringify({
|
|
236
|
-
name: `PnpmInstaller`,
|
|
237
|
-
version: 2,
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
238
|
function getNodeModulesLocation(project) {
|
|
241
239
|
return fslib_1.ppath.join(project.cwd, fslib_1.Filename.nodeModules);
|
|
242
240
|
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnpm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.10",
|
|
4
4
|
"license": "BSD-2-Clause",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@yarnpkg/fslib": "^
|
|
8
|
-
"@yarnpkg/plugin-pnp": "^
|
|
9
|
-
"@yarnpkg/plugin-stage": "^
|
|
10
|
-
"clipanion": "^3.2.0-rc.
|
|
7
|
+
"@yarnpkg/fslib": "^3.0.0-rc.10",
|
|
8
|
+
"@yarnpkg/plugin-pnp": "^4.0.0-rc.10",
|
|
9
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.10",
|
|
10
|
+
"clipanion": "^3.2.0-rc.10",
|
|
11
11
|
"p-limit": "^2.2.0",
|
|
12
12
|
"tslib": "^1.13.0"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@yarnpkg/cli": "^
|
|
16
|
-
"@yarnpkg/core": "^
|
|
15
|
+
"@yarnpkg/cli": "^4.0.0-rc.10",
|
|
16
|
+
"@yarnpkg/core": "^4.0.0-rc.10"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@yarnpkg/cli": "^
|
|
20
|
-
"@yarnpkg/core": "^
|
|
19
|
+
"@yarnpkg/cli": "^4.0.0-rc.10",
|
|
20
|
+
"@yarnpkg/core": "^4.0.0-rc.10"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"/lib/**/*"
|
|
37
37
|
],
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=14.15.0"
|
|
40
40
|
},
|
|
41
|
+
"stableVersion": "1.1.0",
|
|
41
42
|
"typings": "./lib/index.d.ts"
|
|
42
43
|
}
|