@yarnpkg/plugin-essentials 3.0.0-rc.9 → 3.1.0-rc.10
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.d.ts +5 -2
- package/lib/commands/add.js +16 -4
- package/lib/commands/bin.d.ts +1 -1
- package/lib/commands/cache/clean.d.ts +1 -1
- package/lib/commands/config/get.d.ts +1 -1
- package/lib/commands/config/get.js +3 -3
- package/lib/commands/config/set.d.ts +1 -1
- package/lib/commands/config/set.js +9 -7
- package/lib/commands/config/unset.d.ts +1 -1
- package/lib/commands/config/unset.js +6 -6
- package/lib/commands/config.d.ts +1 -1
- package/lib/commands/config.js +2 -2
- package/lib/commands/dedupe.d.ts +3 -1
- package/lib/commands/dedupe.js +13 -3
- package/lib/commands/entries/clipanion.d.ts +2 -3
- package/lib/commands/entries/clipanion.js +3 -4
- package/lib/commands/entries/help.d.ts +2 -3
- package/lib/commands/entries/help.js +2 -2
- package/lib/commands/entries/run.d.ts +2 -3
- package/lib/commands/entries/run.js +2 -1
- package/lib/commands/entries/version.d.ts +2 -3
- package/lib/commands/entries/version.js +2 -2
- package/lib/commands/exec.js +7 -10
- package/lib/commands/explain/peerRequirements.d.ts +2 -2
- package/lib/commands/explain/peerRequirements.js +1 -1
- package/lib/commands/info.js +2 -2
- package/lib/commands/install.d.ts +4 -2
- package/lib/commands/install.js +24 -17
- package/lib/commands/link.d.ts +1 -1
- package/lib/commands/plugin/import/sources.d.ts +1 -1
- package/lib/commands/plugin/import/sources.js +5 -5
- package/lib/commands/plugin/import.d.ts +1 -1
- package/lib/commands/plugin/import.js +5 -5
- package/lib/commands/plugin/list.d.ts +1 -1
- package/lib/commands/plugin/list.js +1 -1
- package/lib/commands/plugin/remove.d.ts +1 -1
- package/lib/commands/plugin/runtime.d.ts +1 -1
- package/lib/commands/rebuild.d.ts +1 -1
- package/lib/commands/remove.d.ts +3 -1
- package/lib/commands/remove.js +16 -5
- package/lib/commands/run.js +6 -6
- package/lib/commands/runIndex.d.ts +1 -1
- package/lib/commands/runIndex.js +1 -1
- package/lib/commands/set/resolution.d.ts +1 -1
- package/lib/commands/set/version/sources.d.ts +1 -1
- package/lib/commands/set/version/sources.js +4 -4
- package/lib/commands/set/version.d.ts +7 -2
- package/lib/commands/set/version.js +45 -10
- package/lib/commands/unlink.d.ts +1 -1
- package/lib/commands/unlink.js +2 -2
- package/lib/commands/up.d.ts +5 -3
- package/lib/commands/up.js +17 -7
- package/lib/commands/workspace.d.ts +3 -3
- package/lib/commands/workspace.js +1 -1
- package/lib/commands/workspaces/list.d.ts +1 -1
- package/lib/dedupeUtils.js +1 -1
- package/lib/index.js +37 -37
- package/lib/suggestUtils.d.ts +7 -0
- package/lib/suggestUtils.js +30 -5
- package/package.json +11 -13
package/lib/commands/up.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
import { InstallMode } from '@yarnpkg/core';
|
|
2
3
|
import { Usage } from 'clipanion';
|
|
3
4
|
import * as t from 'typanion';
|
|
4
5
|
export default class UpCommand extends BaseCommand {
|
|
@@ -9,13 +10,14 @@ export default class UpCommand extends BaseCommand {
|
|
|
9
10
|
tilde: boolean;
|
|
10
11
|
caret: boolean;
|
|
11
12
|
recursive: boolean;
|
|
13
|
+
mode: InstallMode | undefined;
|
|
12
14
|
patterns: string[];
|
|
13
15
|
static schema: t.LooseValidator<{
|
|
14
16
|
[key: string]: unknown;
|
|
15
17
|
}, {
|
|
16
18
|
[key: string]: unknown;
|
|
17
19
|
}>[];
|
|
18
|
-
execute(): Promise<
|
|
19
|
-
executeUpRecursive(): Promise<
|
|
20
|
-
executeUpClassic(): Promise<
|
|
20
|
+
execute(): Promise<1 | 0>;
|
|
21
|
+
executeUpRecursive(): Promise<1 | 0>;
|
|
22
|
+
executeUpClassic(): Promise<1 | 0>;
|
|
21
23
|
}
|
package/lib/commands/up.js
CHANGED
|
@@ -7,9 +7,9 @@ const core_2 = require("@yarnpkg/core");
|
|
|
7
7
|
const core_3 = require("@yarnpkg/core");
|
|
8
8
|
const clipanion_1 = require("clipanion");
|
|
9
9
|
const enquirer_1 = require("enquirer");
|
|
10
|
-
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
|
|
11
|
-
const t = tslib_1.__importStar(require("typanion"));
|
|
12
|
-
const suggestUtils = tslib_1.__importStar(require("../suggestUtils"));
|
|
10
|
+
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch"));
|
|
11
|
+
const t = (0, tslib_1.__importStar)(require("typanion"));
|
|
12
|
+
const suggestUtils = (0, tslib_1.__importStar)(require("../suggestUtils"));
|
|
13
13
|
// eslint-disable-next-line arca/no-default-export
|
|
14
14
|
class UpCommand extends cli_1.BaseCommand {
|
|
15
15
|
constructor() {
|
|
@@ -29,6 +29,10 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
29
29
|
this.recursive = clipanion_1.Option.Boolean(`-R,--recursive`, false, {
|
|
30
30
|
description: `Resolve again ALL resolutions for those packages`,
|
|
31
31
|
});
|
|
32
|
+
this.mode = clipanion_1.Option.String(`--mode`, {
|
|
33
|
+
description: `Change what artifacts installs generate`,
|
|
34
|
+
validator: t.isEnum(core_2.InstallMode),
|
|
35
|
+
});
|
|
32
36
|
this.patterns = clipanion_1.Option.Rest();
|
|
33
37
|
}
|
|
34
38
|
async execute() {
|
|
@@ -56,7 +60,7 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
56
60
|
for (const pattern of this.patterns) {
|
|
57
61
|
if (core_1.structUtils.parseDescriptor(pattern).range !== `unknown`)
|
|
58
62
|
throw new clipanion_1.UsageError(`Ranges aren't allowed when using --recursive`);
|
|
59
|
-
for (const stringifiedIdent of micromatch_1.default(stringifiedIdents, pattern)) {
|
|
63
|
+
for (const stringifiedIdent of (0, micromatch_1.default)(stringifiedIdents, pattern)) {
|
|
60
64
|
const ident = core_1.structUtils.parseIdent(stringifiedIdent);
|
|
61
65
|
relevantIdents.add(ident.identHash);
|
|
62
66
|
}
|
|
@@ -109,7 +113,7 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
109
113
|
const stringifiedIdents = [...descriptors.values()].map(descriptor => {
|
|
110
114
|
return core_1.structUtils.stringifyIdent(descriptor);
|
|
111
115
|
});
|
|
112
|
-
for (const stringifiedIdent of micromatch_1.default(stringifiedIdents, core_1.structUtils.stringifyIdent(pseudoDescriptor))) {
|
|
116
|
+
for (const stringifiedIdent of (0, micromatch_1.default)(stringifiedIdents, core_1.structUtils.stringifyIdent(pseudoDescriptor))) {
|
|
113
117
|
const ident = core_1.structUtils.parseIdent(stringifiedIdent);
|
|
114
118
|
const existingDescriptor = workspace.manifest[target].get(ident.identHash);
|
|
115
119
|
if (typeof existingDescriptor === `undefined`)
|
|
@@ -178,7 +182,7 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
178
182
|
}
|
|
179
183
|
else {
|
|
180
184
|
askedQuestions = true;
|
|
181
|
-
({ answer: selected } = await enquirer_1.prompt({
|
|
185
|
+
({ answer: selected } = await (0, enquirer_1.prompt)({
|
|
182
186
|
type: `select`,
|
|
183
187
|
name: `answer`,
|
|
184
188
|
message: `Which range to you want to use in ${core_1.structUtils.prettyWorkspace(configuration, workspace)} ❯ ${target}?`,
|
|
@@ -226,7 +230,7 @@ class UpCommand extends cli_1.BaseCommand {
|
|
|
226
230
|
configuration,
|
|
227
231
|
stdout: this.context.stdout,
|
|
228
232
|
}, async (report) => {
|
|
229
|
-
await project.install({ cache, report });
|
|
233
|
+
await project.install({ cache, report, mode: this.mode });
|
|
230
234
|
});
|
|
231
235
|
return installReport.exitCode();
|
|
232
236
|
}
|
|
@@ -246,6 +250,12 @@ UpCommand.usage = clipanion_1.Command.Usage({
|
|
|
246
250
|
|
|
247
251
|
The, \`-C,--caret\`, \`-E,--exact\` and \`-T,--tilde\` options have the same meaning as in the \`add\` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).
|
|
248
252
|
|
|
253
|
+
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
|
254
|
+
|
|
255
|
+
- \`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.
|
|
256
|
+
|
|
257
|
+
- \`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.
|
|
258
|
+
|
|
249
259
|
Generally you can see \`yarn up\` as a counterpart to what was \`yarn upgrade --latest\` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike \`yarn upgrade\` which only upgraded dependencies in the current workspace, \`yarn up\` will upgrade all workspaces at the same time.
|
|
250
260
|
|
|
251
261
|
This command accepts glob patterns as arguments (if valid Descriptors and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export default class WorkspaceCommand extends
|
|
1
|
+
import { BaseCommand } from '@yarnpkg/cli';
|
|
2
|
+
import { Usage } from 'clipanion';
|
|
3
|
+
export default class WorkspaceCommand extends BaseCommand {
|
|
4
4
|
static paths: string[][];
|
|
5
5
|
static usage: Usage;
|
|
6
6
|
workspaceName: string;
|
|
@@ -5,7 +5,7 @@ const core_1 = require("@yarnpkg/core");
|
|
|
5
5
|
const core_2 = require("@yarnpkg/core");
|
|
6
6
|
const clipanion_1 = require("clipanion");
|
|
7
7
|
// eslint-disable-next-line arca/no-default-export
|
|
8
|
-
class WorkspaceCommand extends
|
|
8
|
+
class WorkspaceCommand extends cli_1.BaseCommand {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.workspaceName = clipanion_1.Option.String();
|
package/lib/dedupeUtils.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.dedupe = exports.acceptedStrategies = exports.Strategy = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const core_2 = require("@yarnpkg/core");
|
|
7
|
-
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
|
|
7
|
+
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch"));
|
|
8
8
|
var Strategy;
|
|
9
9
|
(function (Strategy) {
|
|
10
10
|
/**
|
package/lib/index.js
CHANGED
|
@@ -4,44 +4,44 @@ exports.suggestUtils = exports.dedupeUtils = 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
|
-
const add_1 = tslib_1.__importDefault(require("./commands/add"));
|
|
8
|
-
const bin_1 = tslib_1.__importDefault(require("./commands/bin"));
|
|
9
|
-
const clean_1 = tslib_1.__importDefault(require("./commands/cache/clean"));
|
|
10
|
-
const get_1 = tslib_1.__importDefault(require("./commands/config/get"));
|
|
11
|
-
const set_1 = tslib_1.__importDefault(require("./commands/config/set"));
|
|
12
|
-
const unset_1 = tslib_1.__importDefault(require("./commands/config/unset"));
|
|
13
|
-
const config_1 = tslib_1.__importDefault(require("./commands/config"));
|
|
14
|
-
const dedupe_1 = tslib_1.__importDefault(require("./commands/dedupe"));
|
|
15
|
-
const clipanion_1 = tslib_1.__importDefault(require("./commands/entries/clipanion"));
|
|
16
|
-
const help_1 = tslib_1.__importDefault(require("./commands/entries/help"));
|
|
17
|
-
const run_1 = tslib_1.__importDefault(require("./commands/entries/run"));
|
|
18
|
-
const version_1 = tslib_1.__importDefault(require("./commands/entries/version"));
|
|
19
|
-
const exec_1 = tslib_1.__importDefault(require("./commands/exec"));
|
|
20
|
-
const peerRequirements_1 = tslib_1.__importDefault(require("./commands/explain/peerRequirements"));
|
|
21
|
-
const info_1 = tslib_1.__importDefault(require("./commands/info"));
|
|
22
|
-
const install_1 = tslib_1.__importDefault(require("./commands/install"));
|
|
23
|
-
const link_1 = tslib_1.__importDefault(require("./commands/link"));
|
|
24
|
-
const node_1 = tslib_1.__importDefault(require("./commands/node"));
|
|
25
|
-
const sources_1 = tslib_1.__importDefault(require("./commands/plugin/import/sources"));
|
|
26
|
-
const import_1 = tslib_1.__importDefault(require("./commands/plugin/import"));
|
|
27
|
-
const list_1 = tslib_1.__importDefault(require("./commands/plugin/list"));
|
|
28
|
-
const remove_1 = tslib_1.__importDefault(require("./commands/plugin/remove"));
|
|
29
|
-
const runtime_1 = tslib_1.__importDefault(require("./commands/plugin/runtime"));
|
|
30
|
-
const rebuild_1 = tslib_1.__importDefault(require("./commands/rebuild"));
|
|
31
|
-
const remove_2 = tslib_1.__importDefault(require("./commands/remove"));
|
|
32
|
-
const runIndex_1 = tslib_1.__importDefault(require("./commands/runIndex"));
|
|
33
|
-
const run_2 = tslib_1.__importDefault(require("./commands/run"));
|
|
34
|
-
const resolution_1 = tslib_1.__importDefault(require("./commands/set/resolution"));
|
|
35
|
-
const sources_2 = tslib_1.__importDefault(require("./commands/set/version/sources"));
|
|
36
|
-
const version_2 = tslib_1.__importDefault(require("./commands/set/version"));
|
|
37
|
-
const unlink_1 = tslib_1.__importDefault(require("./commands/unlink"));
|
|
38
|
-
const up_1 = tslib_1.__importDefault(require("./commands/up"));
|
|
39
|
-
const why_1 = tslib_1.__importDefault(require("./commands/why"));
|
|
40
|
-
const list_2 = tslib_1.__importDefault(require("./commands/workspaces/list"));
|
|
41
|
-
const workspace_1 = tslib_1.__importDefault(require("./commands/workspace"));
|
|
42
|
-
const dedupeUtils = tslib_1.__importStar(require("./dedupeUtils"));
|
|
7
|
+
const add_1 = (0, tslib_1.__importDefault)(require("./commands/add"));
|
|
8
|
+
const bin_1 = (0, tslib_1.__importDefault)(require("./commands/bin"));
|
|
9
|
+
const clean_1 = (0, tslib_1.__importDefault)(require("./commands/cache/clean"));
|
|
10
|
+
const get_1 = (0, tslib_1.__importDefault)(require("./commands/config/get"));
|
|
11
|
+
const set_1 = (0, tslib_1.__importDefault)(require("./commands/config/set"));
|
|
12
|
+
const unset_1 = (0, tslib_1.__importDefault)(require("./commands/config/unset"));
|
|
13
|
+
const config_1 = (0, tslib_1.__importDefault)(require("./commands/config"));
|
|
14
|
+
const dedupe_1 = (0, tslib_1.__importDefault)(require("./commands/dedupe"));
|
|
15
|
+
const clipanion_1 = (0, tslib_1.__importDefault)(require("./commands/entries/clipanion"));
|
|
16
|
+
const help_1 = (0, tslib_1.__importDefault)(require("./commands/entries/help"));
|
|
17
|
+
const run_1 = (0, tslib_1.__importDefault)(require("./commands/entries/run"));
|
|
18
|
+
const version_1 = (0, tslib_1.__importDefault)(require("./commands/entries/version"));
|
|
19
|
+
const exec_1 = (0, tslib_1.__importDefault)(require("./commands/exec"));
|
|
20
|
+
const peerRequirements_1 = (0, tslib_1.__importDefault)(require("./commands/explain/peerRequirements"));
|
|
21
|
+
const info_1 = (0, tslib_1.__importDefault)(require("./commands/info"));
|
|
22
|
+
const install_1 = (0, tslib_1.__importDefault)(require("./commands/install"));
|
|
23
|
+
const link_1 = (0, tslib_1.__importDefault)(require("./commands/link"));
|
|
24
|
+
const node_1 = (0, tslib_1.__importDefault)(require("./commands/node"));
|
|
25
|
+
const sources_1 = (0, tslib_1.__importDefault)(require("./commands/plugin/import/sources"));
|
|
26
|
+
const import_1 = (0, tslib_1.__importDefault)(require("./commands/plugin/import"));
|
|
27
|
+
const list_1 = (0, tslib_1.__importDefault)(require("./commands/plugin/list"));
|
|
28
|
+
const remove_1 = (0, tslib_1.__importDefault)(require("./commands/plugin/remove"));
|
|
29
|
+
const runtime_1 = (0, tslib_1.__importDefault)(require("./commands/plugin/runtime"));
|
|
30
|
+
const rebuild_1 = (0, tslib_1.__importDefault)(require("./commands/rebuild"));
|
|
31
|
+
const remove_2 = (0, tslib_1.__importDefault)(require("./commands/remove"));
|
|
32
|
+
const runIndex_1 = (0, tslib_1.__importDefault)(require("./commands/runIndex"));
|
|
33
|
+
const run_2 = (0, tslib_1.__importDefault)(require("./commands/run"));
|
|
34
|
+
const resolution_1 = (0, tslib_1.__importDefault)(require("./commands/set/resolution"));
|
|
35
|
+
const sources_2 = (0, tslib_1.__importDefault)(require("./commands/set/version/sources"));
|
|
36
|
+
const version_2 = (0, tslib_1.__importDefault)(require("./commands/set/version"));
|
|
37
|
+
const unlink_1 = (0, tslib_1.__importDefault)(require("./commands/unlink"));
|
|
38
|
+
const up_1 = (0, tslib_1.__importDefault)(require("./commands/up"));
|
|
39
|
+
const why_1 = (0, tslib_1.__importDefault)(require("./commands/why"));
|
|
40
|
+
const list_2 = (0, tslib_1.__importDefault)(require("./commands/workspaces/list"));
|
|
41
|
+
const workspace_1 = (0, tslib_1.__importDefault)(require("./commands/workspace"));
|
|
42
|
+
const dedupeUtils = (0, tslib_1.__importStar)(require("./dedupeUtils"));
|
|
43
43
|
exports.dedupeUtils = dedupeUtils;
|
|
44
|
-
const suggestUtils = tslib_1.__importStar(require("./suggestUtils"));
|
|
44
|
+
const suggestUtils = (0, tslib_1.__importStar)(require("./suggestUtils"));
|
|
45
45
|
exports.suggestUtils = suggestUtils;
|
|
46
46
|
const plugin = {
|
|
47
47
|
configuration: {
|
package/lib/suggestUtils.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export declare enum Modifier {
|
|
|
24
24
|
TILDE = "~",
|
|
25
25
|
EXACT = ""
|
|
26
26
|
}
|
|
27
|
+
export declare enum WorkspaceModifier {
|
|
28
|
+
CARET = "^",
|
|
29
|
+
TILDE = "~",
|
|
30
|
+
EXACT = "*"
|
|
31
|
+
}
|
|
27
32
|
export declare enum Strategy {
|
|
28
33
|
/**
|
|
29
34
|
* If set, the suggest engine will offer to keep the current version if the
|
|
@@ -60,6 +65,8 @@ export declare function extractRangeModifier(range: string, { project }: {
|
|
|
60
65
|
project: Project;
|
|
61
66
|
}): string;
|
|
62
67
|
export declare function applyModifier(descriptor: Descriptor, modifier: Modifier): Descriptor;
|
|
68
|
+
export declare function toWorkspaceModifier(modifier: Modifier): WorkspaceModifier;
|
|
69
|
+
export declare function makeWorkspaceDescriptor(workspace: Workspace, modifier: Modifier): Descriptor;
|
|
63
70
|
export declare function findProjectDescriptors(ident: Ident, { project, target }: {
|
|
64
71
|
project: Project;
|
|
65
72
|
target: Target;
|
package/lib/suggestUtils.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchDescriptorFrom = exports.getSuggestedDescriptors = exports.extractDescriptorFromPath = exports.findProjectDescriptors = exports.applyModifier = exports.extractRangeModifier = exports.getModifier = exports.Strategy = exports.Modifier = exports.Target = void 0;
|
|
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;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@yarnpkg/core");
|
|
6
6
|
const core_2 = require("@yarnpkg/core");
|
|
7
7
|
const fslib_1 = require("@yarnpkg/fslib");
|
|
8
|
-
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
|
+
const semver_1 = (0, tslib_1.__importDefault)(require("semver"));
|
|
9
|
+
const WORKSPACE_PROTOCOL = `workspace:`;
|
|
9
10
|
var Target;
|
|
10
11
|
(function (Target) {
|
|
11
12
|
Target["REGULAR"] = "dependencies";
|
|
@@ -18,6 +19,12 @@ var Modifier;
|
|
|
18
19
|
Modifier["TILDE"] = "~";
|
|
19
20
|
Modifier["EXACT"] = "";
|
|
20
21
|
})(Modifier = exports.Modifier || (exports.Modifier = {}));
|
|
22
|
+
var WorkspaceModifier;
|
|
23
|
+
(function (WorkspaceModifier) {
|
|
24
|
+
WorkspaceModifier["CARET"] = "^";
|
|
25
|
+
WorkspaceModifier["TILDE"] = "~";
|
|
26
|
+
WorkspaceModifier["EXACT"] = "*";
|
|
27
|
+
})(WorkspaceModifier = exports.WorkspaceModifier || (exports.WorkspaceModifier = {}));
|
|
21
28
|
var Strategy;
|
|
22
29
|
(function (Strategy) {
|
|
23
30
|
/**
|
|
@@ -69,6 +76,23 @@ function applyModifier(descriptor, modifier) {
|
|
|
69
76
|
return core_2.structUtils.makeDescriptor(descriptor, core_2.structUtils.makeRange({ protocol, source, params, selector }));
|
|
70
77
|
}
|
|
71
78
|
exports.applyModifier = applyModifier;
|
|
79
|
+
function toWorkspaceModifier(modifier) {
|
|
80
|
+
switch (modifier) {
|
|
81
|
+
case Modifier.CARET:
|
|
82
|
+
return WorkspaceModifier.CARET;
|
|
83
|
+
case Modifier.TILDE:
|
|
84
|
+
return WorkspaceModifier.TILDE;
|
|
85
|
+
case Modifier.EXACT:
|
|
86
|
+
return WorkspaceModifier.EXACT;
|
|
87
|
+
default:
|
|
88
|
+
throw new Error(`Assertion failed: Unknown modifier: "${modifier}"`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.toWorkspaceModifier = toWorkspaceModifier;
|
|
92
|
+
function makeWorkspaceDescriptor(workspace, modifier) {
|
|
93
|
+
return core_2.structUtils.makeDescriptor(workspace.anchoredDescriptor, `${WORKSPACE_PROTOCOL}${toWorkspaceModifier(modifier)}`);
|
|
94
|
+
}
|
|
95
|
+
exports.makeWorkspaceDescriptor = makeWorkspaceDescriptor;
|
|
72
96
|
async function findProjectDescriptors(ident, { project, target }) {
|
|
73
97
|
const matches = new Map();
|
|
74
98
|
const getDescriptorEntry = (descriptor) => {
|
|
@@ -229,10 +253,11 @@ async function getSuggestedDescriptors(request, { project, workspace, cache, tar
|
|
|
229
253
|
const candidateWorkspace = project.tryWorkspaceByIdent(request);
|
|
230
254
|
if (candidateWorkspace === null)
|
|
231
255
|
return;
|
|
256
|
+
const workspaceDescriptor = makeWorkspaceDescriptor(candidateWorkspace, modifier);
|
|
232
257
|
suggested.push({
|
|
233
|
-
descriptor:
|
|
234
|
-
name: `Attach ${core_2.structUtils.
|
|
235
|
-
reason: `(local workspace at ${candidateWorkspace.
|
|
258
|
+
descriptor: workspaceDescriptor,
|
|
259
|
+
name: `Attach ${core_2.structUtils.prettyDescriptor(project.configuration, workspaceDescriptor)}`,
|
|
260
|
+
reason: `(local workspace at ${core_2.formatUtils.pretty(project.configuration, candidateWorkspace.relativeCwd, core_2.formatUtils.Type.PATH)})`,
|
|
236
261
|
});
|
|
237
262
|
});
|
|
238
263
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarnpkg/plugin-essentials",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0-rc.10",
|
|
4
4
|
"license": "BSD-2-Clause",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@yarnpkg/fslib": "^2.
|
|
8
|
-
"@yarnpkg/json-proxy": "^2.1.1
|
|
9
|
-
"@yarnpkg/parsers": "^2.4.
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"clipanion": "^3.0.0-rc.10",
|
|
7
|
+
"@yarnpkg/fslib": "^2.6.0-rc.10",
|
|
8
|
+
"@yarnpkg/json-proxy": "^2.1.1",
|
|
9
|
+
"@yarnpkg/parsers": "^2.4.1-rc.10",
|
|
10
|
+
"ci-info": "^3.2.0",
|
|
11
|
+
"clipanion": "^3.0.1",
|
|
13
12
|
"enquirer": "^2.3.6",
|
|
14
13
|
"lodash": "^4.17.15",
|
|
15
14
|
"micromatch": "^4.0.2",
|
|
@@ -18,17 +17,16 @@
|
|
|
18
17
|
"typanion": "^3.3.0"
|
|
19
18
|
},
|
|
20
19
|
"peerDependencies": {
|
|
21
|
-
"@yarnpkg/cli": "^3.
|
|
22
|
-
"@yarnpkg/core": "^3.
|
|
20
|
+
"@yarnpkg/cli": "^3.1.0-rc.10",
|
|
21
|
+
"@yarnpkg/core": "^3.1.0-rc.11"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
|
-
"@types/ci-info": "^2",
|
|
26
24
|
"@types/lodash": "^4.14.136",
|
|
27
25
|
"@types/micromatch": "^4.0.1",
|
|
28
26
|
"@types/semver": "^7.1.0",
|
|
29
27
|
"@types/treeify": "^1.0.0",
|
|
30
|
-
"@yarnpkg/cli": "3.
|
|
31
|
-
"@yarnpkg/core": "3.
|
|
28
|
+
"@yarnpkg/cli": "^3.1.0-rc.10",
|
|
29
|
+
"@yarnpkg/core": "^3.1.0-rc.11"
|
|
32
30
|
},
|
|
33
31
|
"repository": {
|
|
34
32
|
"type": "git",
|
|
@@ -49,6 +47,6 @@
|
|
|
49
47
|
"engines": {
|
|
50
48
|
"node": ">=12 <14 || 14.2 - 14.9 || >14.10.0"
|
|
51
49
|
},
|
|
52
|
-
"stableVersion": "
|
|
50
|
+
"stableVersion": "3.0.0",
|
|
53
51
|
"typings": "./lib/index.d.ts"
|
|
54
52
|
}
|