From 7f02c11abf600ec05535d81d7647b2c20174a64d Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 20:26:16 +0000 Subject: [PATCH 1/8] test: add fixture --- .../test/arborist/pruner.js.test.cjs | 979 ++++++++++++++++++ workspaces/arborist/test/arborist/pruner.js | 20 + .../package-lock.json | 343 ++++++ .../prune-lockfile-optional-peer/package.json | 7 + .../prune-lockfile-optional-peer.js | 356 +++++++ 5 files changed, 1705 insertions(+) create mode 100644 workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package-lock.json create mode 100644 workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package.json create mode 100644 workspaces/arborist/test/fixtures/reify-cases/prune-lockfile-optional-peer.js diff --git a/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs index 16c732a8b5600..3b428d0a955de 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs @@ -124,6 +124,985 @@ ArboristNode { } ` +exports[`test/arborist/pruner.js TAP prune with lockfile with implicit optional peer dependencies > should remove all deps from reified tree 1`] = ` +ArboristNode { + "children": Map { + "@babel/code-frame" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/parse-json", + "name": "@babel/code-frame", + "spec": "^7.0.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "@babel/helper-validator-identifier" => EdgeOut { + "name": "@babel/helper-validator-identifier", + "spec": "^7.27.1", + "to": "node_modules/@babel/helper-validator-identifier", + "type": "prod", + }, + "js-tokens" => EdgeOut { + "name": "js-tokens", + "spec": "^4.0.0", + "to": "node_modules/js-tokens", + "type": "prod", + }, + "picocolors" => EdgeOut { + "name": "picocolors", + "spec": "^1.1.1", + "to": "node_modules/picocolors", + "type": "prod", + }, + }, + "location": "node_modules/@babel/code-frame", + "name": "@babel/code-frame", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/code-frame", + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "version": "7.27.1", + }, + "@babel/helper-validator-identifier" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/@babel/code-frame", + "name": "@babel/helper-validator-identifier", + "spec": "^7.27.1", + "type": "prod", + }, + }, + "location": "node_modules/@babel/helper-validator-identifier", + "name": "@babel/helper-validator-identifier", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/helper-validator-identifier", + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "version": "7.27.1", + }, + "@babel/runtime" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/babel-plugin-macros", + "name": "@babel/runtime", + "spec": "^7.12.5", + "type": "prod", + }, + }, + "location": "node_modules/@babel/runtime", + "name": "@babel/runtime", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/runtime", + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "version": "7.27.6", + }, + "@types/parse-json" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/cosmiconfig", + "name": "@types/parse-json", + "spec": "^4.0.0", + "type": "prod", + }, + }, + "location": "node_modules/@types/parse-json", + "name": "@types/parse-json", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@types/parse-json", + "peer": true, + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "version": "4.0.2", + }, + "babel-plugin-macros" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/dedent", + "name": "babel-plugin-macros", + "spec": "^3.1.0", + "type": "peerOptional", + }, + }, + "edgesOut": Map { + "@babel/runtime" => EdgeOut { + "name": "@babel/runtime", + "spec": "^7.12.5", + "to": "node_modules/@babel/runtime", + "type": "prod", + }, + "cosmiconfig" => EdgeOut { + "name": "cosmiconfig", + "spec": "^7.0.0", + "to": "node_modules/cosmiconfig", + "type": "prod", + }, + "resolve" => EdgeOut { + "name": "resolve", + "spec": "^1.19.0", + "to": "node_modules/resolve", + "type": "prod", + }, + }, + "location": "node_modules/babel-plugin-macros", + "name": "babel-plugin-macros", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/babel-plugin-macros", + "peer": true, + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "version": "3.1.0", + }, + "callsites" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/parent-module", + "name": "callsites", + "spec": "^3.0.0", + "type": "prod", + }, + }, + "location": "node_modules/callsites", + "name": "callsites", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/callsites", + "peer": true, + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "version": "3.1.0", + }, + "cosmiconfig" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/babel-plugin-macros", + "name": "cosmiconfig", + "spec": "^7.0.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "@types/parse-json" => EdgeOut { + "name": "@types/parse-json", + "spec": "^4.0.0", + "to": "node_modules/@types/parse-json", + "type": "prod", + }, + "import-fresh" => EdgeOut { + "name": "import-fresh", + "spec": "^3.2.1", + "to": "node_modules/import-fresh", + "type": "prod", + }, + "parse-json" => EdgeOut { + "name": "parse-json", + "spec": "^5.0.0", + "to": "node_modules/parse-json", + "type": "prod", + }, + "path-type" => EdgeOut { + "name": "path-type", + "spec": "^4.0.0", + "to": "node_modules/path-type", + "type": "prod", + }, + "yaml" => EdgeOut { + "name": "yaml", + "spec": "^1.10.0", + "to": "node_modules/yaml", + "type": "prod", + }, + }, + "location": "node_modules/cosmiconfig", + "name": "cosmiconfig", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/cosmiconfig", + "peer": true, + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "version": "7.1.0", + }, + "dedent" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "", + "name": "dedent", + "spec": "^1.6.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "babel-plugin-macros" => EdgeOut { + "name": "babel-plugin-macros", + "spec": "^3.1.0", + "to": "node_modules/babel-plugin-macros", + "type": "peerOptional", + }, + }, + "location": "node_modules/dedent", + "name": "dedent", + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/dedent", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", + "version": "1.6.0", + }, + "error-ex" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/parse-json", + "name": "error-ex", + "spec": "^1.3.1", + "type": "prod", + }, + }, + "edgesOut": Map { + "is-arrayish" => EdgeOut { + "name": "is-arrayish", + "spec": "^0.2.1", + "to": "node_modules/is-arrayish", + "type": "prod", + }, + }, + "location": "node_modules/error-ex", + "name": "error-ex", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/error-ex", + "peer": true, + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "version": "1.3.2", + }, + "function-bind" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/hasown", + "name": "function-bind", + "spec": "^1.1.2", + "type": "prod", + }, + }, + "location": "node_modules/function-bind", + "name": "function-bind", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/function-bind", + "peer": true, + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "version": "1.1.2", + }, + "hasown" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/is-core-module", + "name": "hasown", + "spec": "^2.0.2", + "type": "prod", + }, + }, + "edgesOut": Map { + "function-bind" => EdgeOut { + "name": "function-bind", + "spec": "^1.1.2", + "to": "node_modules/function-bind", + "type": "prod", + }, + }, + "location": "node_modules/hasown", + "name": "hasown", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/hasown", + "peer": true, + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "version": "2.0.2", + }, + "import-fresh" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/cosmiconfig", + "name": "import-fresh", + "spec": "^3.2.1", + "type": "prod", + }, + }, + "edgesOut": Map { + "parent-module" => EdgeOut { + "name": "parent-module", + "spec": "^1.0.0", + "to": "node_modules/parent-module", + "type": "prod", + }, + "resolve-from" => EdgeOut { + "name": "resolve-from", + "spec": "^4.0.0", + "to": "node_modules/resolve-from", + "type": "prod", + }, + }, + "location": "node_modules/import-fresh", + "name": "import-fresh", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/import-fresh", + "peer": true, + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "version": "3.3.1", + }, + "is-arrayish" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/error-ex", + "name": "is-arrayish", + "spec": "^0.2.1", + "type": "prod", + }, + }, + "location": "node_modules/is-arrayish", + "name": "is-arrayish", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/is-arrayish", + "peer": true, + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "version": "0.2.1", + }, + "is-core-module" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/resolve", + "name": "is-core-module", + "spec": "^2.16.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "hasown" => EdgeOut { + "name": "hasown", + "spec": "^2.0.2", + "to": "node_modules/hasown", + "type": "prod", + }, + }, + "location": "node_modules/is-core-module", + "name": "is-core-module", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/is-core-module", + "peer": true, + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "version": "2.16.1", + }, + "js-tokens" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/@babel/code-frame", + "name": "js-tokens", + "spec": "^4.0.0", + "type": "prod", + }, + }, + "location": "node_modules/js-tokens", + "name": "js-tokens", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/js-tokens", + "peer": true, + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "version": "4.0.0", + }, + "json-parse-even-better-errors" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/parse-json", + "name": "json-parse-even-better-errors", + "spec": "^2.3.0", + "type": "prod", + }, + }, + "location": "node_modules/json-parse-even-better-errors", + "name": "json-parse-even-better-errors", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/json-parse-even-better-errors", + "peer": true, + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "version": "2.3.1", + }, + "lines-and-columns" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/parse-json", + "name": "lines-and-columns", + "spec": "^1.1.6", + "type": "prod", + }, + }, + "location": "node_modules/lines-and-columns", + "name": "lines-and-columns", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/lines-and-columns", + "peer": true, + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "version": "1.2.4", + }, + "parent-module" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/import-fresh", + "name": "parent-module", + "spec": "^1.0.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "callsites" => EdgeOut { + "name": "callsites", + "spec": "^3.0.0", + "to": "node_modules/callsites", + "type": "prod", + }, + }, + "location": "node_modules/parent-module", + "name": "parent-module", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/parent-module", + "peer": true, + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "version": "1.0.1", + }, + "parse-json" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/cosmiconfig", + "name": "parse-json", + "spec": "^5.0.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "@babel/code-frame" => EdgeOut { + "name": "@babel/code-frame", + "spec": "^7.0.0", + "to": "node_modules/@babel/code-frame", + "type": "prod", + }, + "error-ex" => EdgeOut { + "name": "error-ex", + "spec": "^1.3.1", + "to": "node_modules/error-ex", + "type": "prod", + }, + "json-parse-even-better-errors" => EdgeOut { + "name": "json-parse-even-better-errors", + "spec": "^2.3.0", + "to": "node_modules/json-parse-even-better-errors", + "type": "prod", + }, + "lines-and-columns" => EdgeOut { + "name": "lines-and-columns", + "spec": "^1.1.6", + "to": "node_modules/lines-and-columns", + "type": "prod", + }, + }, + "location": "node_modules/parse-json", + "name": "parse-json", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/parse-json", + "peer": true, + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "version": "5.2.0", + }, + "path-parse" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/resolve", + "name": "path-parse", + "spec": "^1.0.7", + "type": "prod", + }, + }, + "location": "node_modules/path-parse", + "name": "path-parse", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/path-parse", + "peer": true, + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "version": "1.0.7", + }, + "path-type" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/cosmiconfig", + "name": "path-type", + "spec": "^4.0.0", + "type": "prod", + }, + }, + "location": "node_modules/path-type", + "name": "path-type", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/path-type", + "peer": true, + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "version": "4.0.0", + }, + "picocolors" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/@babel/code-frame", + "name": "picocolors", + "spec": "^1.1.1", + "type": "prod", + }, + }, + "location": "node_modules/picocolors", + "name": "picocolors", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/picocolors", + "peer": true, + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "version": "1.1.1", + }, + "resolve" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/babel-plugin-macros", + "name": "resolve", + "spec": "^1.19.0", + "type": "prod", + }, + }, + "edgesOut": Map { + "is-core-module" => EdgeOut { + "name": "is-core-module", + "spec": "^2.16.0", + "to": "node_modules/is-core-module", + "type": "prod", + }, + "path-parse" => EdgeOut { + "name": "path-parse", + "spec": "^1.0.7", + "to": "node_modules/path-parse", + "type": "prod", + }, + "supports-preserve-symlinks-flag" => EdgeOut { + "name": "supports-preserve-symlinks-flag", + "spec": "^1.0.0", + "to": "node_modules/supports-preserve-symlinks-flag", + "type": "prod", + }, + }, + "location": "node_modules/resolve", + "name": "resolve", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/resolve", + "peer": true, + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "version": "1.22.10", + }, + "resolve-from" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/import-fresh", + "name": "resolve-from", + "spec": "^4.0.0", + "type": "prod", + }, + }, + "location": "node_modules/resolve-from", + "name": "resolve-from", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/resolve-from", + "peer": true, + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "version": "4.0.0", + }, + "supports-preserve-symlinks-flag" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/resolve", + "name": "supports-preserve-symlinks-flag", + "spec": "^1.0.0", + "type": "prod", + }, + }, + "location": "node_modules/supports-preserve-symlinks-flag", + "name": "supports-preserve-symlinks-flag", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/supports-preserve-symlinks-flag", + "peer": true, + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "version": "1.0.0", + }, + "yaml" => ArboristNode { + "edgesIn": Set { + EdgeIn { + "from": "node_modules/cosmiconfig", + "name": "yaml", + "spec": "^1.10.0", + "type": "prod", + }, + }, + "location": "node_modules/yaml", + "name": "yaml", + "optional": true, + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/yaml", + "peer": true, + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "version": "1.10.2", + }, + }, + "edgesOut": Map { + "dedent" => EdgeOut { + "name": "dedent", + "spec": "^1.6.0", + "to": "node_modules/dedent", + "type": "prod", + }, + }, + "isProjectRoot": true, + "location": "", + "name": "tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies", + "packageName": "prune-lockfile-optional-peer", + "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies", + "version": "1.0.0", +} +` + +exports[`test/arborist/pruner.js TAP prune with lockfile with implicit optional peer dependencies > should remove optional peer dependencies in package-lock.json 1`] = ` +Object { + "lockfileVersion": 3, + "name": "prune-lockfile-optional-peer", + "packages": Object { + "": Object { + "dependencies": Object { + "dedent": "^1.6.0", + }, + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + }, + "node_modules/@babel/code-frame": Object { + "dependencies": Object { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1", + }, + "engines": Object { + "node": ">=6.9.0", + }, + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "version": "7.27.1", + }, + "node_modules/@babel/helper-validator-identifier": Object { + "engines": Object { + "node": ">=6.9.0", + }, + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "version": "7.27.1", + }, + "node_modules/@babel/runtime": Object { + "engines": Object { + "node": ">=6.9.0", + }, + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "version": "7.27.6", + }, + "node_modules/@types/parse-json": Object { + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "version": "4.0.2", + }, + "node_modules/babel-plugin-macros": Object { + "dependencies": Object { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0", + }, + "engines": Object { + "node": ">=10", + "npm": ">=6", + }, + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "version": "3.1.0", + }, + "node_modules/callsites": Object { + "engines": Object { + "node": ">=6", + }, + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "version": "3.1.0", + }, + "node_modules/cosmiconfig": Object { + "dependencies": Object { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0", + }, + "engines": Object { + "node": ">=10", + }, + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "version": "7.1.0", + }, + "node_modules/dedent": Object { + "integrity": "sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA==", + "license": "MIT", + "peerDependencies": Object { + "babel-plugin-macros": "^3.1.0", + }, + "peerDependenciesMeta": Object { + "babel-plugin-macros": Object { + "optional": true, + }, + }, + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", + "version": "1.6.0", + }, + "node_modules/error-ex": Object { + "dependencies": Object { + "is-arrayish": "^0.2.1", + }, + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "version": "1.3.2", + }, + "node_modules/function-bind": Object { + "funding": Object { + "url": "https://github.com/sponsors/ljharb", + }, + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "version": "1.1.2", + }, + "node_modules/hasown": Object { + "dependencies": Object { + "function-bind": "^1.1.2", + }, + "engines": Object { + "node": ">= 0.4", + }, + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "version": "2.0.2", + }, + "node_modules/import-fresh": Object { + "dependencies": Object { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0", + }, + "engines": Object { + "node": ">=6", + }, + "funding": Object { + "url": "https://github.com/sponsors/sindresorhus", + }, + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "version": "3.3.1", + }, + "node_modules/is-arrayish": Object { + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "version": "0.2.1", + }, + "node_modules/is-core-module": Object { + "dependencies": Object { + "hasown": "^2.0.2", + }, + "engines": Object { + "node": ">= 0.4", + }, + "funding": Object { + "url": "https://github.com/sponsors/ljharb", + }, + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "version": "2.16.1", + }, + "node_modules/js-tokens": Object { + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "version": "4.0.0", + }, + "node_modules/json-parse-even-better-errors": Object { + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "version": "2.3.1", + }, + "node_modules/lines-and-columns": Object { + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "version": "1.2.4", + }, + "node_modules/parent-module": Object { + "dependencies": Object { + "callsites": "^3.0.0", + }, + "engines": Object { + "node": ">=6", + }, + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "version": "1.0.1", + }, + "node_modules/parse-json": Object { + "dependencies": Object { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6", + }, + "engines": Object { + "node": ">=8", + }, + "funding": Object { + "url": "https://github.com/sponsors/sindresorhus", + }, + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "version": "5.2.0", + }, + "node_modules/path-parse": Object { + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "version": "1.0.7", + }, + "node_modules/path-type": Object { + "engines": Object { + "node": ">=8", + }, + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "version": "4.0.0", + }, + "node_modules/picocolors": Object { + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "version": "1.1.1", + }, + "node_modules/resolve": Object { + "bin": Object { + "resolve": "bin/resolve", + }, + "dependencies": Object { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0", + }, + "engines": Object { + "node": ">= 0.4", + }, + "funding": Object { + "url": "https://github.com/sponsors/ljharb", + }, + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "version": "1.22.10", + }, + "node_modules/resolve-from": Object { + "engines": Object { + "node": ">=4", + }, + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "version": "4.0.0", + }, + "node_modules/supports-preserve-symlinks-flag": Object { + "engines": Object { + "node": ">= 0.4", + }, + "funding": Object { + "url": "https://github.com/sponsors/ljharb", + }, + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "version": "1.0.0", + }, + "node_modules/yaml": Object { + "engines": Object { + "node": ">= 6", + }, + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "optional": true, + "peer": true, + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "version": "1.10.2", + }, + }, + "requires": true, + "version": "1.0.0", +} +` + exports[`test/arborist/pruner.js TAP prune workspaces > must match snapshot 1`] = ` ArboristNode { "children": Map { diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index 4a6ae4fd484bb..4669a96ce751e 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -38,6 +38,26 @@ t.test('prune with lockfile', async t => { t.matchSnapshot(printTree(tree)) }) +t.test('prune with lockfile with implicit optional peer dependencies', async t => { + const path = fixture(t, 'prune-lockfile-optional-peer') + const tree = await pruneTree(path) + + const dep = tree.children.get('dedent') + t.ok(dep, 'required prod dep was pruned from tree') + + const optionalPeerDep = tree.children.get('babel-plugin-macros') + t.notOk(optionalPeerDep, 'all listed optional peer deps pruned from tree') + + t.matchSnapshot( + require(path + '/package-lock.json'), + 'should remove optional peer dependencies in package-lock.json' + ) + t.matchSnapshot( + printTree(tree), + 'should remove all deps from reified tree' + ) +}) + t.test('prune with actual tree omit dev', async t => { const path = fixture(t, 'prune-actual-omit-dev') const tree = await pruneTree(path, { omit: ['dev'] }) diff --git a/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package-lock.json b/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package-lock.json new file mode 100644 index 0000000000000..859d9f5f7770c --- /dev/null +++ b/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package-lock.json @@ -0,0 +1,343 @@ +{ + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "dependencies": { + "dedent": "^1.6.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/dedent": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", + "integrity": "sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA==", + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "optional": true, + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC", + "optional": true, + "peer": true + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "optional": true, + "peer": true, + "engines": { + "node": ">= 6" + } + } + } +} diff --git a/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package.json b/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package.json new file mode 100644 index 0000000000000..e2dd1a11a8614 --- /dev/null +++ b/workspaces/arborist/test/fixtures/prune-lockfile-optional-peer/package.json @@ -0,0 +1,7 @@ +{ + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "dependencies": { + "dedent": "^1.6.0" + } +} diff --git a/workspaces/arborist/test/fixtures/reify-cases/prune-lockfile-optional-peer.js b/workspaces/arborist/test/fixtures/reify-cases/prune-lockfile-optional-peer.js new file mode 100644 index 0000000000000..b98dc57d3ae0e --- /dev/null +++ b/workspaces/arborist/test/fixtures/reify-cases/prune-lockfile-optional-peer.js @@ -0,0 +1,356 @@ +// generated from test/fixtures/prune-lockfile-optional-peer +module.exports = t => { + const path = t.testdir({ + "package-lock.json": JSON.stringify({ + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "dependencies": { + "dedent": "^1.6.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/dedent": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", + "integrity": "sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA==", + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "optional": true, + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC", + "optional": true, + "peer": true + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "optional": true, + "peer": true, + "engines": { + "node": ">= 6" + } + } + } + }), + "package.json": JSON.stringify({ + "name": "prune-lockfile-optional-peer", + "version": "1.0.0", + "dependencies": { + "dedent": "^1.6.0" + } + }) + }) + return path +} From 2b0f8e5d6a6e880ea64b50d8895e21bfe604a034 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 20:49:07 +0000 Subject: [PATCH 2/8] fix: prune optional peer dependencies from tree --- .../arborist/lib/arborist/build-ideal-tree.js | 2 +- .../test/arborist/pruner.js.test.cjs | 905 +----------------- 2 files changed, 2 insertions(+), 905 deletions(-) diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 56b347c3affbb..3783180e4fc54 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -1516,7 +1516,7 @@ This is a one-time fix-up, please be patient... #idealTreePrune () { for (const node of this.idealTree.inventory.values()) { - if (node.extraneous) { + if (node.extraneous || (node.peer && node.optional)) { node.parent = null } } diff --git a/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs index 3b428d0a955de..2c5323fc59d3c 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/pruner.js.test.cjs @@ -127,197 +127,6 @@ ArboristNode { exports[`test/arborist/pruner.js TAP prune with lockfile with implicit optional peer dependencies > should remove all deps from reified tree 1`] = ` ArboristNode { "children": Map { - "@babel/code-frame" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/parse-json", - "name": "@babel/code-frame", - "spec": "^7.0.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "@babel/helper-validator-identifier" => EdgeOut { - "name": "@babel/helper-validator-identifier", - "spec": "^7.27.1", - "to": "node_modules/@babel/helper-validator-identifier", - "type": "prod", - }, - "js-tokens" => EdgeOut { - "name": "js-tokens", - "spec": "^4.0.0", - "to": "node_modules/js-tokens", - "type": "prod", - }, - "picocolors" => EdgeOut { - "name": "picocolors", - "spec": "^1.1.1", - "to": "node_modules/picocolors", - "type": "prod", - }, - }, - "location": "node_modules/@babel/code-frame", - "name": "@babel/code-frame", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/code-frame", - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "version": "7.27.1", - }, - "@babel/helper-validator-identifier" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/@babel/code-frame", - "name": "@babel/helper-validator-identifier", - "spec": "^7.27.1", - "type": "prod", - }, - }, - "location": "node_modules/@babel/helper-validator-identifier", - "name": "@babel/helper-validator-identifier", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/helper-validator-identifier", - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "version": "7.27.1", - }, - "@babel/runtime" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/babel-plugin-macros", - "name": "@babel/runtime", - "spec": "^7.12.5", - "type": "prod", - }, - }, - "location": "node_modules/@babel/runtime", - "name": "@babel/runtime", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@babel/runtime", - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", - "version": "7.27.6", - }, - "@types/parse-json" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/cosmiconfig", - "name": "@types/parse-json", - "spec": "^4.0.0", - "type": "prod", - }, - }, - "location": "node_modules/@types/parse-json", - "name": "@types/parse-json", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/@types/parse-json", - "peer": true, - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", - "version": "4.0.2", - }, - "babel-plugin-macros" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/dedent", - "name": "babel-plugin-macros", - "spec": "^3.1.0", - "type": "peerOptional", - }, - }, - "edgesOut": Map { - "@babel/runtime" => EdgeOut { - "name": "@babel/runtime", - "spec": "^7.12.5", - "to": "node_modules/@babel/runtime", - "type": "prod", - }, - "cosmiconfig" => EdgeOut { - "name": "cosmiconfig", - "spec": "^7.0.0", - "to": "node_modules/cosmiconfig", - "type": "prod", - }, - "resolve" => EdgeOut { - "name": "resolve", - "spec": "^1.19.0", - "to": "node_modules/resolve", - "type": "prod", - }, - }, - "location": "node_modules/babel-plugin-macros", - "name": "babel-plugin-macros", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/babel-plugin-macros", - "peer": true, - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "version": "3.1.0", - }, - "callsites" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/parent-module", - "name": "callsites", - "spec": "^3.0.0", - "type": "prod", - }, - }, - "location": "node_modules/callsites", - "name": "callsites", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/callsites", - "peer": true, - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "version": "3.1.0", - }, - "cosmiconfig" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/babel-plugin-macros", - "name": "cosmiconfig", - "spec": "^7.0.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "@types/parse-json" => EdgeOut { - "name": "@types/parse-json", - "spec": "^4.0.0", - "to": "node_modules/@types/parse-json", - "type": "prod", - }, - "import-fresh" => EdgeOut { - "name": "import-fresh", - "spec": "^3.2.1", - "to": "node_modules/import-fresh", - "type": "prod", - }, - "parse-json" => EdgeOut { - "name": "parse-json", - "spec": "^5.0.0", - "to": "node_modules/parse-json", - "type": "prod", - }, - "path-type" => EdgeOut { - "name": "path-type", - "spec": "^4.0.0", - "to": "node_modules/path-type", - "type": "prod", - }, - "yaml" => EdgeOut { - "name": "yaml", - "spec": "^1.10.0", - "to": "node_modules/yaml", - "type": "prod", - }, - }, - "location": "node_modules/cosmiconfig", - "name": "cosmiconfig", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/cosmiconfig", - "peer": true, - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "version": "7.1.0", - }, "dedent" => ArboristNode { "edgesIn": Set { EdgeIn { @@ -331,7 +140,7 @@ ArboristNode { "babel-plugin-macros" => EdgeOut { "name": "babel-plugin-macros", "spec": "^3.1.0", - "to": "node_modules/babel-plugin-macros", + "to": null, "type": "peerOptional", }, }, @@ -341,404 +150,6 @@ ArboristNode { "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", "version": "1.6.0", }, - "error-ex" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/parse-json", - "name": "error-ex", - "spec": "^1.3.1", - "type": "prod", - }, - }, - "edgesOut": Map { - "is-arrayish" => EdgeOut { - "name": "is-arrayish", - "spec": "^0.2.1", - "to": "node_modules/is-arrayish", - "type": "prod", - }, - }, - "location": "node_modules/error-ex", - "name": "error-ex", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/error-ex", - "peer": true, - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "version": "1.3.2", - }, - "function-bind" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/hasown", - "name": "function-bind", - "spec": "^1.1.2", - "type": "prod", - }, - }, - "location": "node_modules/function-bind", - "name": "function-bind", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/function-bind", - "peer": true, - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "version": "1.1.2", - }, - "hasown" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/is-core-module", - "name": "hasown", - "spec": "^2.0.2", - "type": "prod", - }, - }, - "edgesOut": Map { - "function-bind" => EdgeOut { - "name": "function-bind", - "spec": "^1.1.2", - "to": "node_modules/function-bind", - "type": "prod", - }, - }, - "location": "node_modules/hasown", - "name": "hasown", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/hasown", - "peer": true, - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "version": "2.0.2", - }, - "import-fresh" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/cosmiconfig", - "name": "import-fresh", - "spec": "^3.2.1", - "type": "prod", - }, - }, - "edgesOut": Map { - "parent-module" => EdgeOut { - "name": "parent-module", - "spec": "^1.0.0", - "to": "node_modules/parent-module", - "type": "prod", - }, - "resolve-from" => EdgeOut { - "name": "resolve-from", - "spec": "^4.0.0", - "to": "node_modules/resolve-from", - "type": "prod", - }, - }, - "location": "node_modules/import-fresh", - "name": "import-fresh", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/import-fresh", - "peer": true, - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "version": "3.3.1", - }, - "is-arrayish" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/error-ex", - "name": "is-arrayish", - "spec": "^0.2.1", - "type": "prod", - }, - }, - "location": "node_modules/is-arrayish", - "name": "is-arrayish", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/is-arrayish", - "peer": true, - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "version": "0.2.1", - }, - "is-core-module" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/resolve", - "name": "is-core-module", - "spec": "^2.16.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "hasown" => EdgeOut { - "name": "hasown", - "spec": "^2.0.2", - "to": "node_modules/hasown", - "type": "prod", - }, - }, - "location": "node_modules/is-core-module", - "name": "is-core-module", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/is-core-module", - "peer": true, - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "version": "2.16.1", - }, - "js-tokens" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/@babel/code-frame", - "name": "js-tokens", - "spec": "^4.0.0", - "type": "prod", - }, - }, - "location": "node_modules/js-tokens", - "name": "js-tokens", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/js-tokens", - "peer": true, - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "version": "4.0.0", - }, - "json-parse-even-better-errors" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/parse-json", - "name": "json-parse-even-better-errors", - "spec": "^2.3.0", - "type": "prod", - }, - }, - "location": "node_modules/json-parse-even-better-errors", - "name": "json-parse-even-better-errors", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/json-parse-even-better-errors", - "peer": true, - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "version": "2.3.1", - }, - "lines-and-columns" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/parse-json", - "name": "lines-and-columns", - "spec": "^1.1.6", - "type": "prod", - }, - }, - "location": "node_modules/lines-and-columns", - "name": "lines-and-columns", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/lines-and-columns", - "peer": true, - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "version": "1.2.4", - }, - "parent-module" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/import-fresh", - "name": "parent-module", - "spec": "^1.0.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "callsites" => EdgeOut { - "name": "callsites", - "spec": "^3.0.0", - "to": "node_modules/callsites", - "type": "prod", - }, - }, - "location": "node_modules/parent-module", - "name": "parent-module", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/parent-module", - "peer": true, - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "version": "1.0.1", - }, - "parse-json" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/cosmiconfig", - "name": "parse-json", - "spec": "^5.0.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "@babel/code-frame" => EdgeOut { - "name": "@babel/code-frame", - "spec": "^7.0.0", - "to": "node_modules/@babel/code-frame", - "type": "prod", - }, - "error-ex" => EdgeOut { - "name": "error-ex", - "spec": "^1.3.1", - "to": "node_modules/error-ex", - "type": "prod", - }, - "json-parse-even-better-errors" => EdgeOut { - "name": "json-parse-even-better-errors", - "spec": "^2.3.0", - "to": "node_modules/json-parse-even-better-errors", - "type": "prod", - }, - "lines-and-columns" => EdgeOut { - "name": "lines-and-columns", - "spec": "^1.1.6", - "to": "node_modules/lines-and-columns", - "type": "prod", - }, - }, - "location": "node_modules/parse-json", - "name": "parse-json", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/parse-json", - "peer": true, - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "version": "5.2.0", - }, - "path-parse" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/resolve", - "name": "path-parse", - "spec": "^1.0.7", - "type": "prod", - }, - }, - "location": "node_modules/path-parse", - "name": "path-parse", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/path-parse", - "peer": true, - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "version": "1.0.7", - }, - "path-type" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/cosmiconfig", - "name": "path-type", - "spec": "^4.0.0", - "type": "prod", - }, - }, - "location": "node_modules/path-type", - "name": "path-type", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/path-type", - "peer": true, - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "version": "4.0.0", - }, - "picocolors" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/@babel/code-frame", - "name": "picocolors", - "spec": "^1.1.1", - "type": "prod", - }, - }, - "location": "node_modules/picocolors", - "name": "picocolors", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/picocolors", - "peer": true, - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "version": "1.1.1", - }, - "resolve" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/babel-plugin-macros", - "name": "resolve", - "spec": "^1.19.0", - "type": "prod", - }, - }, - "edgesOut": Map { - "is-core-module" => EdgeOut { - "name": "is-core-module", - "spec": "^2.16.0", - "to": "node_modules/is-core-module", - "type": "prod", - }, - "path-parse" => EdgeOut { - "name": "path-parse", - "spec": "^1.0.7", - "to": "node_modules/path-parse", - "type": "prod", - }, - "supports-preserve-symlinks-flag" => EdgeOut { - "name": "supports-preserve-symlinks-flag", - "spec": "^1.0.0", - "to": "node_modules/supports-preserve-symlinks-flag", - "type": "prod", - }, - }, - "location": "node_modules/resolve", - "name": "resolve", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/resolve", - "peer": true, - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "version": "1.22.10", - }, - "resolve-from" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/import-fresh", - "name": "resolve-from", - "spec": "^4.0.0", - "type": "prod", - }, - }, - "location": "node_modules/resolve-from", - "name": "resolve-from", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/resolve-from", - "peer": true, - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "version": "4.0.0", - }, - "supports-preserve-symlinks-flag" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/resolve", - "name": "supports-preserve-symlinks-flag", - "spec": "^1.0.0", - "type": "prod", - }, - }, - "location": "node_modules/supports-preserve-symlinks-flag", - "name": "supports-preserve-symlinks-flag", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/supports-preserve-symlinks-flag", - "peer": true, - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "version": "1.0.0", - }, - "yaml" => ArboristNode { - "edgesIn": Set { - EdgeIn { - "from": "node_modules/cosmiconfig", - "name": "yaml", - "spec": "^1.10.0", - "type": "prod", - }, - }, - "location": "node_modules/yaml", - "name": "yaml", - "optional": true, - "path": "{CWD}/test/arborist/tap-testdir-pruner-prune-with-lockfile-with-implicit-optional-peer-dependencies/node_modules/yaml", - "peer": true, - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "version": "1.10.2", - }, }, "edgesOut": Map { "dedent" => EdgeOut { @@ -769,98 +180,6 @@ Object { "name": "prune-lockfile-optional-peer", "version": "1.0.0", }, - "node_modules/@babel/code-frame": Object { - "dependencies": Object { - "@babel/helper-validator-identifier": "^7.27.1", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1", - }, - "engines": Object { - "node": ">=6.9.0", - }, - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "version": "7.27.1", - }, - "node_modules/@babel/helper-validator-identifier": Object { - "engines": Object { - "node": ">=6.9.0", - }, - "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "version": "7.27.1", - }, - "node_modules/@babel/runtime": Object { - "engines": Object { - "node": ">=6.9.0", - }, - "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", - "version": "7.27.6", - }, - "node_modules/@types/parse-json": Object { - "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", - "version": "4.0.2", - }, - "node_modules/babel-plugin-macros": Object { - "dependencies": Object { - "@babel/runtime": "^7.12.5", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0", - }, - "engines": Object { - "node": ">=10", - "npm": ">=6", - }, - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "version": "3.1.0", - }, - "node_modules/callsites": Object { - "engines": Object { - "node": ">=6", - }, - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "version": "3.1.0", - }, - "node_modules/cosmiconfig": Object { - "dependencies": Object { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0", - }, - "engines": Object { - "node": ">=10", - }, - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "version": "7.1.0", - }, "node_modules/dedent": Object { "integrity": "sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA==", "license": "MIT", @@ -875,228 +194,6 @@ Object { "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz", "version": "1.6.0", }, - "node_modules/error-ex": Object { - "dependencies": Object { - "is-arrayish": "^0.2.1", - }, - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "version": "1.3.2", - }, - "node_modules/function-bind": Object { - "funding": Object { - "url": "https://github.com/sponsors/ljharb", - }, - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "version": "1.1.2", - }, - "node_modules/hasown": Object { - "dependencies": Object { - "function-bind": "^1.1.2", - }, - "engines": Object { - "node": ">= 0.4", - }, - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "version": "2.0.2", - }, - "node_modules/import-fresh": Object { - "dependencies": Object { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0", - }, - "engines": Object { - "node": ">=6", - }, - "funding": Object { - "url": "https://github.com/sponsors/sindresorhus", - }, - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "version": "3.3.1", - }, - "node_modules/is-arrayish": Object { - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "version": "0.2.1", - }, - "node_modules/is-core-module": Object { - "dependencies": Object { - "hasown": "^2.0.2", - }, - "engines": Object { - "node": ">= 0.4", - }, - "funding": Object { - "url": "https://github.com/sponsors/ljharb", - }, - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "version": "2.16.1", - }, - "node_modules/js-tokens": Object { - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "version": "4.0.0", - }, - "node_modules/json-parse-even-better-errors": Object { - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "version": "2.3.1", - }, - "node_modules/lines-and-columns": Object { - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "version": "1.2.4", - }, - "node_modules/parent-module": Object { - "dependencies": Object { - "callsites": "^3.0.0", - }, - "engines": Object { - "node": ">=6", - }, - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "version": "1.0.1", - }, - "node_modules/parse-json": Object { - "dependencies": Object { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6", - }, - "engines": Object { - "node": ">=8", - }, - "funding": Object { - "url": "https://github.com/sponsors/sindresorhus", - }, - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "version": "5.2.0", - }, - "node_modules/path-parse": Object { - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "version": "1.0.7", - }, - "node_modules/path-type": Object { - "engines": Object { - "node": ">=8", - }, - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "version": "4.0.0", - }, - "node_modules/picocolors": Object { - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "version": "1.1.1", - }, - "node_modules/resolve": Object { - "bin": Object { - "resolve": "bin/resolve", - }, - "dependencies": Object { - "is-core-module": "^2.16.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0", - }, - "engines": Object { - "node": ">= 0.4", - }, - "funding": Object { - "url": "https://github.com/sponsors/ljharb", - }, - "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "version": "1.22.10", - }, - "node_modules/resolve-from": Object { - "engines": Object { - "node": ">=4", - }, - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "version": "4.0.0", - }, - "node_modules/supports-preserve-symlinks-flag": Object { - "engines": Object { - "node": ">= 0.4", - }, - "funding": Object { - "url": "https://github.com/sponsors/ljharb", - }, - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "license": "MIT", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "version": "1.0.0", - }, - "node_modules/yaml": Object { - "engines": Object { - "node": ">= 6", - }, - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "license": "ISC", - "optional": true, - "peer": true, - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "version": "1.10.2", - }, }, "requires": true, "version": "1.0.0", From f6aa3ddf9118586a3f5b8bb50125bf92a2d937d6 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:02:07 +0000 Subject: [PATCH 3/8] test: mock the audit endpoint --- workspaces/arborist/test/arborist/pruner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index 4669a96ce751e..344ab9aed6f25 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -39,6 +39,7 @@ t.test('prune with lockfile', async t => { }) t.test('prune with lockfile with implicit optional peer dependencies', async t => { + registry.audit({}) const path = fixture(t, 'prune-lockfile-optional-peer') const tree = await pruneTree(path) From 796488396d5bb897aa22de87f36cf95df0b1b7ac Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:18:20 +0000 Subject: [PATCH 4/8] test: attempt to get Windows passing --- workspaces/arborist/test/arborist/pruner.js | 1 + .../content/dedent/dedent-1.6.0.tgz | Bin 0 -> 6784 bytes 2 files changed, 1 insertion(+) create mode 100644 workspaces/arborist/test/fixtures/registry-mocks/content/dedent/dedent-1.6.0.tgz diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index 344ab9aed6f25..431e8049a5b8c 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -39,6 +39,7 @@ t.test('prune with lockfile', async t => { }) t.test('prune with lockfile with implicit optional peer dependencies', async t => { + registry.mocks({ dir: join(__dirname, '..', '..', 'fixtures') }) registry.audit({}) const path = fixture(t, 'prune-lockfile-optional-peer') const tree = await pruneTree(path) diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/dedent/dedent-1.6.0.tgz b/workspaces/arborist/test/fixtures/registry-mocks/content/dedent/dedent-1.6.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..2ea7701b648615e864bcf14fa3f7e29e683c756a GIT binary patch literal 6784 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 literal 0 HcmV?d00001 From efd74f7108635f6c5c2ebde06af26d72d8492da0 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:22:11 +0000 Subject: [PATCH 5/8] test: rollback --- workspaces/arborist/test/arborist/pruner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index 431e8049a5b8c..344ab9aed6f25 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -39,7 +39,6 @@ t.test('prune with lockfile', async t => { }) t.test('prune with lockfile with implicit optional peer dependencies', async t => { - registry.mocks({ dir: join(__dirname, '..', '..', 'fixtures') }) registry.audit({}) const path = fixture(t, 'prune-lockfile-optional-peer') const tree = await pruneTree(path) From 00df4af0d89c2482adf37ebb01b41458bc4b5043 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 10 Jul 2025 22:08:47 +0000 Subject: [PATCH 6/8] chore: add comment --- workspaces/arborist/lib/arborist/build-ideal-tree.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 3783180e4fc54..c4168037cbe08 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -1516,6 +1516,11 @@ This is a one-time fix-up, please be patient... #idealTreePrune () { for (const node of this.idealTree.inventory.values()) { + // optional peer dependencies are meant to be added to the tree + // through an explicit required dependency (most commonly in the + // root package.json), at which point they won't be optional so + // any dependencies still marked as both optional and peer at + // this point can be pruned as a special kind of extraneous if (node.extraneous || (node.peer && node.optional)) { node.parent = null } From e028d6031d032bb8ec8dec2e2e8f12efb697f394 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 17 Jul 2025 12:39:26 +1200 Subject: [PATCH 7/8] test: explicitly set the cache directory on Windows --- workspaces/arborist/test/arborist/pruner.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index 344ab9aed6f25..c02a60a3db051 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -40,8 +40,17 @@ t.test('prune with lockfile', async t => { t.test('prune with lockfile with implicit optional peer dependencies', async t => { registry.audit({}) + const opts = {} + + // todo: for some reason on Windows when doing this test NPM looks for + // the cache in the home directory, resulting in an unexpected real + // call being made to the registry + if (process.platform === 'win32') { + opts['cache'] = 'C:\\npm\\cache\\_cacache' + } + const path = fixture(t, 'prune-lockfile-optional-peer') - const tree = await pruneTree(path) + const tree = await pruneTree(path, opts) const dep = tree.children.get('dedent') t.ok(dep, 'required prod dep was pruned from tree') From 9db43c0ccf71cb3535d92789059ac9bdce3c6f5c Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Thu, 17 Jul 2025 12:47:49 +1200 Subject: [PATCH 8/8] chore: address linting errors --- workspaces/arborist/test/arborist/pruner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspaces/arborist/test/arborist/pruner.js b/workspaces/arborist/test/arborist/pruner.js index c02a60a3db051..c805123b5a4cf 100644 --- a/workspaces/arborist/test/arborist/pruner.js +++ b/workspaces/arborist/test/arborist/pruner.js @@ -43,10 +43,10 @@ t.test('prune with lockfile with implicit optional peer dependencies', async t = const opts = {} // todo: for some reason on Windows when doing this test NPM looks for - // the cache in the home directory, resulting in an unexpected real + // the cache in the home directory, resulting in an unexpected real // call being made to the registry if (process.platform === 'win32') { - opts['cache'] = 'C:\\npm\\cache\\_cacache' + opts.cache = 'C:\\npm\\cache\\_cacache' } const path = fixture(t, 'prune-lockfile-optional-peer')