Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-09-15 21:29:13 +0300
committerGar <gar+gh@danger.computer>2021-10-07 19:07:19 +0300
commita13d9d53ddf3e0f52f4a39fe116653bf40cf99e5 (patch)
treec281324e40798b6e8e1ed53a9a2d55dd8f87b91a /node_modules/@npmcli
parent32e163fd10aace69d927dae46d04d64c04e5014b (diff)
feat: drop node 10, 11, and programmatic api
BREAKING CHANGE: - Drop official support for node versions less than v12. - Drop support for `require('npm')` - Update a few subdependencies that dropped node10 support, and brought in the latest node-gyp PR-URL: https://github.com/npm/cli/pull/3762 Credit: @wraithgar Close: #3762 Reviewed-by: @fritzy
Diffstat (limited to 'node_modules/@npmcli')
-rw-r--r--node_modules/@npmcli/arborist/bin/dedupe.js49
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/audit.js11
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js20
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/index.js29
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/rebuild.js7
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/reify.js16
-rw-r--r--node_modules/@npmcli/arborist/package.json11
-rw-r--r--node_modules/@npmcli/metavuln-calculator/package.json8
-rw-r--r--node_modules/@npmcli/run-script/package.json4
9 files changed, 88 insertions, 67 deletions
diff --git a/node_modules/@npmcli/arborist/bin/dedupe.js b/node_modules/@npmcli/arborist/bin/dedupe.js
deleted file mode 100644
index b0e83459e..000000000
--- a/node_modules/@npmcli/arborist/bin/dedupe.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const Arborist = require('../')
-
-const options = require('./lib/options.js')
-const print = require('./lib/print-tree.js')
-require('./lib/logging.js')
-require('./lib/timers.js')
-
-const printDiff = diff => {
- const {depth} = require('treeverse')
- depth({
- tree: diff,
- visit: d => {
- if (d.location === '') {
- return
- }
- switch (d.action) {
- case 'REMOVE':
- console.error('REMOVE', d.actual.location)
- break
- case 'ADD':
- console.error('ADD', d.ideal.location, d.ideal.resolved)
- break
- case 'CHANGE':
- console.error('CHANGE', d.actual.location, {
- from: d.actual.resolved,
- to: d.ideal.resolved,
- })
- break
- }
- },
- getChildren: d => d.children,
- })
-}
-
-const start = process.hrtime()
-process.emit('time', 'install')
-const arb = new Arborist(options)
-arb.dedupe(options).then(tree => {
- process.emit('timeEnd', 'install')
- const end = process.hrtime(start)
- print(tree)
- if (options.dryRun) {
- printDiff(arb.diff)
- }
- console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 1e9}s`)
- if (tree.meta && options.save) {
- tree.meta.save()
- }
-}).catch(er => console.error(require('util').inspect(er, { depth: Infinity })))
diff --git a/node_modules/@npmcli/arborist/lib/arborist/audit.js b/node_modules/@npmcli/arborist/lib/arborist/audit.js
index c0cd79bb1..eb4a35655 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/audit.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/audit.js
@@ -5,6 +5,7 @@ const AuditReport = require('../audit-report.js')
// shared with reify
const _global = Symbol.for('global')
const _workspaces = Symbol.for('workspaces')
+const _includeWorkspaceRoot = Symbol.for('includeWorkspaceRoot')
module.exports = cls => class Auditor extends cls {
async audit (options = {}) {
@@ -23,7 +24,15 @@ module.exports = cls => class Auditor extends cls {
process.emit('time', 'audit')
const tree = await this.loadVirtual()
if (this[_workspaces] && this[_workspaces].length) {
- options.filterSet = this.workspaceDependencySet(tree, this[_workspaces])
+ options.filterSet = this.workspaceDependencySet(
+ tree,
+ this[_workspaces],
+ this[_includeWorkspaceRoot]
+ )
+ }
+ if (!options.workspacesEnabled) {
+ options.filterSet =
+ this.excludeWorkspacesDependencySet(tree)
}
this.auditReport = await AuditReport.load(tree, options)
const ret = options.fix ? this.reify(options) : this.auditReport
diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index b7876b114..3e6a9838f 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -93,6 +93,7 @@ const _checkEngine = Symbol('checkEngine')
const _checkPlatform = Symbol('checkPlatform')
const _virtualRoots = Symbol('virtualRoots')
const _virtualRoot = Symbol('virtualRoot')
+const _includeWorkspaceRoot = Symbol.for('includeWorkspaceRoot')
const _failPeerConflict = Symbol('failPeerConflict')
const _explainPeerConflict = Symbol('explainPeerConflict')
@@ -115,12 +116,13 @@ module.exports = cls => class IdealTreeBuilder extends cls {
options.registry = this.registry = registry.replace(/\/+$/, '') + '/'
const {
- idealTree = null,
- global = false,
follow = false,
+ force = false,
+ global = false,
globalStyle = false,
+ idealTree = null,
+ includeWorkspaceRoot = false,
legacyPeerDeps = false,
- force = false,
packageLock = true,
strictPeerDeps = false,
workspaces = [],
@@ -162,6 +164,8 @@ module.exports = cls => class IdealTreeBuilder extends cls {
// don't hold onto references for nodes that are garbage collected.
this[_peerSetSource] = new WeakMap()
this[_virtualRoots] = new Map()
+
+ this[_includeWorkspaceRoot] = includeWorkspaceRoot
}
get explicitRequests () {
@@ -394,8 +398,14 @@ module.exports = cls => class IdealTreeBuilder extends cls {
if (!this[_workspaces].length) {
await this[_applyUserRequestsToNode](tree, options)
} else {
- await Promise.all(this.workspaceNodes(tree, this[_workspaces])
- .map(node => this[_applyUserRequestsToNode](node, options)))
+ const nodes = this.workspaceNodes(tree, this[_workspaces])
+ if (this[_includeWorkspaceRoot]) {
+ nodes.push(tree)
+ }
+ const appliedRequests = nodes.map(
+ node => this[_applyUserRequestsToNode](node, options)
+ )
+ await Promise.all(appliedRequests)
}
process.emit('timeEnd', 'idealTree:userRequests')
diff --git a/node_modules/@npmcli/arborist/lib/arborist/index.js b/node_modules/@npmcli/arborist/lib/arborist/index.js
index d8ca67faa..ccfa7cad9 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/index.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/index.js
@@ -58,6 +58,7 @@ class Arborist extends Base {
cache: options.cache || `${homedir()}/.npm/_cacache`,
packumentCache: options.packumentCache || new Map(),
log: options.log || procLog,
+ workspacesEnabled: options.workspacesEnabled !== false,
}
if (options.saveType && !saveTypeMap.get(options.saveType)) {
throw new Error(`Invalid saveType ${options.saveType}`)
@@ -73,8 +74,15 @@ class Arborist extends Base {
}
// returns a set of workspace nodes and all their deps
- workspaceDependencySet (tree, workspaces) {
+ workspaceDependencySet (tree, workspaces, includeWorkspaceRoot) {
const wsNodes = this.workspaceNodes(tree, workspaces)
+ if (includeWorkspaceRoot) {
+ for (const edge of tree.edgesOut.values()) {
+ if (edge.type !== 'workspace' && edge.to) {
+ wsNodes.push(edge.to)
+ }
+ }
+ }
const set = new Set(wsNodes)
const extraneous = new Set()
for (const node of set) {
@@ -96,6 +104,25 @@ class Arborist extends Base {
for (const extra of extraneous) {
set.add(extra)
}
+
+ return set
+ }
+
+ excludeWorkspacesDependencySet (tree) {
+ const set = new Set()
+ for (const edge of tree.edgesOut.values()) {
+ if (edge.type !== 'workspace' && edge.to) {
+ set.add(edge.to)
+ }
+ }
+ for (const node of set) {
+ for (const edge of node.edgesOut.values()) {
+ if (edge.to) {
+ set.add(edge.to)
+ }
+ }
+ }
+
return set
}
}
diff --git a/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
index e48bdd76b..6fa5c0011 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
@@ -34,6 +34,7 @@ const _addToBuildSet = Symbol('addToBuildSet')
const _checkBins = Symbol.for('checkBins')
const _queues = Symbol('queues')
const _scriptShell = Symbol('scriptShell')
+const _includeWorkspaceRoot = Symbol.for('includeWorkspaceRoot')
const _force = Symbol.for('force')
@@ -77,7 +78,11 @@ module.exports = cls => class Builder extends cls {
if (!nodes) {
const tree = await this.loadActual()
if (this[_workspaces] && this[_workspaces].length) {
- const filterSet = this.workspaceDependencySet(tree, this[_workspaces])
+ const filterSet = this.workspaceDependencySet(
+ tree,
+ this[_workspaces],
+ this[_includeWorkspaceRoot]
+ )
nodes = tree.inventory.filter(node => filterSet.has(node))
} else {
nodes = tree.inventory.values()
diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js
index 3a9c47974..a279d8956 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/reify.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js
@@ -83,6 +83,7 @@ const _validateNodeModules = Symbol('validateNodeModules')
const _nmValidated = Symbol('nmValidated')
const _validatePath = Symbol('validatePath')
const _reifyPackages = Symbol.for('reifyPackages')
+const _includeWorkspaceRoot = Symbol.for('includeWorkspaceRoot')
const _omitDev = Symbol('omitDev')
const _omitOptional = Symbol('omitOptional')
@@ -340,6 +341,15 @@ module.exports = cls => class Reifier extends cls {
filterNodes.push(actual)
}
}
+ if (this[_includeWorkspaceRoot] && (this[_workspaces].length > 0)) {
+ for (const tree of [this.idealTree, this.actualTree]) {
+ for (const {type, to} of tree.edgesOut.values()) {
+ if (type !== 'workspace' && to) {
+ filterNodes.push(to)
+ }
+ }
+ }
+ }
}
// find all the nodes that need to change between the actual
@@ -901,7 +911,11 @@ module.exports = cls => class Reifier extends cls {
// if we're operating on a workspace, only audit the workspace deps
if (this[_workspaces] && this[_workspaces].length) {
- options.filterSet = this.workspaceDependencySet(tree, this[_workspaces])
+ options.filterSet = this.workspaceDependencySet(
+ tree,
+ this[_workspaces],
+ this[_includeWorkspaceRoot]
+ )
}
this.auditReport = AuditReport.load(tree, options)
diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json
index b39818d48..b9dbbb707 100644
--- a/node_modules/@npmcli/arborist/package.json
+++ b/node_modules/@npmcli/arborist/package.json
@@ -1,17 +1,17 @@
{
"name": "@npmcli/arborist",
- "version": "2.9.0",
+ "version": "3.0.0",
"description": "Manage node_modules trees",
"dependencies": {
"@isaacs/string-locale-compare": "^1.0.1",
"@npmcli/installed-package-contents": "^1.0.7",
"@npmcli/map-workspaces": "^1.0.2",
- "@npmcli/metavuln-calculator": "^1.1.0",
+ "@npmcli/metavuln-calculator": "^2.0.0",
"@npmcli/move-file": "^1.1.0",
"@npmcli/name-from-folder": "^1.0.1",
"@npmcli/node-gyp": "^1.0.1",
"@npmcli/package-json": "^1.0.1",
- "@npmcli/run-script": "^1.8.2",
+ "@npmcli/run-script": "^2.0.0",
"bin-links": "^2.2.1",
"cacache": "^15.0.3",
"common-ancestor-path": "^1.0.1",
@@ -23,7 +23,7 @@
"npm-package-arg": "^8.1.5",
"npm-pick-manifest": "^6.1.0",
"npm-registry-fetch": "^11.0.0",
- "pacote": "^11.3.5",
+ "pacote": "^12.0.0",
"parse-conflict-json": "^1.1.1",
"proc-log": "^1.0.0",
"promise-all-reject-late": "^1.0.0",
@@ -77,6 +77,7 @@
},
"//": "sk test-env locale to catch locale-specific sorting",
"tap": {
+ "color": true,
"after": "test/fixtures/cleanup.js",
"coverage-map": "map.js",
"test-env": [
@@ -90,6 +91,6 @@
"timeout": "240"
},
"engines": {
- "node": ">= 10"
+ "node": "^12.13.0 || ^14.15.0 || >=16"
}
}
diff --git a/node_modules/@npmcli/metavuln-calculator/package.json b/node_modules/@npmcli/metavuln-calculator/package.json
index 4ad6193ae..131cff672 100644
--- a/node_modules/@npmcli/metavuln-calculator/package.json
+++ b/node_modules/@npmcli/metavuln-calculator/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/metavuln-calculator",
- "version": "1.1.1",
+ "version": "2.0.0",
"main": "lib/index.js",
"files": [
"lib"
@@ -36,7 +36,11 @@
},
"dependencies": {
"cacache": "^15.0.5",
- "pacote": "^11.1.11",
+ "json-parse-even-better-errors": "^2.3.1",
+ "pacote": "^12.0.0",
"semver": "^7.3.2"
+ },
+ "engines": {
+ "node": "^12.13.0 || ^14.15.0 || >=16"
}
}
diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json
index 5a5d1a71d..9e744e639 100644
--- a/node_modules/@npmcli/run-script/package.json
+++ b/node_modules/@npmcli/run-script/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/run-script",
- "version": "1.8.6",
+ "version": "2.0.0",
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
"author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",
"license": "ISC",
@@ -30,7 +30,7 @@
"dependencies": {
"@npmcli/node-gyp": "^1.0.2",
"@npmcli/promise-spawn": "^1.3.2",
- "node-gyp": "^7.1.0",
+ "node-gyp": "^8.2.0",
"read-package-json-fast": "^2.0.1"
},
"files": [