@yarnpkg/plugin-pnpm 1.1.0-rc.8 → 2.0.0-rc.1
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 +5 -47
- package/package.json +11 -11
package/lib/PnpmLinker.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class PnpmLinker implements Linker {
|
|
|
13
13
|
}
|
|
14
14
|
declare class PnpmInstaller implements Installer {
|
|
15
15
|
private opts;
|
|
16
|
-
private asyncActions;
|
|
16
|
+
private readonly asyncActions;
|
|
17
17
|
constructor(opts: LinkOptions);
|
|
18
18
|
getCustomDataKey(): string;
|
|
19
19
|
private customData;
|
package/lib/PnpmLinker.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PnpmLinker = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const core_1 = require("@yarnpkg/core");
|
|
6
5
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
7
6
|
const plugin_pnp_1 = require("@yarnpkg/plugin-pnp");
|
|
8
7
|
const clipanion_1 = require("clipanion");
|
|
9
|
-
const p_limit_1 = (0, tslib_1.__importDefault)(require("p-limit"));
|
|
10
8
|
class PnpmLinker {
|
|
11
9
|
supportsPackage(pkg, opts) {
|
|
12
10
|
return this.isEnabled(opts);
|
|
@@ -60,7 +58,7 @@ exports.PnpmLinker = PnpmLinker;
|
|
|
60
58
|
class PnpmInstaller {
|
|
61
59
|
constructor(opts) {
|
|
62
60
|
this.opts = opts;
|
|
63
|
-
this.asyncActions = new AsyncActions();
|
|
61
|
+
this.asyncActions = new core_1.miscUtils.AsyncActions(10);
|
|
64
62
|
this.customData = {
|
|
65
63
|
pathByLocator: new Map(),
|
|
66
64
|
locatorByPath: new Map(),
|
|
@@ -225,9 +223,10 @@ class PnpmInstaller {
|
|
|
225
223
|
await Promise.all(removals);
|
|
226
224
|
}
|
|
227
225
|
// Wait for the package installs to catch up
|
|
228
|
-
await this.asyncActions.wait()
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
await this.asyncActions.wait();
|
|
227
|
+
await removeIfEmpty(storeLocation);
|
|
228
|
+
if (this.opts.project.configuration.get(`nodeLinker`) !== `node-modules`)
|
|
229
|
+
await removeIfEmpty(getNodeModulesLocation(this.opts.project));
|
|
231
230
|
return {
|
|
232
231
|
customData: this.customData,
|
|
233
232
|
};
|
|
@@ -326,44 +325,3 @@ async function removeIfEmpty(dir) {
|
|
|
326
325
|
}
|
|
327
326
|
}
|
|
328
327
|
}
|
|
329
|
-
function makeDeferred() {
|
|
330
|
-
let resolve;
|
|
331
|
-
let reject;
|
|
332
|
-
const promise = new Promise((resolveFn, rejectFn) => {
|
|
333
|
-
resolve = resolveFn;
|
|
334
|
-
reject = rejectFn;
|
|
335
|
-
});
|
|
336
|
-
return { promise, resolve: resolve, reject: reject };
|
|
337
|
-
}
|
|
338
|
-
class AsyncActions {
|
|
339
|
-
constructor() {
|
|
340
|
-
this.deferred = new Map();
|
|
341
|
-
this.promises = new Map();
|
|
342
|
-
this.limit = (0, p_limit_1.default)(10);
|
|
343
|
-
}
|
|
344
|
-
set(key, factory) {
|
|
345
|
-
let deferred = this.deferred.get(key);
|
|
346
|
-
if (typeof deferred === `undefined`)
|
|
347
|
-
this.deferred.set(key, deferred = makeDeferred());
|
|
348
|
-
const promise = this.limit(() => factory());
|
|
349
|
-
this.promises.set(key, promise);
|
|
350
|
-
promise.then(() => {
|
|
351
|
-
if (this.promises.get(key) === promise) {
|
|
352
|
-
deferred.resolve();
|
|
353
|
-
}
|
|
354
|
-
}, err => {
|
|
355
|
-
if (this.promises.get(key) === promise) {
|
|
356
|
-
deferred.reject(err);
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
return deferred.promise;
|
|
360
|
-
}
|
|
361
|
-
reduce(key, factory) {
|
|
362
|
-
var _a;
|
|
363
|
-
const promise = (_a = this.promises.get(key)) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
364
|
-
this.set(key, () => factory(promise));
|
|
365
|
-
}
|
|
366
|
-
async wait() {
|
|
367
|
-
await Promise.all(this.promises.values());
|
|
368
|
-
}
|
|
369
|
-
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-pnpm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
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.1",
|
|
8
|
+
"@yarnpkg/plugin-pnp": "^4.0.0-rc.1",
|
|
9
|
+
"@yarnpkg/plugin-stage": "^4.0.0-rc.1",
|
|
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.1",
|
|
16
|
+
"@yarnpkg/core": "^4.0.0-rc.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@yarnpkg/cli": "^
|
|
20
|
-
"@yarnpkg/core": "^
|
|
19
|
+
"@yarnpkg/cli": "^4.0.0-rc.1",
|
|
20
|
+
"@yarnpkg/core": "^4.0.0-rc.1"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"/lib/**/*"
|
|
37
37
|
],
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=14.15.0"
|
|
40
40
|
},
|
|
41
|
-
"stableVersion": "1.0
|
|
41
|
+
"stableVersion": "1.1.0",
|
|
42
42
|
"typings": "./lib/index.d.ts"
|
|
43
43
|
}
|