@yarnpkg/plugin-essentials 4.0.0-rc.4 → 4.0.0-rc.41

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 +28 -17
  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 +2 -2
  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 +1 -1
  23. package/lib/commands/explain.js +1 -1
  24. package/lib/commands/info.js +2 -2
  25. package/lib/commands/install.d.ts +1 -1
  26. package/lib/commands/install.js +60 -67
  27. package/lib/commands/link.d.ts +2 -2
  28. package/lib/commands/link.js +32 -26
  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 +62 -0
  32. package/lib/commands/plugin/import/sources.d.ts +3 -3
  33. package/lib/commands/plugin/import/sources.js +4 -4
  34. package/lib/commands/plugin/import.d.ts +5 -4
  35. package/lib/commands/plugin/import.js +14 -27
  36. package/lib/commands/plugin/list.d.ts +2 -2
  37. package/lib/commands/plugin/list.js +4 -4
  38. package/lib/commands/plugin/remove.d.ts +1 -1
  39. package/lib/commands/plugin/remove.js +1 -1
  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 +4 -4
  44. package/lib/commands/remove.d.ts +1 -1
  45. package/lib/commands/remove.js +3 -3
  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 +1 -1
  51. package/lib/commands/set/version/sources.d.ts +2 -2
  52. package/lib/commands/set/version/sources.js +1 -1
  53. package/lib/commands/set/version.d.ts +2 -3
  54. package/lib/commands/set/version.js +18 -12
  55. package/lib/commands/unlink.d.ts +1 -1
  56. package/lib/commands/unlink.js +1 -1
  57. package/lib/commands/up.d.ts +3 -3
  58. package/lib/commands/up.js +4 -4
  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 +1 -2
  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 +6 -6
  69. package/package.json +20 -14
@@ -21,9 +21,17 @@ class SetVersionCommand extends cli_1.BaseCommand {
21
21
  this.version = clipanion_1.Option.String();
22
22
  }
23
23
  async execute() {
24
+ var _a;
24
25
  const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
25
- if (configuration.get(`yarnPath`) && this.onlyIfNeeded)
26
- return 0;
26
+ if (this.onlyIfNeeded && configuration.get(`yarnPath`)) {
27
+ const yarnPathSource = configuration.sources.get(`yarnPath`);
28
+ if (!yarnPathSource)
29
+ throw new Error(`Assertion failed: Expected 'yarnPath' to have a source`);
30
+ const projectCwd = (_a = configuration.projectCwd) !== null && _a !== void 0 ? _a : configuration.startingCwd;
31
+ if (fslib_1.ppath.contains(projectCwd, yarnPathSource)) {
32
+ return 0;
33
+ }
34
+ }
27
35
  const getBundlePath = () => {
28
36
  if (typeof core_1.YarnVersion === `undefined`)
29
37
  throw new clipanion_1.UsageError(`The --install flag can only be used without explicit version specifier from the Yarn CLI`);
@@ -40,7 +48,7 @@ class SetVersionCommand extends cli_1.BaseCommand {
40
48
  else if (this.version === `canary`)
41
49
  bundleRef = getRef(`https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js`, await resolveTag(configuration, `canary`));
42
50
  else if (this.version === `classic`)
43
- bundleRef = { url: `https://nightly.yarnpkg.com/latest.js`, version: `classic` };
51
+ bundleRef = { url: `https://classic.yarnpkg.com/latest.js`, version: `classic` };
44
52
  else if (this.version.match(/^https?:/))
45
53
  bundleRef = { url: this.version, version: `remote` };
46
54
  else if (this.version.match(/^\.{0,2}[\\/]/) || fslib_1.npath.isAbsolute(this.version))
@@ -61,11 +69,11 @@ class SetVersionCommand extends cli_1.BaseCommand {
61
69
  const fetchBuffer = async () => {
62
70
  const filePrefix = `file://`;
63
71
  if (bundleRef.url.startsWith(filePrefix)) {
64
- report.reportInfo(core_1.MessageName.UNNAMED, `Retrieving ${core_2.formatUtils.pretty(configuration, bundleRef.url, core_1.FormatType.PATH)}`);
72
+ report.reportInfo(core_1.MessageName.UNNAMED, `Retrieving ${core_2.formatUtils.pretty(configuration, bundleRef.url, core_2.formatUtils.Type.PATH)}`);
65
73
  return await fslib_1.xfs.readFilePromise(bundleRef.url.slice(filePrefix.length));
66
74
  }
67
75
  else {
68
- report.reportInfo(core_1.MessageName.UNNAMED, `Downloading ${core_2.formatUtils.pretty(configuration, bundleRef.url, core_1.FormatType.URL)}`);
76
+ report.reportInfo(core_1.MessageName.UNNAMED, `Downloading ${core_2.formatUtils.pretty(configuration, bundleRef.url, core_2.formatUtils.Type.URL)}`);
69
77
  return await core_2.httpUtils.get(bundleRef.url, { configuration });
70
78
  }
71
79
  };
@@ -74,7 +82,6 @@ class SetVersionCommand extends cli_1.BaseCommand {
74
82
  return report.exitCode();
75
83
  }
76
84
  }
77
- exports.default = SetVersionCommand;
78
85
  SetVersionCommand.paths = [
79
86
  [`set`, `version`],
80
87
  ];
@@ -85,7 +92,7 @@ SetVersionCommand.usage = clipanion_1.Command.Usage({
85
92
 
86
93
  By default it only will set the \`packageManager\` field at the root of your project, but if the referenced release cannot be represented this way, if you already have \`yarnPath\` configured, or if you set the \`--yarn-path\` command line flag, then the release will also be downloaded from the Yarn GitHub repository, stored inside your project, and referenced via the \`yarnPath\` settings from your project \`.yarnrc.yml\` file.
87
94
 
88
- A very good use case for this command is to enforce the version of Yarn used by the any single member of your team inside a same project - by doing this you ensure that you have control on Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting a different behavior than you.
95
+ A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.
89
96
 
90
97
  The version specifier can be:
91
98
 
@@ -131,6 +138,7 @@ SetVersionCommand.usage = clipanion_1.Command.Usage({
131
138
  `$0 set version self`,
132
139
  ]],
133
140
  });
141
+ exports.default = SetVersionCommand;
134
142
  async function resolveRange(configuration, request) {
135
143
  const data = await core_2.httpUtils.get(`https://repo.yarnpkg.com/tags`, { configuration, jsonResponse: true });
136
144
  const candidates = data.tags.filter(version => core_2.semverUtils.satisfiesWithPrereleases(version, request));
@@ -193,11 +201,9 @@ async function setVersion(configuration, bundleVersion, fetchBuffer, { report, u
193
201
  await fslib_1.xfs.removePromise(fslib_1.ppath.dirname(absolutePath));
194
202
  await fslib_1.xfs.mkdirPromise(fslib_1.ppath.dirname(absolutePath), { recursive: true });
195
203
  await fslib_1.xfs.writeFilePromise(absolutePath, bundleBuffer, { mode: 0o755 });
196
- if (!yarnPath || fslib_1.ppath.contains(releaseFolder, yarnPath)) {
197
- await core_1.Configuration.updateConfiguration(projectCwd, {
198
- yarnPath: fslib_1.ppath.relative(projectCwd, absolutePath),
199
- });
200
- }
204
+ await core_1.Configuration.updateConfiguration(projectCwd, {
205
+ yarnPath: fslib_1.ppath.relative(projectCwd, absolutePath),
206
+ });
201
207
  }
202
208
  else {
203
209
  await fslib_1.xfs.removePromise(fslib_1.ppath.dirname(absolutePath));
@@ -5,5 +5,5 @@ export default class UnlinkCommand extends BaseCommand {
5
5
  static usage: Usage;
6
6
  all: boolean;
7
7
  leadingArguments: string[];
8
- execute(): Promise<1 | 0>;
8
+ execute(): Promise<0 | 1>;
9
9
  }
@@ -72,7 +72,6 @@ class UnlinkCommand extends cli_1.BaseCommand {
72
72
  return report.exitCode();
73
73
  }
74
74
  }
75
- exports.default = UnlinkCommand;
76
75
  UnlinkCommand.paths = [
77
76
  [`unlink`],
78
77
  ];
@@ -95,3 +94,4 @@ UnlinkCommand.usage = clipanion_1.Command.Usage({
95
94
  `$0 unlink '@babel/*' 'pkg-{a,b}'`,
96
95
  ]],
97
96
  });
97
+ exports.default = UnlinkCommand;
@@ -18,7 +18,7 @@ export default class UpCommand extends BaseCommand {
18
18
  }, {
19
19
  [key: string]: unknown;
20
20
  }>[];
21
- execute(): Promise<1 | 0>;
22
- executeUpRecursive(): Promise<1 | 0>;
23
- executeUpClassic(): Promise<1 | 0>;
21
+ execute(): Promise<0 | 1>;
22
+ executeUpRecursive(): Promise<0 | 1>;
23
+ executeUpClassic(): Promise<0 | 1>;
24
24
  }
@@ -140,9 +140,9 @@ class UpCommand extends cli_1.BaseCommand {
140
140
  }
141
141
  }
142
142
  if (unreferencedPatterns.length > 1)
143
- throw new clipanion_1.UsageError(`Patterns ${core_3.formatUtils.prettyList(configuration, unreferencedPatterns, core_3.FormatType.CODE)} don't match any packages referenced by any workspace`);
143
+ throw new clipanion_1.UsageError(`Patterns ${core_3.formatUtils.prettyList(configuration, unreferencedPatterns, core_3.formatUtils.Type.CODE)} don't match any packages referenced by any workspace`);
144
144
  if (unreferencedPatterns.length > 0)
145
- throw new clipanion_1.UsageError(`Pattern ${core_3.formatUtils.prettyList(configuration, unreferencedPatterns, core_3.FormatType.CODE)} doesn't match any packages referenced by any workspace`);
145
+ throw new clipanion_1.UsageError(`Pattern ${core_3.formatUtils.prettyList(configuration, unreferencedPatterns, core_3.formatUtils.Type.CODE)} doesn't match any packages referenced by any workspace`);
146
146
  const allSuggestions = await Promise.all(allSuggestionsPromises);
147
147
  const checkReport = await core_3.LightReport.start({
148
148
  configuration,
@@ -240,7 +240,6 @@ class UpCommand extends cli_1.BaseCommand {
240
240
  return installReport.exitCode();
241
241
  }
242
242
  }
243
- exports.default = UpCommand;
244
243
  UpCommand.paths = [
245
244
  [`up`],
246
245
  ];
@@ -257,7 +256,7 @@ UpCommand.usage = clipanion_1.Command.Usage({
257
256
 
258
257
  If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
259
258
 
260
- - \`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.
259
+ - \`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.
261
260
 
262
261
  - \`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.
263
262
 
@@ -290,3 +289,4 @@ UpCommand.usage = clipanion_1.Command.Usage({
290
289
  UpCommand.schema = [
291
290
  t.hasKeyRelationship(`recursive`, t.KeyRelationship.Forbids, [`interactive`, `exact`, `tilde`, `caret`], { ignore: [undefined, false] }),
292
291
  ];
292
+ exports.default = UpCommand;
@@ -38,7 +38,6 @@ class WhyCommand extends cli_1.BaseCommand {
38
38
  });
39
39
  }
40
40
  }
41
- exports.default = WhyCommand;
42
41
  WhyCommand.paths = [
43
42
  [`why`],
44
43
  ];
@@ -54,6 +53,7 @@ WhyCommand.usage = clipanion_1.Command.Usage({
54
53
  `$0 why lodash`,
55
54
  ]],
56
55
  });
56
+ exports.default = WhyCommand;
57
57
  function whySimple(project, identHash, { configuration, peers }) {
58
58
  const sortedPackages = core_3.miscUtils.sortMap(project.storedPackages.values(), pkg => {
59
59
  return core_3.structUtils.stringifyLocator(pkg);
@@ -121,12 +121,8 @@ function whyRecursive(project, identHash, { configuration, peers }) {
121
121
  dependents.add(pkg.locatorHash);
122
122
  return depends;
123
123
  };
124
- for (const workspace of sortedWorkspaces) {
125
- const pkg = project.storedPackages.get(workspace.anchoredLocator.locatorHash);
126
- if (!pkg)
127
- throw new Error(`Assertion failed: The package should have been registered`);
128
- markAllDependents(pkg);
129
- }
124
+ for (const workspace of sortedWorkspaces)
125
+ markAllDependents(workspace.anchoredPackage);
130
126
  const printed = new Set();
131
127
  const rootChildren = {};
132
128
  const root = { children: rootChildren };
@@ -164,11 +160,7 @@ function whyRecursive(project, identHash, { configuration, peers }) {
164
160
  printAllDependents(nextPkg, nodeChildren, dependency);
165
161
  }
166
162
  };
167
- for (const workspace of sortedWorkspaces) {
168
- const pkg = project.storedPackages.get(workspace.anchoredLocator.locatorHash);
169
- if (!pkg)
170
- throw new Error(`Assertion failed: The package should have been registered`);
171
- printAllDependents(pkg, rootChildren, null);
172
- }
163
+ for (const workspace of sortedWorkspaces)
164
+ printAllDependents(workspace.anchoredPackage, rootChildren, null);
173
165
  return root;
174
166
  }
@@ -18,10 +18,7 @@ class WorkspaceCommand extends cli_1.BaseCommand {
18
18
  if (!cwdWorkspace)
19
19
  throw new cli_1.WorkspaceRequiredError(project.cwd, this.context.cwd);
20
20
  const candidates = project.workspaces;
21
- const candidatesByName = new Map(candidates.map((workspace) => {
22
- const ident = core_2.structUtils.convertToIdent(workspace.locator);
23
- return [core_2.structUtils.stringifyIdent(ident), workspace];
24
- }));
21
+ const candidatesByName = new Map(candidates.map(workspace => [core_2.structUtils.stringifyIdent(workspace.locator), workspace]));
25
22
  const workspace = candidatesByName.get(this.workspaceName);
26
23
  if (workspace === undefined) {
27
24
  const otherNames = Array.from(candidatesByName.keys()).sort();
@@ -30,7 +27,6 @@ class WorkspaceCommand extends cli_1.BaseCommand {
30
27
  return this.cli.run([this.commandName, ...this.args], { cwd: workspace.cwd });
31
28
  }
32
29
  }
33
- exports.default = WorkspaceCommand;
34
30
  WorkspaceCommand.paths = [
35
31
  [`workspace`],
36
32
  ];
@@ -48,3 +44,4 @@ WorkspaceCommand.usage = clipanion_1.Command.Usage({
48
44
  `yarn workspace components run build`,
49
45
  ]],
50
46
  });
47
+ exports.default = WorkspaceCommand;
@@ -5,7 +5,8 @@ export default class WorkspacesListCommand extends BaseCommand {
5
5
  static usage: Usage;
6
6
  since: string | boolean | undefined;
7
7
  recursive: boolean;
8
+ noPrivate: boolean | undefined;
8
9
  verbose: boolean;
9
10
  json: boolean;
10
- execute(): Promise<1 | 0>;
11
+ execute(): Promise<0 | 1>;
11
12
  }
@@ -15,6 +15,9 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
15
15
  this.recursive = clipanion_1.Option.Boolean(`-R,--recursive`, false, {
16
16
  description: `Find packages via dependencies/devDependencies instead of using the workspaces field`,
17
17
  });
18
+ this.noPrivate = clipanion_1.Option.Boolean(`--no-private`, {
19
+ description: `Exclude workspaces that have the private field set to true`,
20
+ });
18
21
  this.verbose = clipanion_1.Option.Boolean(`-v,--verbose`, false, {
19
22
  description: `Also return the cross-dependencies between workspaces`,
20
23
  });
@@ -40,6 +43,8 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
40
43
  workspaces.add(dependent);
41
44
  for (const workspace of workspaces) {
42
45
  const { manifest } = workspace;
46
+ if (manifest.private && this.noPrivate)
47
+ continue;
43
48
  let extra;
44
49
  if (this.verbose) {
45
50
  const workspaceDependencies = new Set();
@@ -79,7 +84,6 @@ class WorkspacesListCommand extends cli_1.BaseCommand {
79
84
  return report.exitCode();
80
85
  }
81
86
  }
82
- exports.default = WorkspacesListCommand;
83
87
  WorkspacesListCommand.paths = [
84
88
  [`workspaces`, `list`],
85
89
  ];
@@ -93,6 +97,9 @@ WorkspacesListCommand.usage = clipanion_1.Command.Usage({
93
97
 
94
98
  - If \`-R,--recursive\` is set, Yarn will find workspaces to run the command on by recursively evaluating \`dependencies\` and \`devDependencies\` fields, instead of looking at the \`workspaces\` fields.
95
99
 
100
+ - If \`--no-private\` is set, Yarn will not list any workspaces that have the \`private\` field set to \`true\`.
101
+
96
102
  - If both the \`-v,--verbose\` and \`--json\` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).
97
103
  `,
98
104
  });
105
+ exports.default = WorkspacesListCommand;
@@ -1,12 +1,12 @@
1
1
  import { Project, ResolveOptions, Resolver, Descriptor, Package, Report, Cache } from '@yarnpkg/core';
2
2
  import { Fetcher, FetchOptions } from '@yarnpkg/core';
3
- export declare type PackageUpdate = {
3
+ export type PackageUpdate = {
4
4
  descriptor: Descriptor;
5
5
  currentPackage: Package;
6
6
  updatedPackage: Package;
7
7
  resolvedPackage: Package;
8
8
  };
9
- export declare type Algorithm = (project: Project, patterns: Array<string>, opts: {
9
+ export type Algorithm = (project: Project, patterns: Array<string>, opts: {
10
10
  resolver: Resolver;
11
11
  resolveOptions: ResolveOptions;
12
12
  fetcher: Fetcher;
@@ -23,7 +23,7 @@ export declare enum Strategy {
23
23
  HIGHEST = "highest"
24
24
  }
25
25
  export declare const acceptedStrategies: Set<Strategy.HIGHEST>;
26
- export declare type DedupeOptions = {
26
+ export type DedupeOptions = {
27
27
  strategy: Strategy;
28
28
  patterns: Array<string>;
29
29
  cache: Cache;
@@ -109,7 +109,6 @@ async function dedupe(project, { strategy, patterns, cache, report }) {
109
109
  fetcher,
110
110
  project,
111
111
  report: throwReport,
112
- skipIntegrityCheck: true,
113
112
  cacheOptions: {
114
113
  skipIntegrityCheck: true,
115
114
  },
@@ -124,7 +123,7 @@ async function dedupe(project, { strategy, patterns, cache, report }) {
124
123
  const algorithm = DEDUPE_ALGORITHMS[strategy];
125
124
  const dedupePromises = await algorithm(project, patterns, { resolver, resolveOptions, fetcher, fetchOptions });
126
125
  const progress = core_1.Report.progressViaCounter(dedupePromises.length);
127
- report.reportProgress(progress);
126
+ await report.reportProgress(progress);
128
127
  let dedupedPackageCount = 0;
129
128
  await Promise.all(dedupePromises.map(dedupePromise => dedupePromise
130
129
  .then(dedupe => {
package/lib/index.d.ts CHANGED
@@ -1,8 +1,83 @@
1
1
  import { Descriptor, Plugin, Package, formatUtils } from '@yarnpkg/core';
2
2
  import { Workspace } from '@yarnpkg/core';
3
+ import AddCommand from './commands/add';
4
+ import BinCommand from './commands/bin';
5
+ import CacheCleanCommand from './commands/cache/clean';
6
+ import ConfigGetCommand from './commands/config/get';
7
+ import ConfigSetCommand from './commands/config/set';
8
+ import ConfigUnsetCommand from './commands/config/unset';
9
+ import ConfigCommand from './commands/config';
10
+ import DedupeCommand from './commands/dedupe';
11
+ import ClipanionCommand from './commands/entries/clipanion';
12
+ import HelpCommand from './commands/entries/help';
13
+ import EntryCommand from './commands/entries/run';
14
+ import VersionCommand from './commands/entries/version';
15
+ import ExecCommand from './commands/exec';
16
+ import ExplainPeerRequirementsCommand from './commands/explain/peerRequirements';
17
+ import ExplainCommand from './commands/explain';
18
+ import InfoCommand from './commands/info';
19
+ import YarnCommand from './commands/install';
20
+ import LinkCommand from './commands/link';
21
+ import NodeCommand from './commands/node';
22
+ import PluginCheckCommand from './commands/plugin/check';
23
+ import PluginImportSourcesCommand from './commands/plugin/import/sources';
24
+ import PluginImportCommand from './commands/plugin/import';
25
+ import PluginListCommand from './commands/plugin/list';
26
+ import PluginRemoveCommand from './commands/plugin/remove';
27
+ import PluginRuntimeCommand from './commands/plugin/runtime';
28
+ import RebuildCommand from './commands/rebuild';
29
+ import RemoveCommand from './commands/remove';
30
+ import RunIndexCommand from './commands/runIndex';
31
+ import RunCommand from './commands/run';
32
+ import SetResolutionCommand from './commands/set/resolution';
33
+ import SetVersionSourcesCommand from './commands/set/version/sources';
34
+ import SetVersionCommand from './commands/set/version';
35
+ import UnlinkCommand from './commands/unlink';
36
+ import UpCommand from './commands/up';
37
+ import WhyCommand from './commands/why';
38
+ import WorkspacesListCommand from './commands/workspaces/list';
39
+ import WorkspaceCommand from './commands/workspace';
3
40
  import * as dedupeUtils from './dedupeUtils';
4
41
  import * as suggestUtils from './suggestUtils';
5
- export { dedupeUtils, suggestUtils, };
42
+ export { AddCommand };
43
+ export { BinCommand };
44
+ export { CacheCleanCommand };
45
+ export { ConfigGetCommand };
46
+ export { ConfigSetCommand };
47
+ export { ConfigUnsetCommand };
48
+ export { ConfigCommand };
49
+ export { DedupeCommand };
50
+ export { ClipanionCommand };
51
+ export { HelpCommand };
52
+ export { EntryCommand };
53
+ export { VersionCommand };
54
+ export { ExecCommand };
55
+ export { ExplainPeerRequirementsCommand };
56
+ export { ExplainCommand };
57
+ export { InfoCommand };
58
+ export { YarnCommand };
59
+ export { LinkCommand };
60
+ export { NodeCommand };
61
+ export { PluginImportSourcesCommand };
62
+ export { PluginCheckCommand };
63
+ export { PluginImportCommand };
64
+ export { PluginListCommand };
65
+ export { PluginRemoveCommand };
66
+ export { PluginRuntimeCommand };
67
+ export { RebuildCommand };
68
+ export { RemoveCommand };
69
+ export { RunIndexCommand };
70
+ export { RunCommand };
71
+ export { SetResolutionCommand };
72
+ export { SetVersionSourcesCommand };
73
+ export { SetVersionCommand };
74
+ export { UnlinkCommand };
75
+ export { UpCommand };
76
+ export { WhyCommand };
77
+ export { WorkspacesListCommand };
78
+ export { WorkspaceCommand };
79
+ export { dedupeUtils };
80
+ export { suggestUtils };
6
81
  export interface Hooks {
7
82
  /**
8
83
  * Called when a new dependency is added to a workspace. Note that this hook
package/lib/index.js CHANGED
@@ -1,45 +1,83 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.suggestUtils = exports.dedupeUtils = void 0;
3
+ exports.suggestUtils = exports.dedupeUtils = exports.WorkspaceCommand = exports.WorkspacesListCommand = exports.WhyCommand = exports.UpCommand = exports.UnlinkCommand = exports.SetVersionCommand = exports.SetVersionSourcesCommand = exports.SetResolutionCommand = exports.RunCommand = exports.RunIndexCommand = exports.RemoveCommand = exports.RebuildCommand = exports.PluginRuntimeCommand = exports.PluginRemoveCommand = exports.PluginListCommand = exports.PluginImportCommand = exports.PluginCheckCommand = exports.PluginImportSourcesCommand = exports.NodeCommand = exports.LinkCommand = exports.YarnCommand = exports.InfoCommand = exports.ExplainCommand = exports.ExplainPeerRequirementsCommand = exports.ExecCommand = exports.VersionCommand = exports.EntryCommand = exports.HelpCommand = exports.ClipanionCommand = exports.DedupeCommand = exports.ConfigCommand = exports.ConfigUnsetCommand = exports.ConfigSetCommand = exports.ConfigGetCommand = exports.CacheCleanCommand = exports.BinCommand = exports.AddCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@yarnpkg/core");
6
6
  const ci_info_1 = require("ci-info");
7
7
  const add_1 = tslib_1.__importDefault(require("./commands/add"));
8
+ exports.AddCommand = add_1.default;
8
9
  const bin_1 = tslib_1.__importDefault(require("./commands/bin"));
10
+ exports.BinCommand = bin_1.default;
9
11
  const clean_1 = tslib_1.__importDefault(require("./commands/cache/clean"));
12
+ exports.CacheCleanCommand = clean_1.default;
10
13
  const get_1 = tslib_1.__importDefault(require("./commands/config/get"));
14
+ exports.ConfigGetCommand = get_1.default;
11
15
  const set_1 = tslib_1.__importDefault(require("./commands/config/set"));
16
+ exports.ConfigSetCommand = set_1.default;
12
17
  const unset_1 = tslib_1.__importDefault(require("./commands/config/unset"));
18
+ exports.ConfigUnsetCommand = unset_1.default;
13
19
  const config_1 = tslib_1.__importDefault(require("./commands/config"));
20
+ exports.ConfigCommand = config_1.default;
14
21
  const dedupe_1 = tslib_1.__importDefault(require("./commands/dedupe"));
22
+ exports.DedupeCommand = dedupe_1.default;
15
23
  const clipanion_1 = tslib_1.__importDefault(require("./commands/entries/clipanion"));
24
+ exports.ClipanionCommand = clipanion_1.default;
16
25
  const help_1 = tslib_1.__importDefault(require("./commands/entries/help"));
26
+ exports.HelpCommand = help_1.default;
17
27
  const run_1 = tslib_1.__importDefault(require("./commands/entries/run"));
28
+ exports.EntryCommand = run_1.default;
18
29
  const version_1 = tslib_1.__importDefault(require("./commands/entries/version"));
30
+ exports.VersionCommand = version_1.default;
19
31
  const exec_1 = tslib_1.__importDefault(require("./commands/exec"));
32
+ exports.ExecCommand = exec_1.default;
20
33
  const peerRequirements_1 = tslib_1.__importDefault(require("./commands/explain/peerRequirements"));
34
+ exports.ExplainPeerRequirementsCommand = peerRequirements_1.default;
21
35
  const explain_1 = tslib_1.__importDefault(require("./commands/explain"));
36
+ exports.ExplainCommand = explain_1.default;
22
37
  const info_1 = tslib_1.__importDefault(require("./commands/info"));
38
+ exports.InfoCommand = info_1.default;
23
39
  const install_1 = tslib_1.__importDefault(require("./commands/install"));
40
+ exports.YarnCommand = install_1.default;
24
41
  const link_1 = tslib_1.__importDefault(require("./commands/link"));
42
+ exports.LinkCommand = link_1.default;
25
43
  const node_1 = tslib_1.__importDefault(require("./commands/node"));
44
+ exports.NodeCommand = node_1.default;
45
+ const check_1 = tslib_1.__importDefault(require("./commands/plugin/check"));
46
+ exports.PluginCheckCommand = check_1.default;
26
47
  const sources_1 = tslib_1.__importDefault(require("./commands/plugin/import/sources"));
48
+ exports.PluginImportSourcesCommand = sources_1.default;
27
49
  const import_1 = tslib_1.__importDefault(require("./commands/plugin/import"));
50
+ exports.PluginImportCommand = import_1.default;
28
51
  const list_1 = tslib_1.__importDefault(require("./commands/plugin/list"));
52
+ exports.PluginListCommand = list_1.default;
29
53
  const remove_1 = tslib_1.__importDefault(require("./commands/plugin/remove"));
54
+ exports.PluginRemoveCommand = remove_1.default;
30
55
  const runtime_1 = tslib_1.__importDefault(require("./commands/plugin/runtime"));
56
+ exports.PluginRuntimeCommand = runtime_1.default;
31
57
  const rebuild_1 = tslib_1.__importDefault(require("./commands/rebuild"));
58
+ exports.RebuildCommand = rebuild_1.default;
32
59
  const remove_2 = tslib_1.__importDefault(require("./commands/remove"));
60
+ exports.RemoveCommand = remove_2.default;
33
61
  const runIndex_1 = tslib_1.__importDefault(require("./commands/runIndex"));
62
+ exports.RunIndexCommand = runIndex_1.default;
34
63
  const run_2 = tslib_1.__importDefault(require("./commands/run"));
64
+ exports.RunCommand = run_2.default;
35
65
  const resolution_1 = tslib_1.__importDefault(require("./commands/set/resolution"));
66
+ exports.SetResolutionCommand = resolution_1.default;
36
67
  const sources_2 = tslib_1.__importDefault(require("./commands/set/version/sources"));
68
+ exports.SetVersionSourcesCommand = sources_2.default;
37
69
  const version_2 = tslib_1.__importDefault(require("./commands/set/version"));
70
+ exports.SetVersionCommand = version_2.default;
38
71
  const unlink_1 = tslib_1.__importDefault(require("./commands/unlink"));
72
+ exports.UnlinkCommand = unlink_1.default;
39
73
  const up_1 = tslib_1.__importDefault(require("./commands/up"));
74
+ exports.UpCommand = up_1.default;
40
75
  const why_1 = tslib_1.__importDefault(require("./commands/why"));
76
+ exports.WhyCommand = why_1.default;
41
77
  const list_2 = tslib_1.__importDefault(require("./commands/workspaces/list"));
78
+ exports.WorkspacesListCommand = list_2.default;
42
79
  const workspace_1 = tslib_1.__importDefault(require("./commands/workspace"));
80
+ exports.WorkspaceCommand = workspace_1.default;
43
81
  const dedupeUtils = tslib_1.__importStar(require("./dedupeUtils"));
44
82
  exports.dedupeUtils = dedupeUtils;
45
83
  const suggestUtils = tslib_1.__importStar(require("./suggestUtils"));
@@ -88,6 +126,7 @@ const plugin = {
88
126
  link_1.default,
89
127
  unlink_1.default,
90
128
  node_1.default,
129
+ check_1.default,
91
130
  sources_1.default,
92
131
  import_1.default,
93
132
  remove_1.default,
@@ -1,16 +1,16 @@
1
1
  import { Cache, DescriptorHash, Descriptor, Ident, Locator, Project, Workspace } from '@yarnpkg/core';
2
2
  import { PortablePath } from '@yarnpkg/fslib';
3
- export declare type Suggestion = {
3
+ export type Suggestion = {
4
4
  descriptor: Descriptor;
5
5
  name: string;
6
6
  reason: string;
7
7
  };
8
- export declare type NullableSuggestion = {
8
+ export type NullableSuggestion = {
9
9
  descriptor: Descriptor | null;
10
10
  name: string;
11
11
  reason: string;
12
12
  };
13
- export declare type Results = {
13
+ export type Results = {
14
14
  suggestions: Array<NullableSuggestion>;
15
15
  rejections: Array<Error>;
16
16
  };
@@ -88,7 +88,7 @@ export declare function getSuggestedDescriptors(request: Descriptor, { project,
88
88
  strategies: Array<Strategy>;
89
89
  maxResults?: number;
90
90
  }): Promise<Results>;
91
- export declare type FetchDescriptorFromOptions = {
91
+ export type FetchDescriptorFromOptions = {
92
92
  project: Project;
93
93
  cache: Cache;
94
94
  workspace: Workspace;
@@ -109,7 +109,7 @@ async function findProjectDescriptors(ident, { project, target }) {
109
109
  if (target === Target.PEER) {
110
110
  const peerDescriptor = workspace.manifest.peerDependencies.get(ident.identHash);
111
111
  if (peerDescriptor !== undefined) {
112
- getDescriptorEntry(peerDescriptor).locators.push(workspace.locator);
112
+ getDescriptorEntry(peerDescriptor).locators.push(workspace.anchoredLocator);
113
113
  }
114
114
  }
115
115
  else {
@@ -117,18 +117,18 @@ async function findProjectDescriptors(ident, { project, target }) {
117
117
  const developmentDescriptor = workspace.manifest.devDependencies.get(ident.identHash);
118
118
  if (target === Target.DEVELOPMENT) {
119
119
  if (developmentDescriptor !== undefined) {
120
- getDescriptorEntry(developmentDescriptor).locators.push(workspace.locator);
120
+ getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
121
121
  }
122
122
  else if (regularDescriptor !== undefined) {
123
- getDescriptorEntry(regularDescriptor).locators.push(workspace.locator);
123
+ getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
124
124
  }
125
125
  }
126
126
  else {
127
127
  if (regularDescriptor !== undefined) {
128
- getDescriptorEntry(regularDescriptor).locators.push(workspace.locator);
128
+ getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
129
129
  }
130
130
  else if (developmentDescriptor !== undefined) {
131
- getDescriptorEntry(developmentDescriptor).locators.push(workspace.locator);
131
+ getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
132
132
  }
133
133
  }
134
134
  }
@@ -310,7 +310,7 @@ async function fetchDescriptorFrom(ident, range, { project, cache, workspace, pr
310
310
  const report = new core_1.ThrowReport();
311
311
  const fetcher = project.configuration.makeFetcher();
312
312
  const resolver = project.configuration.makeResolver();
313
- const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: { skipIntegrityCheck: true }, skipIntegrityCheck: true };
313
+ const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: { skipIntegrityCheck: true } };
314
314
  const resolveOptions = { ...fetchOptions, resolver, fetchOptions };
315
315
  // The descriptor has to be bound for the resolvers that need a parent locator. (e.g. FileResolver)
316
316
  // If we didn't bind it, `yarn add ./folder` wouldn't work.
package/package.json CHANGED
@@ -1,32 +1,37 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.41",
4
+ "stableVersion": "3.3.0",
4
5
  "license": "BSD-2-Clause",
5
6
  "main": "./lib/index.js",
7
+ "exports": {
8
+ ".": "./lib/index.js",
9
+ "./package.json": "./package.json"
10
+ },
6
11
  "dependencies": {
7
- "@yarnpkg/fslib": "^3.0.0-rc.4",
8
- "@yarnpkg/parsers": "^3.0.0-rc.4",
12
+ "@yarnpkg/fslib": "^3.0.0-rc.41",
13
+ "@yarnpkg/parsers": "^3.0.0-rc.41",
9
14
  "ci-info": "^3.2.0",
10
15
  "clipanion": "^3.2.0-rc.10",
11
16
  "enquirer": "^2.3.6",
12
17
  "lodash": "^4.17.15",
13
18
  "micromatch": "^4.0.2",
14
19
  "semver": "^7.1.2",
15
- "tslib": "^1.13.0",
20
+ "tslib": "^2.4.0",
16
21
  "typanion": "^3.3.0"
17
22
  },
18
23
  "peerDependencies": {
19
- "@yarnpkg/cli": "^4.0.0-rc.4",
20
- "@yarnpkg/core": "^4.0.0-rc.4",
21
- "@yarnpkg/plugin-git": "^3.0.0-rc.4"
24
+ "@yarnpkg/cli": "^4.0.0-rc.41",
25
+ "@yarnpkg/core": "^4.0.0-rc.41",
26
+ "@yarnpkg/plugin-git": "^3.0.0-rc.41"
22
27
  },
23
28
  "devDependencies": {
24
29
  "@types/lodash": "^4.14.136",
25
30
  "@types/micromatch": "^4.0.1",
26
31
  "@types/semver": "^7.1.0",
27
- "@yarnpkg/cli": "^4.0.0-rc.4",
28
- "@yarnpkg/core": "^4.0.0-rc.4",
29
- "@yarnpkg/plugin-git": "^3.0.0-rc.4"
32
+ "@yarnpkg/cli": "^4.0.0-rc.41",
33
+ "@yarnpkg/core": "^4.0.0-rc.41",
34
+ "@yarnpkg/plugin-git": "^3.0.0-rc.41"
30
35
  },
31
36
  "repository": {
32
37
  "type": "git",
@@ -39,14 +44,15 @@
39
44
  },
40
45
  "publishConfig": {
41
46
  "main": "./lib/index.js",
42
- "typings": "./lib/index.d.ts"
47
+ "exports": {
48
+ ".": "./lib/index.js",
49
+ "./package.json": "./package.json"
50
+ }
43
51
  },
44
52
  "files": [
45
53
  "/lib/**/*"
46
54
  ],
47
55
  "engines": {
48
56
  "node": ">=14.15.0"
49
- },
50
- "stableVersion": "3.2.0",
51
- "typings": "./lib/index.d.ts"
57
+ }
52
58
  }