@yarnpkg/plugin-essentials 4.1.0 → 4.1.2

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { BaseCommand } from '@yarnpkg/cli';
3
2
  import { Project } from '@yarnpkg/core';
4
3
  import { Writable } from 'stream';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.explainPeerRequirements = void 0;
3
+ exports.explainPeerRequirements = explainPeerRequirements;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_1 = require("@yarnpkg/cli");
6
6
  const core_1 = require("@yarnpkg/core");
@@ -133,4 +133,3 @@ async function explainPeerRequirements(peerRequirementsHash, project, opts) {
133
133
  });
134
134
  return report.exitCode();
135
135
  }
136
- exports.explainPeerRequirements = explainPeerRequirements;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getErrorCodeDetails = void 0;
3
+ exports.getErrorCodeDetails = getErrorCodeDetails;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_1 = require("@yarnpkg/cli");
6
6
  const core_1 = require("@yarnpkg/core");
@@ -26,7 +26,6 @@ async function getErrorCodeDetails(configuration) {
26
26
  return [groups.code, groups.details];
27
27
  }));
28
28
  }
29
- exports.getErrorCodeDetails = getErrorCodeDetails;
30
29
  // eslint-disable-next-line arca/no-default-export
31
30
  class ExplainCommand extends cli_1.BaseCommand {
32
31
  constructor() {
@@ -289,11 +289,11 @@ YarnCommand.usage = clipanion_1.Command.Usage({
289
289
 
290
290
  - **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of \`cacheFolder\` in \`yarn config\` to see where the cache files are stored).
291
291
 
292
- - **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the .pnp.cjs file you might know).
292
+ - **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the \`.pnp.cjs\` file you might know).
293
293
 
294
294
  - **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another. See https://yarnpkg.com/advanced/lifecycle-scripts for detail.
295
295
 
296
- Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
296
+ Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your \`.pnp.cjs\` file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
297
297
 
298
298
  If the \`--immutable\` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the \`immutablePatterns\` configuration setting). For backward compatibility we offer an alias under the name of \`--frozen-lockfile\`, but it will be removed in a later release.
299
299
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildAndSavePlugin = void 0;
3
+ exports.buildAndSavePlugin = buildAndSavePlugin;
4
4
  const cli_1 = require("@yarnpkg/cli");
5
5
  const core_1 = require("@yarnpkg/core");
6
6
  const core_2 = require("@yarnpkg/core");
@@ -91,4 +91,3 @@ async function buildAndSavePlugin(pluginSpec, { context, noMinify }, { project,
91
91
  const pluginBuffer = await fslib_1.xfs.readFilePromise(pluginPath);
92
92
  await (0, import_1.savePlugin)(pluginSpec, pluginBuffer, { project, report });
93
93
  }
94
- exports.buildAndSavePlugin = buildAndSavePlugin;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { BaseCommand } from '@yarnpkg/cli';
3
2
  import { Project, Report } from '@yarnpkg/core';
4
3
  import { Usage } from 'clipanion';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.savePlugin = void 0;
3
+ exports.savePlugin = savePlugin;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_1 = require("@yarnpkg/cli");
6
6
  const core_1 = require("@yarnpkg/core");
@@ -133,4 +133,3 @@ async function savePlugin(pluginSpec, pluginBuffer, { checksum = true, project,
133
133
  pluginMeta.checksum = core_2.hashUtils.makeHash(pluginBuffer);
134
134
  await core_1.Configuration.addPlugin(project.cwd, [pluginMeta]);
135
135
  }
136
- exports.savePlugin = savePlugin;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAvailablePlugins = void 0;
3
+ exports.getAvailablePlugins = getAvailablePlugins;
4
4
  const cli_1 = require("@yarnpkg/cli");
5
5
  const core_1 = require("@yarnpkg/core");
6
6
  const parsers_1 = require("@yarnpkg/parsers");
@@ -13,7 +13,6 @@ async function getAvailablePlugins(configuration, version) {
13
13
  return !version || core_1.semverUtils.satisfiesWithPrereleases(version, pluginData.range ?? `<4.0.0-rc.1`);
14
14
  }));
15
15
  }
16
- exports.getAvailablePlugins = getAvailablePlugins;
17
16
  // eslint-disable-next-line arca/no-default-export
18
17
  class PluginListCommand extends cli_1.BaseCommand {
19
18
  constructor() {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareRepo = exports.runWorkflow = void 0;
3
+ exports.runWorkflow = runWorkflow;
4
+ exports.prepareRepo = prepareRepo;
4
5
  const cli_1 = require("@yarnpkg/cli");
5
6
  const core_1 = require("@yarnpkg/core");
6
7
  const fslib_1 = require("@yarnpkg/fslib");
@@ -141,7 +142,6 @@ async function runWorkflow(workflow, { configuration, context, target }) {
141
142
  }
142
143
  }
143
144
  }
144
- exports.runWorkflow = runWorkflow;
145
145
  async function prepareRepo(spec, { configuration, report, target }) {
146
146
  let ready = false;
147
147
  if (!spec.force && fslib_1.xfs.existsSync(fslib_1.ppath.join(target, `.git`))) {
@@ -164,7 +164,6 @@ async function prepareRepo(spec, { configuration, report, target }) {
164
164
  await runWorkflow(cloneWorkflow(spec, target), { configuration, context: spec.context, target });
165
165
  }
166
166
  }
167
- exports.prepareRepo = prepareRepo;
168
167
  async function updatePlugins(context, version, { project, report, target }) {
169
168
  const data = await (0, list_1.getAvailablePlugins)(project.configuration, version);
170
169
  const contribPlugins = new Set(Object.keys(data));
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { BaseCommand } from '@yarnpkg/cli';
3
2
  import { Configuration, Report } from '@yarnpkg/core';
4
3
  import { Usage } from 'clipanion';
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setVersion = exports.resolveTag = exports.resolveRange = void 0;
3
+ exports.resolveRange = resolveRange;
4
+ exports.resolveTag = resolveTag;
5
+ exports.setVersion = setVersion;
4
6
  const tslib_1 = require("tslib");
5
7
  const cli_1 = require("@yarnpkg/cli");
6
8
  const core_1 = require("@yarnpkg/core");
@@ -146,14 +148,12 @@ async function resolveRange(configuration, request) {
146
148
  // The tags on the website are sorted by semver descending
147
149
  return candidates[0];
148
150
  }
149
- exports.resolveRange = resolveRange;
150
151
  async function resolveTag(configuration, request) {
151
152
  const data = await core_2.httpUtils.get(`https://repo.yarnpkg.com/tags`, { configuration, jsonResponse: true });
152
153
  if (!data.latest[request])
153
154
  throw new clipanion_1.UsageError(`Tag ${core_2.formatUtils.pretty(configuration, request, core_2.formatUtils.Type.RANGE)} not found`);
154
155
  return data.latest[request];
155
156
  }
156
- exports.resolveTag = resolveTag;
157
157
  async function setVersion(configuration, bundleVersion, fetchBuffer, { report, useYarnPath }) {
158
158
  let bundleBuffer;
159
159
  const ensureBuffer = async () => {
@@ -225,4 +225,3 @@ async function setVersion(configuration, bundleVersion, fetchBuffer, { report, u
225
225
  bundleVersion: bundleVersion,
226
226
  };
227
227
  }
228
- exports.setVersion = setVersion;
@@ -139,15 +139,15 @@ function whyRecursive(project, identHash, { configuration, peers }) {
139
139
  };
140
140
  const key = core_3.structUtils.stringifyLocator(pkg);
141
141
  parentChildren[key] = node;
142
+ // We don't want to print the children of our transitive workspace
143
+ // dependencies, as they will be printed in their own top-level branch
144
+ if (dependency !== null && project.tryWorkspaceByLocator(pkg))
145
+ return;
142
146
  // We don't want to reprint the children for a package that already got
143
147
  // printed as part of another branch
144
148
  if (printed.has(pkg.locatorHash))
145
149
  return;
146
150
  printed.add(pkg.locatorHash);
147
- // We don't want to print the children of our transitive workspace
148
- // dependencies, as they will be printed in their own top-level branch
149
- if (dependency !== null && project.tryWorkspaceByLocator(pkg))
150
- return;
151
151
  for (const dependency of pkg.dependencies.values()) {
152
152
  if (!peers && pkg.peerDependencies.has(dependency.identHash))
153
153
  continue;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dedupe = exports.acceptedStrategies = exports.Strategy = void 0;
3
+ exports.acceptedStrategies = exports.Strategy = void 0;
4
+ exports.dedupe = dedupe;
4
5
  const tslib_1 = require("tslib");
5
6
  const core_1 = require("@yarnpkg/core");
6
7
  const core_2 = require("@yarnpkg/core");
@@ -160,4 +161,3 @@ async function dedupe(project, { strategy, patterns, cache, report }) {
160
161
  return dedupedPackageCount;
161
162
  });
162
163
  }
163
- exports.dedupe = dedupe;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchDescriptorFrom = exports.getSuggestedDescriptors = exports.extractDescriptorFromPath = exports.findProjectDescriptors = exports.makeWorkspaceDescriptor = exports.toWorkspaceModifier = exports.applyModifier = exports.extractRangeModifier = exports.getModifier = exports.Strategy = exports.WorkspaceModifier = exports.Modifier = exports.Target = void 0;
3
+ exports.Strategy = exports.WorkspaceModifier = exports.Modifier = exports.Target = void 0;
4
+ exports.getModifier = getModifier;
5
+ exports.extractRangeModifier = extractRangeModifier;
6
+ exports.applyModifier = applyModifier;
7
+ exports.toWorkspaceModifier = toWorkspaceModifier;
8
+ exports.makeWorkspaceDescriptor = makeWorkspaceDescriptor;
9
+ exports.findProjectDescriptors = findProjectDescriptors;
10
+ exports.extractDescriptorFromPath = extractDescriptorFromPath;
11
+ exports.getSuggestedDescriptors = getSuggestedDescriptors;
12
+ exports.fetchDescriptorFrom = fetchDescriptorFrom;
4
13
  const tslib_1 = require("tslib");
5
14
  const core_1 = require("@yarnpkg/core");
6
15
  const core_2 = require("@yarnpkg/core");
@@ -62,20 +71,17 @@ function getModifier(flags, project) {
62
71
  return Modifier.TILDE;
63
72
  return project.configuration.get(`defaultSemverRangePrefix`);
64
73
  }
65
- exports.getModifier = getModifier;
66
74
  const SIMPLE_SEMVER = /^([\^~]?)[0-9]+(?:\.[0-9]+){0,2}(?:-\S+)?$/;
67
75
  function extractRangeModifier(range, { project }) {
68
76
  const match = range.match(SIMPLE_SEMVER);
69
77
  return match ? match[1] : project.configuration.get(`defaultSemverRangePrefix`);
70
78
  }
71
- exports.extractRangeModifier = extractRangeModifier;
72
79
  function applyModifier(descriptor, modifier) {
73
80
  let { protocol, source, params, selector } = core_2.structUtils.parseRange(descriptor.range);
74
81
  if (semver_1.default.valid(selector))
75
82
  selector = `${modifier}${descriptor.range}`;
76
83
  return core_2.structUtils.makeDescriptor(descriptor, core_2.structUtils.makeRange({ protocol, source, params, selector }));
77
84
  }
78
- exports.applyModifier = applyModifier;
79
85
  function toWorkspaceModifier(modifier) {
80
86
  switch (modifier) {
81
87
  case Modifier.CARET:
@@ -88,11 +94,9 @@ function toWorkspaceModifier(modifier) {
88
94
  throw new Error(`Assertion failed: Unknown modifier: "${modifier}"`);
89
95
  }
90
96
  }
91
- exports.toWorkspaceModifier = toWorkspaceModifier;
92
97
  function makeWorkspaceDescriptor(workspace, modifier) {
93
98
  return core_2.structUtils.makeDescriptor(workspace.anchoredDescriptor, `${WORKSPACE_PROTOCOL}${toWorkspaceModifier(modifier)}`);
94
99
  }
95
- exports.makeWorkspaceDescriptor = makeWorkspaceDescriptor;
96
100
  async function findProjectDescriptors(ident, { project, target }) {
97
101
  const matches = new Map();
98
102
  const getDescriptorEntry = (descriptor) => {
@@ -135,7 +139,6 @@ async function findProjectDescriptors(ident, { project, target }) {
135
139
  }
136
140
  return matches;
137
141
  }
138
- exports.findProjectDescriptors = findProjectDescriptors;
139
142
  async function extractDescriptorFromPath(path, { cwd, workspace }) {
140
143
  // We use a temporary cache so that we don't pollute the project cache with temporary archives
141
144
  return await makeTemporaryCache(async (cache) => {
@@ -164,7 +167,6 @@ async function extractDescriptorFromPath(path, { cwd, workspace }) {
164
167
  return core_2.structUtils.makeDescriptor(manifest.name, path);
165
168
  });
166
169
  }
167
- exports.extractDescriptorFromPath = extractDescriptorFromPath;
168
170
  async function getSuggestedDescriptors(request, { project, workspace, cache, target, fixed, modifier, strategies, maxResults = Infinity }) {
169
171
  if (!(maxResults >= 0))
170
172
  throw new Error(`Invalid maxResults (${maxResults})`);
@@ -306,7 +308,6 @@ async function getSuggestedDescriptors(request, { project, workspace, cache, tar
306
308
  rejections: rejected.slice(0, maxResults),
307
309
  };
308
310
  }
309
- exports.getSuggestedDescriptors = getSuggestedDescriptors;
310
311
  async function fetchDescriptorFrom(ident, range, { project, cache, workspace, preserveModifier = true, modifier }) {
311
312
  const latestDescriptor = project.configuration.normalizeDependency(core_2.structUtils.makeDescriptor(ident, range));
312
313
  const report = new core_1.ThrowReport();
@@ -354,7 +355,6 @@ async function fetchDescriptorFrom(ident, range, { project, cache, workspace, pr
354
355
  }
355
356
  return core_2.structUtils.makeDescriptor(bestLocator, core_2.structUtils.makeRange({ protocol, source, params, selector }));
356
357
  }
357
- exports.fetchDescriptorFrom = fetchDescriptorFrom;
358
358
  async function makeTemporaryCache(cb) {
359
359
  return await fslib_1.xfs.mktempPromise(async (cacheDir) => {
360
360
  const configuration = core_1.Configuration.create(cacheDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "exports": {
@@ -8,8 +8,8 @@
8
8
  "./package.json": "./package.json"
9
9
  },
10
10
  "dependencies": {
11
- "@yarnpkg/fslib": "^3.0.2",
12
- "@yarnpkg/parsers": "^3.0.0",
11
+ "@yarnpkg/fslib": "^3.1.0",
12
+ "@yarnpkg/parsers": "^3.0.2",
13
13
  "ci-info": "^3.2.0",
14
14
  "clipanion": "^4.0.0-rc.2",
15
15
  "enquirer": "^2.3.6",
@@ -20,16 +20,16 @@
20
20
  "typanion": "^3.14.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@yarnpkg/cli": "^4.1.0",
24
- "@yarnpkg/core": "^4.0.3",
23
+ "@yarnpkg/cli": "^4.2.2",
24
+ "@yarnpkg/core": "^4.0.5",
25
25
  "@yarnpkg/plugin-git": "^3.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/lodash": "^4.14.136",
29
29
  "@types/micromatch": "^4.0.1",
30
30
  "@types/semver": "^7.1.0",
31
- "@yarnpkg/cli": "^4.1.0",
32
- "@yarnpkg/core": "^4.0.3",
31
+ "@yarnpkg/cli": "^4.2.2",
32
+ "@yarnpkg/core": "^4.0.5",
33
33
  "@yarnpkg/plugin-git": "^3.0.0"
34
34
  },
35
35
  "repository": {