@yarnpkg/plugin-pnpm 1.1.0-rc.5 → 1.1.0-rc.9

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.
@@ -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(),
@@ -223,11 +221,11 @@ class PnpmInstaller {
223
221
  if (!expectedEntries.has(record))
224
222
  removals.push(fslib_1.xfs.removePromise(fslib_1.ppath.join(storeLocation, record)));
225
223
  await Promise.all(removals);
226
- await removeIfEmpty(storeLocation);
227
224
  }
228
225
  // Wait for the package installs to catch up
229
226
  await this.asyncActions.wait(),
230
- await removeIfEmpty(getNodeModulesLocation(this.opts.project));
227
+ await removeIfEmpty(storeLocation);
228
+ await removeIfEmpty(getNodeModulesLocation(this.opts.project));
231
229
  return {
232
230
  customData: this.customData,
233
231
  };
@@ -326,44 +324,3 @@ async function removeIfEmpty(dir) {
326
324
  }
327
325
  }
328
326
  }
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": "1.1.0-rc.5",
3
+ "version": "1.1.0-rc.9",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "dependencies": {
7
- "@yarnpkg/fslib": "^2.6.1-rc.2",
8
- "@yarnpkg/plugin-pnp": "^3.1.2-rc.7",
7
+ "@yarnpkg/fslib": "^2.6.1-rc.6",
8
+ "@yarnpkg/plugin-pnp": "^3.2.0-rc.1",
9
9
  "@yarnpkg/plugin-stage": "^3.1.1",
10
10
  "clipanion": "^3.2.0-rc.4",
11
11
  "p-limit": "^2.2.0",
12
12
  "tslib": "^1.13.0"
13
13
  },
14
14
  "peerDependencies": {
15
- "@yarnpkg/cli": "^3.2.0-rc.7",
16
- "@yarnpkg/core": "^3.2.0-rc.7"
15
+ "@yarnpkg/cli": "^3.2.0-rc.11",
16
+ "@yarnpkg/core": "^3.2.0-rc.11"
17
17
  },
18
18
  "devDependencies": {
19
- "@yarnpkg/cli": "^3.2.0-rc.7",
20
- "@yarnpkg/core": "^3.2.0-rc.7"
19
+ "@yarnpkg/cli": "^3.2.0-rc.11",
20
+ "@yarnpkg/core": "^3.2.0-rc.11"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",