@yarnpkg/plugin-essentials 4.0.0-rc.5 → 4.0.0-rc.51
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 +1 -1
- package/lib/commands/add.js +34 -25
- package/lib/commands/bin.d.ts +1 -1
- package/lib/commands/bin.js +1 -1
- package/lib/commands/cache/clean.d.ts +1 -1
- package/lib/commands/cache/clean.js +1 -1
- package/lib/commands/config/get.d.ts +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/set.d.ts +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/unset.d.ts +1 -1
- package/lib/commands/config/unset.js +1 -1
- package/lib/commands/config.d.ts +1 -1
- package/lib/commands/config.js +1 -1
- package/lib/commands/dedupe.d.ts +1 -1
- package/lib/commands/dedupe.js +7 -8
- package/lib/commands/entries/clipanion.js +1 -1
- package/lib/commands/entries/help.js +1 -1
- package/lib/commands/entries/version.js +1 -1
- package/lib/commands/exec.js +1 -1
- package/lib/commands/explain/peerRequirements.d.ts +2 -2
- package/lib/commands/explain/peerRequirements.js +4 -6
- package/lib/commands/explain.js +1 -1
- package/lib/commands/info.js +10 -18
- package/lib/commands/install.d.ts +1 -1
- package/lib/commands/install.js +188 -107
- package/lib/commands/link.d.ts +2 -2
- package/lib/commands/link.js +36 -32
- package/lib/commands/node.js +1 -1
- package/lib/commands/plugin/check.d.ts +8 -0
- package/lib/commands/plugin/check.js +61 -0
- package/lib/commands/plugin/import/sources.d.ts +3 -3
- package/lib/commands/plugin/import/sources.js +5 -5
- package/lib/commands/plugin/import.d.ts +5 -4
- package/lib/commands/plugin/import.js +15 -28
- package/lib/commands/plugin/list.d.ts +2 -2
- package/lib/commands/plugin/list.js +5 -6
- package/lib/commands/plugin/remove.d.ts +1 -1
- package/lib/commands/plugin/remove.js +14 -13
- package/lib/commands/plugin/runtime.d.ts +2 -2
- package/lib/commands/plugin/runtime.js +4 -4
- package/lib/commands/rebuild.d.ts +2 -2
- package/lib/commands/rebuild.js +10 -10
- package/lib/commands/remove.d.ts +1 -1
- package/lib/commands/remove.js +7 -8
- package/lib/commands/run.js +1 -1
- package/lib/commands/runIndex.d.ts +2 -2
- package/lib/commands/runIndex.js +3 -3
- package/lib/commands/set/resolution.d.ts +1 -1
- package/lib/commands/set/resolution.js +4 -6
- package/lib/commands/set/version/sources.d.ts +3 -2
- package/lib/commands/set/version/sources.js +21 -12
- package/lib/commands/set/version.d.ts +2 -3
- package/lib/commands/set/version.js +20 -16
- package/lib/commands/unlink.d.ts +1 -1
- package/lib/commands/unlink.js +7 -8
- package/lib/commands/up.d.ts +3 -3
- package/lib/commands/up.js +19 -17
- package/lib/commands/why.js +5 -13
- package/lib/commands/workspace.js +2 -5
- package/lib/commands/workspaces/list.d.ts +2 -1
- package/lib/commands/workspaces/list.js +8 -1
- package/lib/dedupeUtils.d.ts +3 -3
- package/lib/dedupeUtils.js +3 -5
- package/lib/index.d.ts +76 -1
- package/lib/index.js +40 -1
- package/lib/suggestUtils.d.ts +4 -4
- package/lib/suggestUtils.js +14 -12
- package/package.json +23 -17
package/lib/suggestUtils.d.ts
CHANGED
|
@@ -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
|
|
3
|
+
export type Suggestion = {
|
|
4
4
|
descriptor: Descriptor;
|
|
5
5
|
name: string;
|
|
6
6
|
reason: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type NullableSuggestion = {
|
|
9
9
|
descriptor: Descriptor | null;
|
|
10
10
|
name: string;
|
|
11
11
|
reason: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
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
|
|
91
|
+
export type FetchDescriptorFromOptions = {
|
|
92
92
|
project: Project;
|
|
93
93
|
cache: Cache;
|
|
94
94
|
workspace: Workspace;
|
package/lib/suggestUtils.js
CHANGED
|
@@ -12,19 +12,19 @@ var Target;
|
|
|
12
12
|
Target["REGULAR"] = "dependencies";
|
|
13
13
|
Target["DEVELOPMENT"] = "devDependencies";
|
|
14
14
|
Target["PEER"] = "peerDependencies";
|
|
15
|
-
})(Target
|
|
15
|
+
})(Target || (exports.Target = Target = {}));
|
|
16
16
|
var Modifier;
|
|
17
17
|
(function (Modifier) {
|
|
18
18
|
Modifier["CARET"] = "^";
|
|
19
19
|
Modifier["TILDE"] = "~";
|
|
20
20
|
Modifier["EXACT"] = "";
|
|
21
|
-
})(Modifier
|
|
21
|
+
})(Modifier || (exports.Modifier = Modifier = {}));
|
|
22
22
|
var WorkspaceModifier;
|
|
23
23
|
(function (WorkspaceModifier) {
|
|
24
24
|
WorkspaceModifier["CARET"] = "^";
|
|
25
25
|
WorkspaceModifier["TILDE"] = "~";
|
|
26
26
|
WorkspaceModifier["EXACT"] = "*";
|
|
27
|
-
})(WorkspaceModifier
|
|
27
|
+
})(WorkspaceModifier || (exports.WorkspaceModifier = WorkspaceModifier = {}));
|
|
28
28
|
var Strategy;
|
|
29
29
|
(function (Strategy) {
|
|
30
30
|
/**
|
|
@@ -52,7 +52,7 @@ var Strategy;
|
|
|
52
52
|
* versions of the package that are already within our cache.
|
|
53
53
|
*/
|
|
54
54
|
Strategy["CACHE"] = "cache";
|
|
55
|
-
})(Strategy
|
|
55
|
+
})(Strategy || (exports.Strategy = Strategy = {}));
|
|
56
56
|
function getModifier(flags, project) {
|
|
57
57
|
if (flags.exact)
|
|
58
58
|
return Modifier.EXACT;
|
|
@@ -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.
|
|
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.
|
|
120
|
+
getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
|
|
121
121
|
}
|
|
122
122
|
else if (regularDescriptor !== undefined) {
|
|
123
|
-
getDescriptorEntry(regularDescriptor).locators.push(workspace.
|
|
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.
|
|
128
|
+
getDescriptorEntry(regularDescriptor).locators.push(workspace.anchoredLocator);
|
|
129
129
|
}
|
|
130
130
|
else if (developmentDescriptor !== undefined) {
|
|
131
|
-
getDescriptorEntry(developmentDescriptor).locators.push(workspace.
|
|
131
|
+
getDescriptorEntry(developmentDescriptor).locators.push(workspace.anchoredLocator);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -269,6 +269,8 @@ async function getSuggestedDescriptors(request, { project, workspace, cache, tar
|
|
|
269
269
|
break;
|
|
270
270
|
case Strategy.LATEST:
|
|
271
271
|
{
|
|
272
|
+
const hasNetwork = project.configuration.get(`enableNetwork`);
|
|
273
|
+
const isOfflineMode = project.configuration.get(`enableOfflineMode`);
|
|
272
274
|
await trySuggest(async () => {
|
|
273
275
|
if (target === Target.PEER) {
|
|
274
276
|
suggested.push({
|
|
@@ -277,7 +279,7 @@ async function getSuggestedDescriptors(request, { project, workspace, cache, tar
|
|
|
277
279
|
reason: `(catch-all peer dependency pattern)`,
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
|
-
else if (!
|
|
282
|
+
else if (!hasNetwork && !isOfflineMode) {
|
|
281
283
|
suggested.push({
|
|
282
284
|
descriptor: null,
|
|
283
285
|
name: `Resolve from latest`,
|
|
@@ -290,7 +292,7 @@ async function getSuggestedDescriptors(request, { project, workspace, cache, tar
|
|
|
290
292
|
suggested.push({
|
|
291
293
|
descriptor: latest,
|
|
292
294
|
name: `Use ${core_2.structUtils.prettyDescriptor(project.configuration, latest)}`,
|
|
293
|
-
reason: `(resolved from latest)`,
|
|
295
|
+
reason: `(resolved from ${isOfflineMode ? `the cache` : `latest`})`,
|
|
294
296
|
});
|
|
295
297
|
}
|
|
296
298
|
}
|
|
@@ -310,7 +312,7 @@ async function fetchDescriptorFrom(ident, range, { project, cache, workspace, pr
|
|
|
310
312
|
const report = new core_1.ThrowReport();
|
|
311
313
|
const fetcher = project.configuration.makeFetcher();
|
|
312
314
|
const resolver = project.configuration.makeResolver();
|
|
313
|
-
const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: { skipIntegrityCheck: true }
|
|
315
|
+
const fetchOptions = { project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: { skipIntegrityCheck: true } };
|
|
314
316
|
const resolveOptions = { ...fetchOptions, resolver, fetchOptions };
|
|
315
317
|
// The descriptor has to be bound for the resolvers that need a parent locator. (e.g. FileResolver)
|
|
316
318
|
// 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.
|
|
3
|
+
"version": "4.0.0-rc.51",
|
|
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.
|
|
8
|
-
"@yarnpkg/parsers": "^3.0.0-rc.
|
|
12
|
+
"@yarnpkg/fslib": "^3.0.0-rc.51",
|
|
13
|
+
"@yarnpkg/parsers": "^3.0.0-rc.51",
|
|
9
14
|
"ci-info": "^3.2.0",
|
|
10
|
-
"clipanion": "^
|
|
15
|
+
"clipanion": "^4.0.0-rc.2",
|
|
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": "^
|
|
16
|
-
"typanion": "^3.
|
|
20
|
+
"tslib": "^2.4.0",
|
|
21
|
+
"typanion": "^3.14.0"
|
|
17
22
|
},
|
|
18
23
|
"peerDependencies": {
|
|
19
|
-
"@yarnpkg/cli": "^4.0.0-rc.
|
|
20
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
21
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
24
|
+
"@yarnpkg/cli": "^4.0.0-rc.51",
|
|
25
|
+
"@yarnpkg/core": "^4.0.0-rc.51",
|
|
26
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.51"
|
|
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.
|
|
28
|
-
"@yarnpkg/core": "^4.0.0-rc.
|
|
29
|
-
"@yarnpkg/plugin-git": "^3.0.0-rc.
|
|
32
|
+
"@yarnpkg/cli": "^4.0.0-rc.51",
|
|
33
|
+
"@yarnpkg/core": "^4.0.0-rc.51",
|
|
34
|
+
"@yarnpkg/plugin-git": "^3.0.0-rc.51"
|
|
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
|
-
"
|
|
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
|
-
"node": ">=
|
|
49
|
-
}
|
|
50
|
-
"stableVersion": "3.2.0",
|
|
51
|
-
"typings": "./lib/index.d.ts"
|
|
56
|
+
"node": ">=18.12.0"
|
|
57
|
+
}
|
|
52
58
|
}
|