@npmcli/arborist 6.1.1 → 6.1.2

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.
@@ -7,9 +7,8 @@ const cacache = require('cacache')
7
7
  const promiseCallLimit = require('promise-call-limit')
8
8
  const realpath = require('../../lib/realpath.js')
9
9
  const { resolve, dirname } = require('path')
10
- const { promisify } = require('util')
11
10
  const treeCheck = require('../tree-check.js')
12
- const readdir = promisify(require('readdir-scoped-modules'))
11
+ const { readdirScoped } = require('@npmcli/fs')
13
12
  const { lstat, readlink } = require('fs/promises')
14
13
  const { depth } = require('treeverse')
15
14
  const log = require('proc-log')
@@ -447,7 +446,8 @@ module.exports = cls => class IdealTreeBuilder extends cls {
447
446
  const globalExplicitUpdateNames = []
448
447
  if (this[_global] && (this[_updateAll] || this[_updateNames].length)) {
449
448
  const nm = resolve(this.path, 'node_modules')
450
- for (const name of await readdir(nm).catch(() => [])) {
449
+ const paths = await readdirScoped(nm).catch(() => [])
450
+ for (const name of paths.map((p) => p.replace(/\\/g, '/'))) {
451
451
  tree.package.dependencies = tree.package.dependencies || {}
452
452
  const updateName = this[_updateNames].includes(name)
453
453
  if (this[_updateAll] || updateName) {
@@ -3,8 +3,7 @@
3
3
  const { relative, dirname, resolve, join, normalize } = require('path')
4
4
 
5
5
  const rpj = require('read-package-json-fast')
6
- const { promisify } = require('util')
7
- const readdir = promisify(require('readdir-scoped-modules'))
6
+ const { readdirScoped } = require('@npmcli/fs')
8
7
  const walkUp = require('walk-up-path')
9
8
  const ancestorPath = require('common-ancestor-path')
10
9
  const treeCheck = require('../tree-check.js')
@@ -362,7 +361,7 @@ module.exports = cls => class ActualLoader extends cls {
362
361
  async [_loadFSChildren] (node) {
363
362
  const nm = resolve(node.realpath, 'node_modules')
364
363
  try {
365
- const kids = await readdir(nm)
364
+ const kids = await readdirScoped(nm).then(paths => paths.map(p => p.replace(/\\/g, '/')))
366
365
  return Promise.all(
367
366
  // ignore . dirs and retired scoped package folders
368
367
  kids.filter(kid => !/^(@[^/]+\/)?\./.test(kid))
@@ -411,8 +410,8 @@ module.exports = cls => class ActualLoader extends cls {
411
410
  break
412
411
  }
413
412
 
414
- const entries = nmContents.get(p) ||
415
- await readdir(p + '/node_modules').catch(() => [])
413
+ const entries = nmContents.get(p) || await readdirScoped(p + '/node_modules')
414
+ .catch(() => []).then(paths => paths.map(p => p.replace(/\\/g, '/')))
416
415
  nmContents.set(p, entries)
417
416
  if (!entries.includes(name)) {
418
417
  continue
@@ -19,7 +19,7 @@ const {
19
19
  rm,
20
20
  symlink,
21
21
  } = require('fs/promises')
22
- const moveFile = require('@npmcli/move-file')
22
+ const { moveFile } = require('@npmcli/fs')
23
23
  const PackageJson = require('@npmcli/package-json')
24
24
  const packageContents = require('@npmcli/installed-package-contents')
25
25
  const runScript = require('@npmcli/run-script')
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
7
+ "@npmcli/fs": "^3.1.0",
7
8
  "@npmcli/installed-package-contents": "^2.0.0",
8
9
  "@npmcli/map-workspaces": "^3.0.0",
9
10
  "@npmcli/metavuln-calculator": "^5.0.0",
10
- "@npmcli/move-file": "^3.0.0",
11
11
  "@npmcli/name-from-folder": "^1.0.1",
12
12
  "@npmcli/node-gyp": "^3.0.0",
13
13
  "@npmcli/package-json": "^3.0.0",
14
14
  "@npmcli/query": "^3.0.0",
15
15
  "@npmcli/run-script": "^6.0.0",
16
16
  "bin-links": "^4.0.1",
17
- "cacache": "^17.0.1",
17
+ "cacache": "^17.0.2",
18
18
  "common-ancestor-path": "^1.0.1",
19
19
  "hosted-git-info": "^6.1.1",
20
20
  "json-parse-even-better-errors": "^3.0.0",
@@ -32,7 +32,6 @@
32
32
  "promise-all-reject-late": "^1.0.0",
33
33
  "promise-call-limit": "^1.0.1",
34
34
  "read-package-json-fast": "^3.0.1",
35
- "readdir-scoped-modules": "^1.1.0",
36
35
  "semver": "^7.3.7",
37
36
  "ssri": "^10.0.0",
38
37
  "treeverse": "^3.0.0",
@@ -40,7 +39,7 @@
40
39
  },
41
40
  "devDependencies": {
42
41
  "@npmcli/eslint-config": "^4.0.0",
43
- "@npmcli/template-oss": "4.8.0",
42
+ "@npmcli/template-oss": "4.9.0",
44
43
  "benchmark": "^2.1.4",
45
44
  "chalk": "^4.1.0",
46
45
  "minify-registry-metadata": "^2.1.0",
@@ -102,7 +101,7 @@
102
101
  },
103
102
  "templateOSS": {
104
103
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
105
- "version": "4.8.0",
104
+ "version": "4.9.0",
106
105
  "content": "../../scripts/template-oss/index.js"
107
106
  }
108
107
  }