libnpmexec 5.0.15 → 5.0.16
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/file-exists.js +1 -1
- package/lib/index.js +14 -6
- package/package.json +3 -3
package/lib/file-exists.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -35,12 +35,15 @@ const getManifest = async (spec, flatOptions) => {
|
|
|
35
35
|
|
|
36
36
|
// Returns the required manifest if the spec is missing from the tree
|
|
37
37
|
// Returns the found node if it is in the tree
|
|
38
|
-
const missingFromTree = async ({ spec, tree, flatOptions }) => {
|
|
39
|
-
|
|
38
|
+
const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree }) => {
|
|
39
|
+
// If asking for a spec by name only (spec.raw === spec.name):
|
|
40
|
+
// - In local or global mode go with anything in the tree that matches
|
|
41
|
+
// - If looking in the npx cache check if a newer version is available
|
|
42
|
+
const npxByNameOnly = isNpxTree && spec.name === spec.raw
|
|
43
|
+
if (spec.registry && spec.type !== 'tag' && !npxByNameOnly) {
|
|
40
44
|
// registry spec that is not a specific tag.
|
|
41
45
|
const nodesBySpec = tree.inventory.query('packageName', spec.name)
|
|
42
46
|
for (const node of nodesBySpec) {
|
|
43
|
-
// package requested by name only (or name@*)
|
|
44
47
|
if (spec.rawSpec === '*') {
|
|
45
48
|
return { node }
|
|
46
49
|
}
|
|
@@ -56,8 +59,8 @@ const missingFromTree = async ({ spec, tree, flatOptions }) => {
|
|
|
56
59
|
const manifest = await getManifest(spec, flatOptions)
|
|
57
60
|
return { manifest }
|
|
58
61
|
} else {
|
|
59
|
-
// non-registry spec, or a specific tag. Look up
|
|
60
|
-
// resolved to see if it's in the tree.
|
|
62
|
+
// non-registry spec, or a specific tag, or name only in npx tree. Look up
|
|
63
|
+
// manifest and check resolved to see if it's in the tree.
|
|
61
64
|
const manifest = await getManifest(spec, flatOptions)
|
|
62
65
|
if (spec.type === 'directory') {
|
|
63
66
|
return { manifest }
|
|
@@ -224,7 +227,12 @@ const exec = async (opts) => {
|
|
|
224
227
|
})
|
|
225
228
|
const npxTree = await npxArb.loadActual()
|
|
226
229
|
await Promise.all(needInstall.map(async ({ spec }) => {
|
|
227
|
-
const { manifest } = await missingFromTree({
|
|
230
|
+
const { manifest } = await missingFromTree({
|
|
231
|
+
spec,
|
|
232
|
+
tree: npxTree,
|
|
233
|
+
flatOptions,
|
|
234
|
+
isNpxTree: true,
|
|
235
|
+
})
|
|
228
236
|
if (manifest) {
|
|
229
237
|
// Manifest is not in npxCache, we need to install it there
|
|
230
238
|
if (!spec.registry) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.16",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tap": "^16.3.4"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@npmcli/arborist": "^6.2.
|
|
63
|
+
"@npmcli/arborist": "^6.2.8",
|
|
64
64
|
"@npmcli/run-script": "^6.0.0",
|
|
65
65
|
"chalk": "^4.1.0",
|
|
66
66
|
"ci-info": "^3.7.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"read": "^2.0.0",
|
|
72
72
|
"read-package-json-fast": "^3.0.2",
|
|
73
73
|
"semver": "^7.3.7",
|
|
74
|
-
"walk-up-path": "^
|
|
74
|
+
"walk-up-path": "^3.0.1"
|
|
75
75
|
},
|
|
76
76
|
"templateOSS": {
|
|
77
77
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|