@yarnpkg/plugin-essentials 4.0.0-rc.48 → 4.0.0-rc.49
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/commands/add.js +1 -2
- package/lib/commands/explain/peerRequirements.js +3 -5
- package/lib/commands/info.js +6 -10
- package/lib/commands/install.js +30 -26
- package/lib/commands/link.js +1 -1
- package/lib/commands/plugin/check.js +1 -2
- package/lib/commands/plugin/import/sources.js +1 -1
- package/lib/commands/plugin/import.js +1 -1
- package/lib/commands/plugin/list.js +1 -2
- package/lib/commands/set/version.js +3 -5
- package/lib/commands/unlink.js +2 -2
- package/lib/commands/up.js +2 -2
- package/lib/commands/workspace.js +1 -1
- package/lib/dedupeUtils.js +1 -2
- package/package.json +11 -11
package/lib/commands/add.js
CHANGED
|
@@ -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 =
|
|
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 = [
|
|
@@ -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 =
|
|
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);
|
|
@@ -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 =
|
|
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,
|
|
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:`);
|
package/lib/commands/info.js
CHANGED
|
@@ -164,7 +164,6 @@ class InfoCommand extends cli_1.BaseCommand {
|
|
|
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
|
-
|
|
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,
|
|
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 =
|
|
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
|
-
?
|
|
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
|
-
?
|
|
287
|
+
? project.storedResolutions.get(dependency.descriptorHash) ?? null
|
|
292
288
|
: null;
|
|
293
289
|
const resolution = resolutionHash !== null
|
|
294
|
-
?
|
|
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,
|
package/lib/commands/install.js
CHANGED
|
@@ -63,7 +63,6 @@ class YarnCommand extends cli_1.BaseCommand {
|
|
|
63
63
|
this.networkTimeout = clipanion_1.Option.String(`--network-timeout`, { hidden: true });
|
|
64
64
|
}
|
|
65
65
|
async execute() {
|
|
66
|
-
var _a, _b, _c;
|
|
67
66
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
68
67
|
if (typeof this.inlineBuilds !== `undefined`)
|
|
69
68
|
configuration.useWithSource(`<cli>`, { enableInlineBuilds: this.inlineBuilds }, configuration.startingCwd, { overwrite: true });
|
|
@@ -177,7 +176,7 @@ class YarnCommand extends cli_1.BaseCommand {
|
|
|
177
176
|
const updateMode = this.mode === core_1.InstallMode.UpdateLockfile;
|
|
178
177
|
if (updateMode && (this.immutable || this.immutableCache))
|
|
179
178
|
throw new clipanion_1.UsageError(`${core_1.formatUtils.pretty(configuration, `--immutable`, core_1.formatUtils.Type.CODE)} and ${core_1.formatUtils.pretty(configuration, `--immutable-cache`, core_1.formatUtils.Type.CODE)} cannot be used with ${core_1.formatUtils.pretty(configuration, `--mode=update-lockfile`, core_1.formatUtils.Type.CODE)}`);
|
|
180
|
-
const immutable = (
|
|
179
|
+
const immutable = (this.immutable ?? configuration.get(`enableImmutableInstalls`)) && !updateMode;
|
|
181
180
|
const immutableCache = this.immutableCache && !updateMode;
|
|
182
181
|
if (configuration.projectCwd !== null) {
|
|
183
182
|
const fixReport = await core_1.StreamReport.start({
|
|
@@ -210,38 +209,36 @@ class YarnCommand extends cli_1.BaseCommand {
|
|
|
210
209
|
stdout: this.context.stdout,
|
|
211
210
|
includeFooter: false,
|
|
212
211
|
}, async (report) => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
core_1.Configuration.telemetry.commitMotd();
|
|
212
|
+
if (core_1.Configuration.telemetry?.isNew) {
|
|
213
|
+
core_1.Configuration.telemetry.commitTips();
|
|
216
214
|
report.reportInfo(core_1.MessageName.TELEMETRY_NOTICE, `Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry`);
|
|
217
215
|
report.reportInfo(core_1.MessageName.TELEMETRY_NOTICE, `Run ${core_1.formatUtils.pretty(configuration, `yarn config set --home enableTelemetry 0`, core_1.formatUtils.Type.CODE)} to disable`);
|
|
218
216
|
report.reportSeparator();
|
|
219
217
|
}
|
|
220
|
-
else if (
|
|
221
|
-
const data = await
|
|
218
|
+
else if (core_1.Configuration.telemetry?.shouldShowTips) {
|
|
219
|
+
const data = await core_1.httpUtils.get(`https://repo.yarnpkg.com/tags`, { configuration, jsonResponse: true }).catch(() => null);
|
|
222
220
|
if (data !== null) {
|
|
223
221
|
let newVersion = null;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const isRcBinary = semver_1.default.prerelease(YarnVersion);
|
|
222
|
+
if (core_1.YarnVersion !== null) {
|
|
223
|
+
const isRcBinary = semver_1.default.prerelease(core_1.YarnVersion);
|
|
227
224
|
const releaseType = isRcBinary ? `canary` : `stable`;
|
|
228
225
|
const candidate = data.latest[releaseType];
|
|
229
|
-
if (semver_1.default.gt(candidate, YarnVersion)) {
|
|
226
|
+
if (semver_1.default.gt(candidate, core_1.YarnVersion)) {
|
|
230
227
|
newVersion = [releaseType, candidate];
|
|
231
228
|
}
|
|
232
229
|
}
|
|
233
230
|
if (newVersion) {
|
|
234
|
-
core_1.Configuration.telemetry.
|
|
231
|
+
core_1.Configuration.telemetry.commitTips();
|
|
235
232
|
report.reportInfo(core_1.MessageName.VERSION_NOTICE, `${core_1.formatUtils.applyStyle(configuration, `A new ${newVersion[0]} version of Yarn is available:`, core_1.formatUtils.Style.BOLD)} ${core_1.structUtils.prettyReference(configuration, newVersion[1])}!`);
|
|
236
233
|
report.reportInfo(core_1.MessageName.VERSION_NOTICE, `Upgrade now by running ${core_1.formatUtils.pretty(configuration, `yarn set version ${newVersion[1]}`, core_1.formatUtils.Type.CODE)}`);
|
|
237
234
|
report.reportSeparator();
|
|
238
235
|
}
|
|
239
236
|
else {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
report.reportInfo(core_1.MessageName.
|
|
243
|
-
if (
|
|
244
|
-
report.reportInfo(core_1.MessageName.
|
|
237
|
+
const tip = core_1.Configuration.telemetry.selectTip(data.tips);
|
|
238
|
+
if (tip) {
|
|
239
|
+
report.reportInfo(core_1.MessageName.TIPS_NOTICE, core_1.formatUtils.pretty(configuration, tip.message, core_1.formatUtils.Type.MARKDOWN_INLINE));
|
|
240
|
+
if (tip.url)
|
|
241
|
+
report.reportInfo(core_1.MessageName.TIPS_NOTICE, `Learn more at ${tip.url}`);
|
|
245
242
|
report.reportSeparator();
|
|
246
243
|
}
|
|
247
244
|
}
|
|
@@ -285,9 +282,9 @@ class YarnCommand extends cli_1.BaseCommand {
|
|
|
285
282
|
restoreResolutions: false,
|
|
286
283
|
});
|
|
287
284
|
const enableHardenedMode = configuration.get(`enableHardenedMode`);
|
|
288
|
-
if (
|
|
285
|
+
if (this.refreshLockfile ?? enableHardenedMode)
|
|
289
286
|
project.lockfileNeedsRefresh = true;
|
|
290
|
-
const checkResolutions =
|
|
287
|
+
const checkResolutions = this.checkResolutions ?? enableHardenedMode;
|
|
291
288
|
// Important: Because other commands also need to run installs, if you
|
|
292
289
|
// get in a situation where you need to change this file in order to
|
|
293
290
|
// customize the install it's very likely you're doing something wrong.
|
|
@@ -357,7 +354,7 @@ const MERGE_CONFLICT_START = `<<<<<<<`;
|
|
|
357
354
|
async function autofixMergeConflicts(configuration, immutable) {
|
|
358
355
|
if (!configuration.projectCwd)
|
|
359
356
|
return false;
|
|
360
|
-
const lockfilePath = fslib_1.ppath.join(configuration.projectCwd,
|
|
357
|
+
const lockfilePath = fslib_1.ppath.join(configuration.projectCwd, fslib_1.Filename.lockfile);
|
|
361
358
|
if (!await fslib_1.xfs.existsPromise(lockfilePath))
|
|
362
359
|
return false;
|
|
363
360
|
const file = await fslib_1.xfs.readFilePromise(lockfilePath, `utf8`);
|
|
@@ -414,18 +411,25 @@ async function autofixMergeConflicts(configuration, immutable) {
|
|
|
414
411
|
}
|
|
415
412
|
}
|
|
416
413
|
}
|
|
414
|
+
// We encode the cacheKeys inside the checksums so that the reconciliation
|
|
415
|
+
// can merge the data together
|
|
416
|
+
for (const key of Object.keys(variant)) {
|
|
417
|
+
if (key === `__metadata`)
|
|
418
|
+
continue;
|
|
419
|
+
const checksum = variant[key].checksum;
|
|
420
|
+
if (typeof checksum === `string` && checksum.includes(`/`))
|
|
421
|
+
continue;
|
|
422
|
+
variant[key].checksum = `${variant.__metadata.cacheKey}/${checksum}`;
|
|
423
|
+
}
|
|
417
424
|
}
|
|
418
425
|
const merged = Object.assign({}, ...variants);
|
|
419
426
|
// We must keep the lockfile version as small as necessary to force Yarn to
|
|
420
427
|
// refresh the merged-in lockfile metadata that may be missing.
|
|
421
428
|
merged.__metadata.version = `${Math.min(...variants.map(variant => {
|
|
422
|
-
|
|
423
|
-
return parseInt((_a = variant.__metadata.version) !== null && _a !== void 0 ? _a : 0);
|
|
424
|
-
}))}`;
|
|
425
|
-
merged.__metadata.cacheKey = `${Math.min(...variants.map(variant => {
|
|
426
|
-
var _a;
|
|
427
|
-
return parseInt((_a = variant.__metadata.cacheKey) !== null && _a !== void 0 ? _a : 0);
|
|
429
|
+
return parseInt(variant.__metadata.version ?? 0);
|
|
428
430
|
}))}`;
|
|
431
|
+
// It shouldn't matter, since the cacheKey have been embed within the checksums
|
|
432
|
+
merged.__metadata.cacheKey = `merged`;
|
|
429
433
|
// parse as valid YAML except that the objects become strings. We can use
|
|
430
434
|
// that to detect them. Damn, it's really ugly though.
|
|
431
435
|
for (const [key, value] of Object.entries(merged))
|
package/lib/commands/link.js
CHANGED
|
@@ -59,7 +59,7 @@ class LinkCommand extends cli_1.BaseCommand {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
for (const workspace of linkedWorkspaces) {
|
|
62
|
-
const fullName = core_1.structUtils.stringifyIdent(workspace.
|
|
62
|
+
const fullName = core_1.structUtils.stringifyIdent(workspace.anchoredLocator);
|
|
63
63
|
const target = this.relative
|
|
64
64
|
? fslib_1.ppath.relative(project.cwd, workspace.cwd)
|
|
65
65
|
: workspace.cwd;
|
|
@@ -19,9 +19,8 @@ class PluginCheckCommand extends cli_1.BaseCommand {
|
|
|
19
19
|
json: this.json,
|
|
20
20
|
stdout: this.context.stdout,
|
|
21
21
|
}, async (report) => {
|
|
22
|
-
var _a;
|
|
23
22
|
for (const rcFile of rcFiles) {
|
|
24
|
-
if (!
|
|
23
|
+
if (!rcFile.data?.plugins)
|
|
25
24
|
continue;
|
|
26
25
|
for (const plugin of rcFile.data.plugins) {
|
|
27
26
|
if (!plugin.checksum)
|
|
@@ -47,7 +47,7 @@ class PluginImportSourcesCommand extends cli_1.BaseCommand {
|
|
|
47
47
|
const ident = core_1.structUtils.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/, `@yarnpkg/plugin-`));
|
|
48
48
|
const identStr = core_1.structUtils.stringifyIdent(ident);
|
|
49
49
|
const data = await (0, list_1.getAvailablePlugins)(configuration, core_1.YarnVersion);
|
|
50
|
-
if (!Object.
|
|
50
|
+
if (!Object.hasOwn(data, identStr))
|
|
51
51
|
throw new core_2.ReportError(core_2.MessageName.PLUGIN_NAME_NOT_FOUND, `Couldn't find a plugin named "${identStr}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);
|
|
52
52
|
const pluginSpec = identStr;
|
|
53
53
|
await (0, sources_1.prepareRepo)(this, { configuration, report, target });
|
|
@@ -53,7 +53,7 @@ class PluginImportCommand extends cli_1.BaseCommand {
|
|
|
53
53
|
throw new core_1.ReportError(core_1.MessageName.UNNAMED, `Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.`);
|
|
54
54
|
const identStr = core_2.structUtils.stringifyIdent(locator);
|
|
55
55
|
const data = await (0, list_1.getAvailablePlugins)(configuration, core_2.YarnVersion);
|
|
56
|
-
if (!Object.
|
|
56
|
+
if (!Object.hasOwn(data, identStr)) {
|
|
57
57
|
let message = `Couldn't find a plugin named ${core_2.structUtils.prettyIdent(configuration, locator)} on the remote registry.\n`;
|
|
58
58
|
if (configuration.plugins.has(identStr))
|
|
59
59
|
message += `A plugin named ${core_2.structUtils.prettyIdent(configuration, locator)} is already installed; possibly attempting to import a built-in plugin.`;
|
|
@@ -10,8 +10,7 @@ async function getAvailablePlugins(configuration, version) {
|
|
|
10
10
|
const raw = await core_1.httpUtils.get(REMOTE_REGISTRY, { configuration });
|
|
11
11
|
const data = (0, parsers_1.parseSyml)(raw.toString());
|
|
12
12
|
return Object.fromEntries(Object.entries(data).filter(([pluginName, pluginData]) => {
|
|
13
|
-
|
|
14
|
-
return !version || core_1.semverUtils.satisfiesWithPrereleases(version, (_a = pluginData.range) !== null && _a !== void 0 ? _a : `<4.0.0-rc.1`);
|
|
13
|
+
return !version || core_1.semverUtils.satisfiesWithPrereleases(version, pluginData.range ?? `<4.0.0-rc.1`);
|
|
15
14
|
}));
|
|
16
15
|
}
|
|
17
16
|
exports.getAvailablePlugins = getAvailablePlugins;
|
|
@@ -21,13 +21,12 @@ class SetVersionCommand extends cli_1.BaseCommand {
|
|
|
21
21
|
this.version = clipanion_1.Option.String();
|
|
22
22
|
}
|
|
23
23
|
async execute() {
|
|
24
|
-
var _a;
|
|
25
24
|
const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
|
|
26
25
|
if (this.onlyIfNeeded && configuration.get(`yarnPath`)) {
|
|
27
26
|
const yarnPathSource = configuration.sources.get(`yarnPath`);
|
|
28
27
|
if (!yarnPathSource)
|
|
29
28
|
throw new Error(`Assertion failed: Expected 'yarnPath' to have a source`);
|
|
30
|
-
const projectCwd =
|
|
29
|
+
const projectCwd = configuration.projectCwd ?? configuration.startingCwd;
|
|
31
30
|
if (fslib_1.ppath.contains(projectCwd, yarnPathSource)) {
|
|
32
31
|
return 0;
|
|
33
32
|
}
|
|
@@ -42,7 +41,7 @@ class SetVersionCommand extends cli_1.BaseCommand {
|
|
|
42
41
|
return { version, url: url.replace(/\{\}/g, version) };
|
|
43
42
|
};
|
|
44
43
|
if (this.version === `self`)
|
|
45
|
-
bundleRef = { url: getBundlePath(), version: core_1.YarnVersion
|
|
44
|
+
bundleRef = { url: getBundlePath(), version: core_1.YarnVersion ?? `self` };
|
|
46
45
|
else if (this.version === `latest` || this.version === `berry` || this.version === `stable`)
|
|
47
46
|
bundleRef = getRef(`https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js`, await resolveTag(configuration, `stable`));
|
|
48
47
|
else if (this.version === `canary`)
|
|
@@ -156,7 +155,6 @@ async function resolveTag(configuration, request) {
|
|
|
156
155
|
}
|
|
157
156
|
exports.resolveTag = resolveTag;
|
|
158
157
|
async function setVersion(configuration, bundleVersion, fetchBuffer, { report, useYarnPath }) {
|
|
159
|
-
var _a;
|
|
160
158
|
let bundleBuffer;
|
|
161
159
|
const ensureBuffer = async () => {
|
|
162
160
|
if (typeof bundleBuffer === `undefined`)
|
|
@@ -178,7 +176,7 @@ async function setVersion(configuration, bundleVersion, fetchBuffer, { report, u
|
|
|
178
176
|
}
|
|
179
177
|
});
|
|
180
178
|
}
|
|
181
|
-
const projectCwd =
|
|
179
|
+
const projectCwd = configuration.projectCwd ?? configuration.startingCwd;
|
|
182
180
|
const releaseFolder = fslib_1.ppath.resolve(projectCwd, `.yarn/releases`);
|
|
183
181
|
const absolutePath = fslib_1.ppath.resolve(releaseFolder, `yarn-${bundleVersion}.cjs`);
|
|
184
182
|
const displayPath = fslib_1.ppath.relative(configuration.startingCwd, absolutePath);
|
package/lib/commands/unlink.js
CHANGED
|
@@ -41,7 +41,7 @@ class UnlinkCommand extends cli_1.BaseCommand {
|
|
|
41
41
|
if (this.all) {
|
|
42
42
|
for (const workspace of project2.workspaces)
|
|
43
43
|
if (workspace.manifest.name)
|
|
44
|
-
workspacesToUnlink.add(core_1.structUtils.stringifyIdent(workspace.
|
|
44
|
+
workspacesToUnlink.add(core_1.structUtils.stringifyIdent(workspace.anchoredLocator));
|
|
45
45
|
if (workspacesToUnlink.size === 0) {
|
|
46
46
|
throw new clipanion_1.UsageError(`No workspace found to be unlinked in the target project`);
|
|
47
47
|
}
|
|
@@ -49,7 +49,7 @@ class UnlinkCommand extends cli_1.BaseCommand {
|
|
|
49
49
|
else {
|
|
50
50
|
if (!workspace2.manifest.name)
|
|
51
51
|
throw new clipanion_1.UsageError(`The target workspace doesn't have a name and thus cannot be unlinked`);
|
|
52
|
-
workspacesToUnlink.add(core_1.structUtils.stringifyIdent(workspace2.
|
|
52
|
+
workspacesToUnlink.add(core_1.structUtils.stringifyIdent(workspace2.anchoredLocator));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
else {
|
package/lib/commands/up.js
CHANGED
|
@@ -79,10 +79,10 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
79
79
|
stdout: this.context.stdout,
|
|
80
80
|
}, {
|
|
81
81
|
cache,
|
|
82
|
+
mode: this.mode,
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
async executeUpClassic() {
|
|
85
|
-
var _a;
|
|
86
86
|
const configuration = await core_3.Configuration.find(this.context.cwd, this.context.plugins);
|
|
87
87
|
const { project, workspace } = await core_2.Project.find(configuration, this.context.cwd);
|
|
88
88
|
const cache = await core_3.Cache.find(configuration);
|
|
@@ -92,7 +92,7 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
92
92
|
restoreResolutions: false,
|
|
93
93
|
});
|
|
94
94
|
const fixed = this.fixed;
|
|
95
|
-
const interactive =
|
|
95
|
+
const interactive = this.interactive ?? configuration.get(`preferInteractive`);
|
|
96
96
|
const modifier = suggestUtils.getModifier(this, project);
|
|
97
97
|
const strategies = interactive ? [
|
|
98
98
|
suggestUtils.Strategy.KEEP,
|
|
@@ -18,7 +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 => [core_2.structUtils.stringifyIdent(workspace.
|
|
21
|
+
const candidatesByName = new Map(candidates.map(workspace => [core_2.structUtils.stringifyIdent(workspace.anchoredLocator), workspace]));
|
|
22
22
|
const workspace = candidatesByName.get(this.workspaceName);
|
|
23
23
|
if (workspace === undefined) {
|
|
24
24
|
const otherNames = Array.from(candidatesByName.keys()).sort();
|
package/lib/dedupeUtils.js
CHANGED
|
@@ -44,7 +44,6 @@ const DEDUPE_ALGORITHMS = {
|
|
|
44
44
|
if (typeof currentPackage === `undefined`)
|
|
45
45
|
throw new Error(`Assertion failed: The package (${currentResolution}) should have been registered`);
|
|
46
46
|
Promise.resolve().then(async () => {
|
|
47
|
-
var _a;
|
|
48
47
|
const dependencies = resolver.getResolutionDependencies(descriptor, resolveOptions);
|
|
49
48
|
const resolvedDependencies = Object.fromEntries(await core_1.miscUtils.allSettledSafe(Object.entries(dependencies).map(async ([dependencyName, dependency]) => {
|
|
50
49
|
const dependencyDeferred = deferredMap.get(dependency.descriptorHash);
|
|
@@ -74,7 +73,7 @@ const DEDUPE_ALGORITHMS = {
|
|
|
74
73
|
return pkg;
|
|
75
74
|
});
|
|
76
75
|
const satisfying = await resolver.getSatisfying(descriptor, resolvedDependencies, candidates, resolveOptions);
|
|
77
|
-
const bestLocator =
|
|
76
|
+
const bestLocator = satisfying.locators?.[0];
|
|
78
77
|
if (typeof bestLocator === `undefined` || !satisfying.sorted)
|
|
79
78
|
return currentPackage;
|
|
80
79
|
const updatedPackage = project.originalPackages.get(bestLocator.locatorHash);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-essentials",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.49",
|
|
4
4
|
"stableVersion": "3.3.0",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,29 +9,29 @@
|
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@yarnpkg/fslib": "^3.0.0-rc.
|
|
13
|
-
"@yarnpkg/parsers": "^3.0.0-rc.
|
|
12
|
+
"@yarnpkg/fslib": "^3.0.0-rc.49",
|
|
13
|
+
"@yarnpkg/parsers": "^3.0.0-rc.49",
|
|
14
14
|
"ci-info": "^3.2.0",
|
|
15
|
-
"clipanion": "^
|
|
15
|
+
"clipanion": "^4.0.0-rc.2",
|
|
16
16
|
"enquirer": "^2.3.6",
|
|
17
17
|
"lodash": "^4.17.15",
|
|
18
18
|
"micromatch": "^4.0.2",
|
|
19
19
|
"semver": "^7.1.2",
|
|
20
20
|
"tslib": "^2.4.0",
|
|
21
|
-
"typanion": "^3.
|
|
21
|
+
"typanion": "^3.14.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
25
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
26
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
24
|
+
"@yarnpkg/cli": "^4.0.0-rc.49",
|
|
25
|
+
"@yarnpkg/core": "^4.0.0-rc.49",
|
|
26
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.49"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash": "^4.14.136",
|
|
30
30
|
"@types/micromatch": "^4.0.1",
|
|
31
31
|
"@types/semver": "^7.1.0",
|
|
32
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
33
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
34
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
32
|
+
"@yarnpkg/cli": "^4.0.0-rc.49",
|
|
33
|
+
"@yarnpkg/core": "^4.0.0-rc.49",
|
|
34
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.49"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|