@yarnpkg/plugin-essentials 4.0.0-rc.5 → 4.0.0-rc.50

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.
Files changed (69) hide show
  1. package/lib/commands/add.d.ts +1 -1
  2. package/lib/commands/add.js +34 -25
  3. package/lib/commands/bin.d.ts +1 -1
  4. package/lib/commands/bin.js +1 -1
  5. package/lib/commands/cache/clean.d.ts +1 -1
  6. package/lib/commands/cache/clean.js +1 -1
  7. package/lib/commands/config/get.d.ts +1 -1
  8. package/lib/commands/config/get.js +1 -1
  9. package/lib/commands/config/set.d.ts +1 -1
  10. package/lib/commands/config/set.js +1 -1
  11. package/lib/commands/config/unset.d.ts +1 -1
  12. package/lib/commands/config/unset.js +1 -1
  13. package/lib/commands/config.d.ts +1 -1
  14. package/lib/commands/config.js +1 -1
  15. package/lib/commands/dedupe.d.ts +1 -1
  16. package/lib/commands/dedupe.js +7 -8
  17. package/lib/commands/entries/clipanion.js +1 -1
  18. package/lib/commands/entries/help.js +1 -1
  19. package/lib/commands/entries/version.js +1 -1
  20. package/lib/commands/exec.js +1 -1
  21. package/lib/commands/explain/peerRequirements.d.ts +2 -2
  22. package/lib/commands/explain/peerRequirements.js +4 -6
  23. package/lib/commands/explain.js +1 -1
  24. package/lib/commands/info.js +8 -12
  25. package/lib/commands/install.d.ts +1 -1
  26. package/lib/commands/install.js +188 -107
  27. package/lib/commands/link.d.ts +2 -2
  28. package/lib/commands/link.js +36 -32
  29. package/lib/commands/node.js +1 -1
  30. package/lib/commands/plugin/check.d.ts +8 -0
  31. package/lib/commands/plugin/check.js +61 -0
  32. package/lib/commands/plugin/import/sources.d.ts +3 -3
  33. package/lib/commands/plugin/import/sources.js +5 -5
  34. package/lib/commands/plugin/import.d.ts +5 -4
  35. package/lib/commands/plugin/import.js +15 -28
  36. package/lib/commands/plugin/list.d.ts +2 -2
  37. package/lib/commands/plugin/list.js +5 -6
  38. package/lib/commands/plugin/remove.d.ts +1 -1
  39. package/lib/commands/plugin/remove.js +14 -13
  40. package/lib/commands/plugin/runtime.d.ts +2 -2
  41. package/lib/commands/plugin/runtime.js +4 -4
  42. package/lib/commands/rebuild.d.ts +2 -2
  43. package/lib/commands/rebuild.js +10 -10
  44. package/lib/commands/remove.d.ts +1 -1
  45. package/lib/commands/remove.js +7 -8
  46. package/lib/commands/run.js +1 -1
  47. package/lib/commands/runIndex.d.ts +2 -2
  48. package/lib/commands/runIndex.js +3 -3
  49. package/lib/commands/set/resolution.d.ts +1 -1
  50. package/lib/commands/set/resolution.js +4 -6
  51. package/lib/commands/set/version/sources.d.ts +3 -2
  52. package/lib/commands/set/version/sources.js +21 -12
  53. package/lib/commands/set/version.d.ts +2 -3
  54. package/lib/commands/set/version.js +20 -16
  55. package/lib/commands/unlink.d.ts +1 -1
  56. package/lib/commands/unlink.js +7 -8
  57. package/lib/commands/up.d.ts +3 -3
  58. package/lib/commands/up.js +19 -17
  59. package/lib/commands/why.js +5 -13
  60. package/lib/commands/workspace.js +2 -5
  61. package/lib/commands/workspaces/list.d.ts +2 -1
  62. package/lib/commands/workspaces/list.js +8 -1
  63. package/lib/dedupeUtils.d.ts +3 -3
  64. package/lib/dedupeUtils.js +3 -5
  65. package/lib/index.d.ts +76 -1
  66. package/lib/index.js +40 -1
  67. package/lib/suggestUtils.d.ts +4 -4
  68. package/lib/suggestUtils.js +10 -10
  69. package/package.json +23 -17
@@ -18,5 +18,5 @@ export default class AddCommand extends BaseCommand {
18
18
  mode: InstallMode | undefined;
19
19
  silent: boolean | undefined;
20
20
  packages: string[];
21
- execute(): Promise<1 | 0>;
21
+ execute(): Promise<0 | 1>;
22
22
  }
@@ -54,7 +54,6 @@ class AddCommand extends cli_1.BaseCommand {
54
54
  this.packages = clipanion_1.Option.Rest();
55
55
  }
56
56
  async execute() {
57
- var _a;
58
57
  const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
59
58
  const { project, workspace } = await core_2.Project.find(configuration, this.context.cwd);
60
59
  const cache = await core_1.Cache.find(configuration);
@@ -64,7 +63,7 @@ class AddCommand extends cli_1.BaseCommand {
64
63
  restoreResolutions: false,
65
64
  });
66
65
  const fixed = this.fixed;
67
- const interactive = (_a = this.interactive) !== null && _a !== void 0 ? _a : configuration.get(`preferInteractive`);
66
+ const interactive = this.interactive ?? configuration.get(`preferInteractive`);
68
67
  const reuse = interactive || configuration.get(`preferReuse`);
69
68
  const modifier = suggestUtils.getModifier(this, project);
70
69
  const strategies = [
@@ -86,24 +85,27 @@ class AddCommand extends cli_1.BaseCommand {
86
85
  : core_3.structUtils.tryParseDescriptor(pseudoDescriptor);
87
86
  const unsupportedPrefix = pseudoDescriptor.match(/^(https?:|git@github)/);
88
87
  if (unsupportedPrefix)
89
- throw new clipanion_1.UsageError(`It seems you are trying to add a package using a ${core_1.formatUtils.pretty(configuration, `${unsupportedPrefix[0]}...`, core_1.FormatType.RANGE)} url; we now require package names to be explicitly specified.\nTry running the command again with the package name prefixed: ${core_1.formatUtils.pretty(configuration, `yarn add`, core_1.FormatType.CODE)} ${core_1.formatUtils.pretty(configuration, core_3.structUtils.makeDescriptor(core_3.structUtils.makeIdent(null, `my-package`), `${unsupportedPrefix[0]}...`), core_1.FormatType.DESCRIPTOR)}`);
88
+ throw new clipanion_1.UsageError(`It seems you are trying to add a package using a ${core_1.formatUtils.pretty(configuration, `${unsupportedPrefix[0]}...`, core_1.formatUtils.Type.RANGE)} url; we now require package names to be explicitly specified.\nTry running the command again with the package name prefixed: ${core_1.formatUtils.pretty(configuration, `yarn add`, core_1.formatUtils.Type.CODE)} ${core_1.formatUtils.pretty(configuration, core_3.structUtils.makeDescriptor(core_3.structUtils.makeIdent(null, `my-package`), `${unsupportedPrefix[0]}...`), core_1.formatUtils.Type.DESCRIPTOR)}`);
90
89
  if (!request)
91
- throw new clipanion_1.UsageError(`The ${core_1.formatUtils.pretty(configuration, pseudoDescriptor, core_1.FormatType.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);
92
- const target = suggestTarget(workspace, request, {
90
+ throw new clipanion_1.UsageError(`The ${core_1.formatUtils.pretty(configuration, pseudoDescriptor, core_1.formatUtils.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);
91
+ const targetList = suggestTargetList(workspace, request, {
93
92
  dev: this.dev,
94
93
  peer: this.peer,
95
94
  preferDev: this.preferDev,
96
95
  optional: this.optional,
97
96
  });
98
- const suggestions = await suggestUtils.getSuggestedDescriptors(request, { project, workspace, cache, fixed, target, modifier, strategies, maxResults });
99
- return [request, suggestions, target];
100
- }));
97
+ const results = await Promise.all(targetList.map(async (target) => {
98
+ const suggestedDescriptors = await suggestUtils.getSuggestedDescriptors(request, { project, workspace, cache, fixed, target, modifier, strategies, maxResults });
99
+ return { request, suggestedDescriptors, target };
100
+ }));
101
+ return results;
102
+ })).then(results => results.flat());
101
103
  const checkReport = await core_1.LightReport.start({
102
104
  configuration,
103
105
  stdout: this.context.stdout,
104
106
  suggestInstall: false,
105
107
  }, async (report) => {
106
- for (const [request, { suggestions, rejections }] of allSuggestions) {
108
+ for (const { request, suggestedDescriptors: { suggestions, rejections } } of allSuggestions) {
107
109
  const nonNullSuggestions = suggestions.filter(suggestion => {
108
110
  return suggestion.descriptor !== null;
109
111
  });
@@ -125,7 +127,7 @@ class AddCommand extends cli_1.BaseCommand {
125
127
  let askedQuestions = false;
126
128
  const afterWorkspaceDependencyAdditionList = [];
127
129
  const afterWorkspaceDependencyReplacementList = [];
128
- for (const [/*request*/ , { suggestions }, target] of allSuggestions) {
130
+ for (const { suggestedDescriptors: { suggestions }, target } of allSuggestions) {
129
131
  let selected;
130
132
  const nonNullSuggestions = suggestions.filter(suggestion => {
131
133
  return suggestion.descriptor !== null;
@@ -198,18 +200,16 @@ class AddCommand extends cli_1.BaseCommand {
198
200
  await configuration.triggerMultipleHooks((hooks) => hooks.afterWorkspaceDependencyReplacement, afterWorkspaceDependencyReplacementList);
199
201
  if (askedQuestions)
200
202
  this.context.stdout.write(`\n`);
201
- const installReport = await core_2.StreamReport.start({
202
- configuration,
203
+ return await project.installWithNewReport({
203
204
  json: this.json,
204
205
  stdout: this.context.stdout,
205
- includeLogs: !this.context.quiet,
206
- }, async (report) => {
207
- await project.install({ cache, report, mode: this.mode });
206
+ quiet: this.context.quiet,
207
+ }, {
208
+ cache,
209
+ mode: this.mode,
208
210
  });
209
- return installReport.exitCode();
210
211
  }
211
212
  }
212
- exports.default = AddCommand;
213
213
  AddCommand.paths = [
214
214
  [`add`],
215
215
  ];
@@ -236,7 +236,7 @@ AddCommand.usage = clipanion_1.Command.Usage({
236
236
 
237
237
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
238
238
 
239
- - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
239
+ - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
240
240
 
241
241
  - \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
242
242
 
@@ -262,7 +262,8 @@ AddCommand.usage = clipanion_1.Command.Usage({
262
262
  `$0 add lodash-es@lodash/lodash#es`,
263
263
  ]],
264
264
  });
265
- function suggestTarget(workspace, ident, { dev, peer, preferDev, optional }) {
265
+ exports.default = AddCommand;
266
+ function suggestTargetList(workspace, ident, { dev, peer, preferDev, optional }) {
266
267
  const hasRegular = workspace.manifest[suggestUtils.Target.REGULAR].has(ident.identHash);
267
268
  const hasDev = workspace.manifest[suggestUtils.Target.DEVELOPMENT].has(ident.identHash);
268
269
  const hasPeer = workspace.manifest[suggestUtils.Target.PEER].has(ident.identHash);
@@ -276,13 +277,21 @@ function suggestTarget(workspace, ident, { dev, peer, preferDev, optional }) {
276
277
  throw new clipanion_1.UsageError(`Package "${core_3.structUtils.prettyIdent(workspace.project.configuration, ident)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);
277
278
  if ((dev || preferDev) && optional)
278
279
  throw new clipanion_1.UsageError(`Package "${core_3.structUtils.prettyIdent(workspace.project.configuration, ident)}" cannot simultaneously be a dev dependency and an optional dependency`);
280
+ // When the program executes this line, the command is expected to be legal
281
+ const targetList = [];
279
282
  if (peer)
280
- return suggestUtils.Target.PEER;
283
+ targetList.push(suggestUtils.Target.PEER);
281
284
  if (dev || preferDev)
282
- return suggestUtils.Target.DEVELOPMENT;
283
- if (hasRegular)
284
- return suggestUtils.Target.REGULAR;
285
+ targetList.push(suggestUtils.Target.DEVELOPMENT);
286
+ if (optional)
287
+ targetList.push(suggestUtils.Target.REGULAR);
288
+ // The user explicitly define the targets
289
+ if (targetList.length > 0)
290
+ return targetList;
291
+ // The user does not define the targets, find it from the `workspace.manifest`
285
292
  if (hasDev)
286
- return suggestUtils.Target.DEVELOPMENT;
287
- return suggestUtils.Target.REGULAR;
293
+ return [suggestUtils.Target.DEVELOPMENT];
294
+ if (hasPeer)
295
+ return [suggestUtils.Target.PEER];
296
+ return [suggestUtils.Target.REGULAR];
288
297
  }
@@ -6,5 +6,5 @@ export default class BinCommand extends BaseCommand {
6
6
  verbose: boolean;
7
7
  json: boolean;
8
8
  name: string | undefined;
9
- execute(): Promise<1 | 0>;
9
+ execute(): Promise<0 | 1>;
10
10
  }
@@ -58,7 +58,6 @@ class BinCommand extends cli_1.BaseCommand {
58
58
  return report.exitCode();
59
59
  }
60
60
  }
61
- exports.default = BinCommand;
62
61
  BinCommand.paths = [
63
62
  [`bin`],
64
63
  ];
@@ -77,3 +76,4 @@ BinCommand.usage = clipanion_1.Command.Usage({
77
76
  `$0 bin eslint`,
78
77
  ]],
79
78
  });
79
+ exports.default = BinCommand;
@@ -5,5 +5,5 @@ export default class CacheCleanCommand extends BaseCommand {
5
5
  static usage: Usage;
6
6
  mirror: boolean;
7
7
  all: boolean;
8
- execute(): Promise<1 | 0>;
8
+ execute(): Promise<0 | 1>;
9
9
  }
@@ -35,7 +35,6 @@ class CacheCleanCommand extends cli_1.BaseCommand {
35
35
  return report.exitCode();
36
36
  }
37
37
  }
38
- exports.default = CacheCleanCommand;
39
38
  CacheCleanCommand.paths = [
40
39
  [`cache`, `clean`],
41
40
  [`cache`, `clear`],
@@ -53,3 +52,4 @@ CacheCleanCommand.usage = clipanion_1.Command.Usage({
53
52
  `$0 cache clean --mirror`,
54
53
  ]],
55
54
  });
55
+ exports.default = CacheCleanCommand;
@@ -6,5 +6,5 @@ export default class ConfigGetCommand extends BaseCommand {
6
6
  json: boolean;
7
7
  unsafe: boolean;
8
8
  name: string;
9
- execute(): Promise<1 | 0>;
9
+ execute(): Promise<0 | 1>;
10
10
  }
@@ -57,7 +57,6 @@ class ConfigGetCommand extends cli_1.BaseCommand {
57
57
  return report.exitCode();
58
58
  }
59
59
  }
60
- exports.default = ConfigGetCommand;
61
60
  ConfigGetCommand.paths = [
62
61
  [`config`, `get`],
63
62
  ];
@@ -85,3 +84,4 @@ ConfigGetCommand.usage = clipanion_1.Command.Usage({
85
84
  `yarn config get packageExtensions --json`,
86
85
  ]],
87
86
  });
87
+ exports.default = ConfigGetCommand;
@@ -7,5 +7,5 @@ export default class ConfigSetCommand extends BaseCommand {
7
7
  home: boolean;
8
8
  name: string;
9
9
  value: string;
10
- execute(): Promise<1 | 0>;
10
+ execute(): Promise<0 | 1>;
11
11
  }
@@ -79,7 +79,6 @@ class ConfigSetCommand extends cli_1.BaseCommand {
79
79
  return report.exitCode();
80
80
  }
81
81
  }
82
- exports.default = ConfigSetCommand;
83
82
  ConfigSetCommand.paths = [
84
83
  [`config`, `set`],
85
84
  ];
@@ -112,3 +111,4 @@ ConfigSetCommand.usage = clipanion_1.Command.Usage({
112
111
  `yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`,
113
112
  ]],
114
113
  });
114
+ exports.default = ConfigSetCommand;
@@ -5,5 +5,5 @@ export default class ConfigUnsetCommand extends BaseCommand {
5
5
  static usage: Usage;
6
6
  home: boolean;
7
7
  name: string;
8
- execute(): Promise<1 | 0>;
8
+ execute(): Promise<0 | 1>;
9
9
  }
@@ -57,7 +57,6 @@ class ConfigUnsetCommand extends cli_1.BaseCommand {
57
57
  return report.exitCode();
58
58
  }
59
59
  }
60
- exports.default = ConfigUnsetCommand;
61
60
  ConfigUnsetCommand.paths = [
62
61
  [`config`, `unset`],
63
62
  ];
@@ -77,3 +76,4 @@ ConfigUnsetCommand.usage = clipanion_1.Command.Usage({
77
76
  `yarn config unset npmScopes.company.npmRegistryServer`,
78
77
  ]],
79
78
  });
79
+ exports.default = ConfigUnsetCommand;
@@ -6,5 +6,5 @@ export default class ConfigCommand extends BaseCommand {
6
6
  verbose: boolean;
7
7
  why: boolean;
8
8
  json: boolean;
9
- execute(): Promise<1 | 0>;
9
+ execute(): Promise<0 | 1>;
10
10
  }
@@ -85,7 +85,6 @@ class ConfigCommand extends cli_1.BaseCommand {
85
85
  return report.exitCode();
86
86
  }
87
87
  }
88
- exports.default = ConfigCommand;
89
88
  ConfigCommand.paths = [
90
89
  [`config`],
91
90
  ];
@@ -99,3 +98,4 @@ ConfigCommand.usage = clipanion_1.Command.Usage({
99
98
  `$0 config`,
100
99
  ]],
101
100
  });
101
+ exports.default = ConfigCommand;
@@ -22,5 +22,5 @@ export default class DedupeCommand extends BaseCommand {
22
22
  json: boolean;
23
23
  mode: InstallMode | undefined;
24
24
  patterns: string[];
25
- execute(): Promise<1 | 0>;
25
+ execute(): Promise<0 | 1>;
26
26
  }
@@ -61,18 +61,16 @@ class DedupeCommand extends cli_1.BaseCommand {
61
61
  return dedupedPackageCount ? 1 : 0;
62
62
  }
63
63
  else {
64
- const installReport = await core_1.StreamReport.start({
65
- configuration,
66
- stdout: this.context.stdout,
64
+ return await project.installWithNewReport({
67
65
  json: this.json,
68
- }, async (report) => {
69
- await project.install({ cache, report, mode: this.mode });
66
+ stdout: this.context.stdout,
67
+ }, {
68
+ cache,
69
+ mode: this.mode,
70
70
  });
71
- return installReport.exitCode();
72
71
  }
73
72
  }
74
73
  }
75
- exports.default = DedupeCommand;
76
74
  DedupeCommand.paths = [
77
75
  [`dedupe`],
78
76
  ];
@@ -91,7 +89,7 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
91
89
 
92
90
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
93
91
 
94
- - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
92
+ - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
95
93
 
96
94
  - \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
97
95
 
@@ -124,3 +122,4 @@ DedupeCommand.usage = clipanion_1.Command.Usage({
124
122
  `$0 dedupe --check`,
125
123
  ]],
126
124
  });
125
+ exports.default = DedupeCommand;
@@ -33,7 +33,7 @@ class ClipanionCommand extends cli_1.BaseCommand {
33
33
  this.context.stdout.write(`${JSON.stringify(clipanionDefinitions, null, 2)}\n`);
34
34
  }
35
35
  }
36
- exports.default = ClipanionCommand;
37
36
  ClipanionCommand.paths = [
38
37
  [`--clipanion=definitions`],
39
38
  ];
39
+ exports.default = ClipanionCommand;
@@ -7,9 +7,9 @@ class HelpCommand extends cli_1.BaseCommand {
7
7
  this.context.stdout.write(this.cli.usage(null));
8
8
  }
9
9
  }
10
- exports.default = HelpCommand;
11
10
  HelpCommand.paths = [
12
11
  [`help`],
13
12
  [`--help`],
14
13
  [`-h`],
15
14
  ];
15
+ exports.default = HelpCommand;
@@ -8,8 +8,8 @@ class VersionCommand extends cli_1.BaseCommand {
8
8
  this.context.stdout.write(`${core_1.YarnVersion || `<unknown>`}\n`);
9
9
  }
10
10
  }
11
- exports.default = VersionCommand;
12
11
  VersionCommand.paths = [
13
12
  [`-v`],
14
13
  [`--version`],
15
14
  ];
15
+ exports.default = VersionCommand;
@@ -24,7 +24,6 @@ class ExecCommand extends cli_1.BaseCommand {
24
24
  });
25
25
  }
26
26
  }
27
- exports.default = ExecCommand;
28
27
  ExecCommand.paths = [
29
28
  [`exec`],
30
29
  ];
@@ -43,3 +42,4 @@ ExecCommand.usage = clipanion_1.Command.Usage({
43
42
  `$0 exec "tsc & babel src --out-dir lib"`,
44
43
  ]],
45
44
  });
45
+ exports.default = ExecCommand;
@@ -6,8 +6,8 @@ export default class ExplainPeerRequirementsCommand extends BaseCommand {
6
6
  static paths: string[][];
7
7
  static usage: import("clipanion").Usage;
8
8
  hash: string | undefined;
9
- execute(): Promise<1 | 0>;
9
+ execute(): Promise<0 | 1>;
10
10
  }
11
11
  export declare function explainPeerRequirements(peerRequirementsHash: string, project: Project, opts: {
12
12
  stdout: Writable;
13
- }): Promise<1 | 0>;
13
+ }): Promise<0 | 1>;
@@ -35,7 +35,6 @@ class ExplainPeerRequirementsCommand extends cli_1.BaseCommand {
35
35
  stdout: this.context.stdout,
36
36
  includeFooter: false,
37
37
  }, async (report) => {
38
- var _a;
39
38
  const sortCriterias = [
40
39
  ([, requirement]) => core_1.structUtils.stringifyLocator(project.storedPackages.get(requirement.subject)),
41
40
  ([, requirement]) => core_1.structUtils.stringifyIdent(requirement.requested),
@@ -47,7 +46,7 @@ class ExplainPeerRequirementsCommand extends cli_1.BaseCommand {
47
46
  const rootRequester = project.storedPackages.get(requirement.rootRequester);
48
47
  if (typeof rootRequester === `undefined`)
49
48
  throw new Error(`Assertion failed: Expected the root package to have been registered`);
50
- const providedDescriptor = (_a = subject.dependencies.get(requirement.requested.identHash)) !== null && _a !== void 0 ? _a : null;
49
+ const providedDescriptor = subject.dependencies.get(requirement.requested.identHash) ?? null;
51
50
  const prettyHash = core_1.formatUtils.pretty(configuration, hash, core_1.formatUtils.Type.CODE);
52
51
  const prettySubject = core_1.structUtils.prettyLocator(configuration, subject);
53
52
  const prettyIdent = core_1.structUtils.prettyIdent(configuration, requirement.requested);
@@ -62,7 +61,6 @@ class ExplainPeerRequirementsCommand extends cli_1.BaseCommand {
62
61
  return report.exitCode();
63
62
  }
64
63
  }
65
- exports.default = ExplainPeerRequirementsCommand;
66
64
  ExplainPeerRequirementsCommand.paths = [
67
65
  [`explain`, `peer-requirements`],
68
66
  ];
@@ -85,6 +83,7 @@ ExplainPeerRequirementsCommand.usage = clipanion_1.Command.Usage({
85
83
  `$0 explain peer-requirements`,
86
84
  ]],
87
85
  });
86
+ exports.default = ExplainPeerRequirementsCommand;
88
87
  async function explainPeerRequirements(peerRequirementsHash, project, opts) {
89
88
  const { configuration } = project;
90
89
  const requirement = project.peerRequirements.get(peerRequirementsHash);
@@ -95,14 +94,13 @@ async function explainPeerRequirements(peerRequirementsHash, project, opts) {
95
94
  stdout: opts.stdout,
96
95
  includeFooter: false,
97
96
  }, async (report) => {
98
- var _a, _b;
99
97
  const subject = project.storedPackages.get(requirement.subject);
100
98
  if (typeof subject === `undefined`)
101
99
  throw new Error(`Assertion failed: Expected the subject package to have been registered`);
102
100
  const rootRequester = project.storedPackages.get(requirement.rootRequester);
103
101
  if (typeof rootRequester === `undefined`)
104
102
  throw new Error(`Assertion failed: Expected the root package to have been registered`);
105
- const providedDescriptor = (_a = subject.dependencies.get(requirement.requested.identHash)) !== null && _a !== void 0 ? _a : null;
103
+ const providedDescriptor = subject.dependencies.get(requirement.requested.identHash) ?? null;
106
104
  const providedResolution = providedDescriptor !== null
107
105
  ? project.storedResolutions.get(providedDescriptor.descriptorHash)
108
106
  : null;
@@ -130,7 +128,7 @@ async function explainPeerRequirements(peerRequirementsHash, project, opts) {
130
128
  const satisfiesAllRanges = allRequesters.every(({ peerDependency }) => {
131
129
  return core_1.semverUtils.satisfiesWithPrereleases(provided.version, peerDependency.range);
132
130
  });
133
- report.reportInfo(core_1.MessageName.UNNAMED, `${core_1.structUtils.prettyLocator(configuration, subject)} provides ${core_1.structUtils.prettyLocator(configuration, provided)} with version ${core_1.structUtils.prettyReference(configuration, (_b = provided.version) !== null && _b !== void 0 ? _b : `<missing>`)}, which ${satisfiesAllRanges ? `satisfies` : `doesn't satisfy`} the following requirements:`);
131
+ report.reportInfo(core_1.MessageName.UNNAMED, `${core_1.structUtils.prettyLocator(configuration, subject)} provides ${core_1.structUtils.prettyLocator(configuration, provided)} with version ${core_1.structUtils.prettyReference(configuration, provided.version ?? `<missing>`)}, which ${satisfiesAllRanges ? `satisfies` : `doesn't satisfy`} the following requirements:`);
134
132
  }
135
133
  else {
136
134
  report.reportInfo(core_1.MessageName.UNNAMED, `${core_1.structUtils.prettyLocator(configuration, subject)} doesn't provide ${core_1.structUtils.prettyIdent(configuration, requirement.requested)}, breaking the following requirements:`);
@@ -78,7 +78,6 @@ class ExplainCommand extends cli_1.BaseCommand {
78
78
  }
79
79
  }
80
80
  }
81
- exports.default = ExplainCommand;
82
81
  ExplainCommand.paths = [
83
82
  [`explain`],
84
83
  ];
@@ -97,3 +96,4 @@ ExplainCommand.usage = clipanion_1.Command.Usage({
97
96
  `$0 explain`,
98
97
  ]],
99
98
  });
99
+ exports.default = ExplainCommand;
@@ -160,11 +160,10 @@ class InfoCommand extends cli_1.BaseCommand {
160
160
  const infoTreeChildren = {};
161
161
  const infoTree = { children: infoTreeChildren };
162
162
  const fetcher = configuration.makeFetcher();
163
- const fetcherOptions = { project, fetcher, cache, checksums: project.storedChecksums, report: new core_1.ThrowReport(), cacheOptions: { skipIntegrityCheck: true }, skipIntegrityCheck: true };
163
+ const fetcherOptions = { project, fetcher, cache, checksums: project.storedChecksums, report: new core_1.ThrowReport(), cacheOptions: { skipIntegrityCheck: true } };
164
164
  const builtinInfoBuilders = [
165
165
  // Manifest fields
166
166
  async (pkg, extra, registerData) => {
167
- var _a, _b;
168
167
  if (!extra.has(`manifest`))
169
168
  return;
170
169
  const fetchResult = await fetcher.fetch(pkg, fetcherOptions);
@@ -173,23 +172,22 @@ class InfoCommand extends cli_1.BaseCommand {
173
172
  manifest = await core_1.Manifest.find(fetchResult.prefixPath, { baseFs: fetchResult.packageFs });
174
173
  }
175
174
  finally {
176
- (_a = fetchResult.releaseFs) === null || _a === void 0 ? void 0 : _a.call(fetchResult);
175
+ fetchResult.releaseFs?.();
177
176
  }
178
177
  registerData(`Manifest`, {
179
178
  [`License`]: core_1.formatUtils.tuple(core_1.formatUtils.Type.NO_HINT, manifest.license),
180
- [`Homepage`]: core_1.formatUtils.tuple(core_1.formatUtils.Type.URL, (_b = manifest.raw.homepage) !== null && _b !== void 0 ? _b : null),
179
+ [`Homepage`]: core_1.formatUtils.tuple(core_1.formatUtils.Type.URL, manifest.raw.homepage ?? null),
181
180
  });
182
181
  },
183
182
  // Cache info
184
183
  async (pkg, extra, registerData) => {
185
- var _a;
186
184
  if (!extra.has(`cache`))
187
185
  return;
188
186
  const cacheOptions = {
189
187
  mockedPackages: project.disabledLocators,
190
188
  unstablePackages: project.conditionalLocators,
191
189
  };
192
- const checksum = (_a = project.storedChecksums.get(pkg.locatorHash)) !== null && _a !== void 0 ? _a : null;
190
+ const checksum = project.storedChecksums.get(pkg.locatorHash) ?? null;
193
191
  const cachePath = cache.getLocatorPath(pkg, checksum, cacheOptions);
194
192
  let stat;
195
193
  if (cachePath !== null) {
@@ -272,10 +270,9 @@ class InfoCommand extends cli_1.BaseCommand {
272
270
  }
273
271
  if (pkg.dependencies.size > 0 && !isVirtual) {
274
272
  registerData(`Dependencies`, [...pkg.dependencies.values()].map(dependency => {
275
- var _a;
276
273
  const resolutionHash = project.storedResolutions.get(dependency.descriptorHash);
277
274
  const resolution = typeof resolutionHash !== `undefined`
278
- ? (_a = project.storedPackages.get(resolutionHash)) !== null && _a !== void 0 ? _a : null
275
+ ? project.storedPackages.get(resolutionHash) ?? null
279
276
  : null;
280
277
  return core_1.formatUtils.tuple(core_1.formatUtils.Type.RESOLUTION, {
281
278
  descriptor: dependency,
@@ -285,13 +282,12 @@ class InfoCommand extends cli_1.BaseCommand {
285
282
  }
286
283
  if (pkg.peerDependencies.size > 0 && isVirtual) {
287
284
  registerData(`Peer dependencies`, [...pkg.peerDependencies.values()].map(peerDependency => {
288
- var _a, _b;
289
285
  const dependency = pkg.dependencies.get(peerDependency.identHash);
290
286
  const resolutionHash = typeof dependency !== `undefined`
291
- ? (_a = project.storedResolutions.get(dependency.descriptorHash)) !== null && _a !== void 0 ? _a : null
287
+ ? project.storedResolutions.get(dependency.descriptorHash) ?? null
292
288
  : null;
293
289
  const resolution = resolutionHash !== null
294
- ? (_b = project.storedPackages.get(resolutionHash)) !== null && _b !== void 0 ? _b : null
290
+ ? project.storedPackages.get(resolutionHash) ?? null
295
291
  : null;
296
292
  return core_1.formatUtils.tuple(core_1.formatUtils.Type.RESOLUTION, {
297
293
  descriptor: peerDependency,
@@ -308,7 +304,6 @@ class InfoCommand extends cli_1.BaseCommand {
308
304
  });
309
305
  }
310
306
  }
311
- exports.default = InfoCommand;
312
307
  InfoCommand.paths = [
313
308
  [`info`],
314
309
  ];
@@ -328,3 +323,4 @@ InfoCommand.usage = clipanion_1.Command.Usage({
328
323
  `$0 info lodash`,
329
324
  ]],
330
325
  });
326
+ exports.default = InfoCommand;
@@ -21,5 +21,5 @@ export default class YarnCommand extends BaseCommand {
21
21
  registry: string | undefined;
22
22
  silent: boolean | undefined;
23
23
  networkTimeout: string | undefined;
24
- execute(): Promise<1 | 0>;
24
+ execute(): Promise<0 | 1>;
25
25
  }