libnpmexec 5.0.15 → 5.0.17

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,6 +1,6 @@
1
1
  const { resolve } = require('path')
2
2
  const { stat } = require('fs/promises')
3
- const walkUp = require('walk-up-path')
3
+ const { walkUp } = require('walk-up-path')
4
4
 
5
5
  const fileExists = async (file) => {
6
6
  try {
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
- if (spec.registry && spec.type !== 'tag') {
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 manifest and check
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({ spec, tree: npxTree, flatOptions })
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.15",
3
+ "version": "5.0.17",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"
@@ -52,7 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@npmcli/eslint-config": "^4.0.0",
54
54
  "@npmcli/mock-registry": "^1.0.0",
55
- "@npmcli/template-oss": "4.12.1",
55
+ "@npmcli/template-oss": "4.14.1",
56
56
  "bin-links": "^4.0.1",
57
57
  "just-extend": "^6.2.0",
58
58
  "just-safe-set": "^4.2.1",
@@ -60,7 +60,7 @@
60
60
  "tap": "^16.3.4"
61
61
  },
62
62
  "dependencies": {
63
- "@npmcli/arborist": "^6.2.7",
63
+ "@npmcli/arborist": "^6.2.9",
64
64
  "@npmcli/run-script": "^6.0.0",
65
65
  "chalk": "^4.1.0",
66
66
  "ci-info": "^3.7.1",
@@ -71,11 +71,11 @@
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": "^1.0.0"
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.",
78
- "version": "4.12.1",
78
+ "version": "4.14.1",
79
79
  "content": "../../scripts/template-oss/index.js"
80
80
  }
81
81
  }