diff --git a/.gitignore b/.gitignore index d4d7e3f..7535211 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist *.log +.DS_Store diff --git a/package.json b/package.json index cc81b6a..6faf3b6 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ }, "dependencies": { "@npmcli/arborist": "^7.5.4", + "@npmcli/config": "^9.0.0", "@pnpm/logger": "^5.0.0", "@pnpm/types": "^9.4.2", "chalk": "^5.3.0", @@ -65,6 +66,7 @@ "devDependencies": { "@types/fs-extra": "^11.0.4", "@types/node": "^22.1.0", + "@types/npmcli__config": "^6.0.3", "@types/source-map-support": "^0.5.10", "@types/tar-fs": "^2.0.4", "eslint": "^8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 101ce12..05d42b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@npmcli/arborist': specifier: ^7.5.4 version: 7.5.4 + '@npmcli/config': + specifier: ^9.0.0 + version: 9.0.0 '@pnpm/logger': specifier: ^5.0.0 version: 5.0.0 @@ -69,6 +72,9 @@ importers: '@types/node': specifier: ^22.1.0 version: 22.1.0 + '@types/npmcli__config': + specifier: ^6.0.3 + version: 6.0.3 '@types/source-map-support': specifier: ^0.5.10 version: 0.5.10 @@ -467,6 +473,10 @@ packages: engines: {node: ^16.14.0 || >=18.0.0} hasBin: true + '@npmcli/config@9.0.0': + resolution: {integrity: sha512-P5Vi16Y+c8E0prGIzX112ug7XxqfaPFUVW/oXAV+2VsxplKZEnJozqZ0xnK8V8w/SEsBf+TXhUihrEIAU4CA5Q==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/fs@3.1.1': resolution: {integrity: sha512-q9CRWjpHCMIh5sVyefoD1cA7PkvILqCZsnSOEUUivORLjxCO/Irmue2DprETiNgEqktDBZaM1Bi+jrarx1XdCg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -475,6 +485,10 @@ packages: resolution: {integrity: sha512-liASfw5cqhjNW9UFd+ruwwdEf/lbOAQjLL2XY2dFW/bkJheXDYZgOyul/4gVvEV4BWkTXjYGmDqMw9uegdbJNQ==} engines: {node: ^16.14.0 || >=18.0.0} + '@npmcli/git@6.0.1': + resolution: {integrity: sha512-BBWMMxeQzalmKadyimwb2/VVQyJB01PH0HhVSNLHNBDZN/M/h/02P6f8fxedIiFhpMj11SO9Ep5tKTBE7zL2nw==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/installed-package-contents@2.1.0': resolution: {integrity: sha512-c8UuGLeZpm69BryRykLuKRyKFZYJsZSCT4aVY5ds4omyZqJ172ApzgfKJ5eV/r3HgLdUYgFVe54KSFVjKoe27w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -484,6 +498,10 @@ packages: resolution: {integrity: sha512-tkYs0OYnzQm6iIRdfy+LcLBjcKuQCeE5YLb8KnrIlutJfheNaPvPpgoFEyEFgbjzl5PLZ3IA/BWAwRU0eHuQDA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + '@npmcli/map-workspaces@4.0.1': + resolution: {integrity: sha512-g5H8ljH7Z+4T1ASsfcL09gZl4YGw6M4GbjzPt6HgE+pCRSKC4nlNc4nY75zshi88eEHcdoh3Q8XgWFkGKoVOPw==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/metavuln-calculator@7.1.1': resolution: {integrity: sha512-Nkxf96V0lAx3HCpVda7Vw4P23RILgdi/5K1fmj2tZkWIYLpXAN8k2UVVOsW16TsS5F8Ws2I7Cm+PU1/rsVF47g==} engines: {node: ^16.14.0 || >=18.0.0} @@ -492,6 +510,10 @@ packages: resolution: {integrity: sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + '@npmcli/name-from-folder@3.0.0': + resolution: {integrity: sha512-61cDL8LUc9y80fXn+lir+iVt8IS0xHqEKwPu/5jCjxQTVoSCmkXvw4vbMrzAMtmghz3/AkiBjhHkDKUH+kf7kA==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/node-gyp@3.0.0': resolution: {integrity: sha512-gp8pRXC2oOxu0DUE1/M3bYtb1b3/DbJ5aM113+XJBgfXdussRAsX0YOrOhdd8WvnAR6auDBvJomGAkLKA5ydxA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -500,10 +522,18 @@ packages: resolution: {integrity: sha512-qe/kiqqkW0AGtvBjL8TJKZk/eBBSpnJkUWvHdQ9jM2lKHXRYYJuyNpJPlJw3c8QjC2ow6NZYiLExhUaeJelbxQ==} engines: {node: ^16.14.0 || >=18.0.0} + '@npmcli/package-json@6.0.1': + resolution: {integrity: sha512-YW6PZ99sc1Q4DINEY2td5z9Z3rwbbsx7CyCnOc7UXUUdePXh5gPi1UeaoQVmKQMVbIU7aOwX2l1OG5ZfjgGi5g==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/promise-spawn@7.0.2': resolution: {integrity: sha512-xhfYPXoV5Dy4UkY0D+v2KkwvnDfiA/8Mt3sWCGI/hM03NsYIH8ZaG6QzS9x7pje5vHZBZJ2v6VRFVTWACnqcmQ==} engines: {node: ^16.14.0 || >=18.0.0} + '@npmcli/promise-spawn@8.0.1': + resolution: {integrity: sha512-ZscqKtJqy7oj6MgXEJcHQ1om4utU0Q84QtC28UVuiO6ALSO9sDPanXdu6Wd1oYhItW8fx2u96zRFUE8BuPlAjA==} + engines: {node: ^18.17.0 || >=20.5.0} + '@npmcli/query@3.1.0': resolution: {integrity: sha512-C/iR0tk7KSKGldibYIB9x8GtO/0Bd0I2mhOaDb8ucQL/bQVTmGoeREaFj64Z5+iCBRf3dQfed0CjJL7I8iTkiQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -845,6 +875,9 @@ packages: '@types/node@22.1.0': resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==} + '@types/npmcli__config@6.0.3': + resolution: {integrity: sha512-JasDNjgkmtYWGJxMmhmfc8gRrRgcONd4DRaUTD/jWGhwIJSkUMSGHPatTVfUmD7QopQh93TzDH14FZL5tB2tEA==} + '@types/semver@7.5.6': resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} @@ -1111,6 +1144,10 @@ packages: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} + ci-info@4.0.0: + resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} + engines: {node: '>=8'} + clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -1457,6 +1494,10 @@ packages: resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} engines: {node: ^16.14.0 || >=18.0.0} + hosted-git-info@8.0.0: + resolution: {integrity: sha512-4nw3vOVR+vHUOT8+U4giwe2tcGv+R3pwwRidUe67DoMBTjhrfr6rZYJVVwdkBE+Um050SG+X9tf0Jo4fOpn01w==} + engines: {node: ^18.17.0 || >=20.5.0} + http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} @@ -1513,6 +1554,10 @@ packages: resolution: {integrity: sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + ini@5.0.0: + resolution: {integrity: sha512-+N0ngpO3e7cRUWOJAS7qw0IZIVc6XPrW4MlFBdD066F2L4k1L6ker3hLqSq7iXxU5tgS4WGkIUElWn5vogAEnw==} + engines: {node: ^18.17.0 || >=20.5.0} + ip-address@9.0.5: resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==} engines: {node: '>= 12'} @@ -1588,6 +1633,10 @@ packages: resolution: {integrity: sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + json-parse-even-better-errors@4.0.0: + resolution: {integrity: sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA==} + engines: {node: ^18.17.0 || >=20.5.0} + json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} @@ -1869,10 +1918,19 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} hasBin: true + nopt@8.0.0: + resolution: {integrity: sha512-1L/fTJ4UmV/lUxT2Uf006pfZKTvAgCF+chz+0OgBHO8u2Z67pE7AaAUUj7CJy0lXqHmymUvGFt6NE9R3HER0yw==} + engines: {node: ^18.17.0 || >=20.5.0} + hasBin: true + normalize-package-data@6.0.2: resolution: {integrity: sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==} engines: {node: ^16.14.0 || >=18.0.0} + normalize-package-data@7.0.0: + resolution: {integrity: sha512-k6U0gKRIuNCTkwHGZqblCfLfBRh+w1vI6tBo+IeJwq2M8FUiOqhX7GH+GArQGScA7azd1WfyRCvxoXDO3hQDIA==} + engines: {node: ^18.17.0 || >=20.5.0} + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -1885,18 +1943,34 @@ packages: resolution: {integrity: sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + npm-install-checks@7.1.0: + resolution: {integrity: sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==} + engines: {node: ^18.17.0 || >=20.5.0} + npm-normalize-package-bin@3.0.1: resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + npm-normalize-package-bin@4.0.0: + resolution: {integrity: sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==} + engines: {node: ^18.17.0 || >=20.5.0} + npm-package-arg@11.0.3: resolution: {integrity: sha512-sHGJy8sOC1YraBywpzQlIKBE4pBbGbiF95U6Auspzyem956E0+FtDtsx1ZxlOJkQCZ1AFXAY/yuvtFYrOxF+Bw==} engines: {node: ^16.14.0 || >=18.0.0} + npm-package-arg@12.0.0: + resolution: {integrity: sha512-ZTE0hbwSdTNL+Stx2zxSqdu2KZfNDcrtrLdIk7XGnQFYBWYDho/ORvXtn5XEePcL3tFpGjHCV3X3xrtDh7eZ+A==} + engines: {node: ^18.17.0 || >=20.5.0} + npm-packlist@8.0.2: resolution: {integrity: sha512-shYrPFIS/JLP4oQmAwDyk5HcyysKW8/JLTEA32S0Z5TzvpaeeX2yMFfoK1fjEBnCBvVyIB/Jj/GBFdm0wsgzbA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + npm-pick-manifest@10.0.0: + resolution: {integrity: sha512-r4fFa4FqYY8xaM7fHecQ9Z2nE9hgNfJR+EmoKv0+chvzWkBcORX3r0FpTByP+CbOVJDladMXnPQGVN8PBLGuTQ==} + engines: {node: ^18.17.0 || >=20.5.0} + npm-pick-manifest@9.1.0: resolution: {integrity: sha512-nkc+3pIIhqHVQr085X9d2JzPzLyjzQS96zbruppqC9aZRm/x8xx6xhI98gHtsfELP2bE+loHq8ZaHFHhe+NauA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -2075,6 +2149,10 @@ packages: resolution: {integrity: sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + proc-log@5.0.0: + resolution: {integrity: sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==} + engines: {node: ^18.17.0 || >=20.5.0} + proggy@2.0.0: resolution: {integrity: sha512-69agxLtnI8xBs9gUGqEnK26UfiexpHy+KUpBQWabiytQjnn5wFY8rklAi7GRfABIuPNnQ/ik48+LGLkYYJcy4A==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -2477,6 +2555,10 @@ packages: resolution: {integrity: sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + validate-npm-package-name@6.0.0: + resolution: {integrity: sha512-d7KLgL1LD3U3fgnvWEY1cQXoO/q6EQ1BSz48Sa149V/5zVTAbgmZIpyI8TRi6U9/JNyeYLlTKsEMPtLC27RFUg==} + engines: {node: ^18.17.0 || >=20.5.0} + vite-node@1.4.0: resolution: {integrity: sha512-VZDAseqjrHgNd4Kh8icYHWzTKSCZMhia7GyHfhtzLW33fZlG9SwsB6CEhgyVOWkJfJ2pFLrp/Gj1FSfAiqH9Lw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -2554,6 +2636,11 @@ packages: engines: {node: ^16.13.0 || >=18.0.0} hasBin: true + which@5.0.0: + resolution: {integrity: sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==} + engines: {node: ^18.17.0 || >=20.5.0} + hasBin: true + why-is-node-running@2.2.2: resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} engines: {node: '>=8'} @@ -2867,6 +2954,19 @@ snapshots: - bluebird - supports-color + '@npmcli/config@9.0.0': + dependencies: + '@npmcli/map-workspaces': 4.0.1 + '@npmcli/package-json': 6.0.1 + ci-info: 4.0.0 + ini: 5.0.0 + nopt: 8.0.0 + proc-log: 5.0.0 + semver: 7.6.3 + walk-up-path: 3.0.1 + transitivePeerDependencies: + - bluebird + '@npmcli/fs@3.1.1': dependencies: semver: 7.6.3 @@ -2885,6 +2985,20 @@ snapshots: transitivePeerDependencies: - bluebird + '@npmcli/git@6.0.1': + dependencies: + '@npmcli/promise-spawn': 8.0.1 + ini: 5.0.0 + lru-cache: 10.4.3 + npm-pick-manifest: 10.0.0 + proc-log: 5.0.0 + promise-inflight: 1.0.1 + promise-retry: 2.0.1 + semver: 7.6.3 + which: 5.0.0 + transitivePeerDependencies: + - bluebird + '@npmcli/installed-package-contents@2.1.0': dependencies: npm-bundled: 3.0.1 @@ -2897,6 +3011,15 @@ snapshots: minimatch: 9.0.5 read-package-json-fast: 3.0.2 + '@npmcli/map-workspaces@4.0.1': + dependencies: + '@npmcli/name-from-folder': 3.0.0 + '@npmcli/package-json': 6.0.1 + glob: 10.3.12 + minimatch: 9.0.5 + transitivePeerDependencies: + - bluebird + '@npmcli/metavuln-calculator@7.1.1': dependencies: cacache: 18.0.4 @@ -2910,6 +3033,8 @@ snapshots: '@npmcli/name-from-folder@2.0.0': {} + '@npmcli/name-from-folder@3.0.0': {} + '@npmcli/node-gyp@3.0.0': {} '@npmcli/package-json@5.2.0': @@ -2924,10 +3049,26 @@ snapshots: transitivePeerDependencies: - bluebird + '@npmcli/package-json@6.0.1': + dependencies: + '@npmcli/git': 6.0.1 + glob: 10.3.12 + hosted-git-info: 8.0.0 + json-parse-even-better-errors: 4.0.0 + normalize-package-data: 7.0.0 + proc-log: 5.0.0 + semver: 7.6.3 + transitivePeerDependencies: + - bluebird + '@npmcli/promise-spawn@7.0.2': dependencies: which: 4.0.0 + '@npmcli/promise-spawn@8.0.1': + dependencies: + which: 5.0.0 + '@npmcli/query@3.1.0': dependencies: postcss-selector-parser: 6.1.1 @@ -3263,6 +3404,11 @@ snapshots: dependencies: undici-types: 6.13.0 + '@types/npmcli__config@6.0.3': + dependencies: + '@types/node': 22.1.0 + '@types/semver': 7.5.6 + '@types/semver@7.5.6': {} '@types/source-map-support@0.5.10': @@ -3585,6 +3731,8 @@ snapshots: chownr@2.0.0: {} + ci-info@4.0.0: {} + clean-stack@2.2.0: {} cmd-shim@6.0.3: {} @@ -3995,6 +4143,10 @@ snapshots: dependencies: lru-cache: 10.4.3 + hosted-git-info@8.0.0: + dependencies: + lru-cache: 10.4.3 + http-cache-semantics@4.1.1: {} http-proxy-agent@7.0.2: @@ -4046,6 +4198,8 @@ snapshots: ini@4.1.3: {} + ini@5.0.0: {} + ip-address@9.0.5: dependencies: jsbn: 1.1.0 @@ -4099,6 +4253,8 @@ snapshots: json-parse-even-better-errors@3.0.2: {} + json-parse-even-better-errors@4.0.0: {} + json-schema-traverse@0.4.1: {} json-stable-stringify-without-jsonify@1.0.1: {} @@ -4467,12 +4623,22 @@ snapshots: dependencies: abbrev: 2.0.0 + nopt@8.0.0: + dependencies: + abbrev: 2.0.0 + normalize-package-data@6.0.2: dependencies: hosted-git-info: 7.0.2 semver: 7.6.3 validate-npm-package-license: 3.0.4 + normalize-package-data@7.0.0: + dependencies: + hosted-git-info: 8.0.0 + semver: 7.6.3 + validate-npm-package-license: 3.0.4 + normalize-path@3.0.0: {} npm-bundled@3.0.1: @@ -4483,8 +4649,14 @@ snapshots: dependencies: semver: 7.6.3 + npm-install-checks@7.1.0: + dependencies: + semver: 7.6.3 + npm-normalize-package-bin@3.0.1: {} + npm-normalize-package-bin@4.0.0: {} + npm-package-arg@11.0.3: dependencies: hosted-git-info: 7.0.2 @@ -4492,10 +4664,24 @@ snapshots: semver: 7.6.3 validate-npm-package-name: 5.0.1 + npm-package-arg@12.0.0: + dependencies: + hosted-git-info: 8.0.0 + proc-log: 5.0.0 + semver: 7.6.3 + validate-npm-package-name: 6.0.0 + npm-packlist@8.0.2: dependencies: ignore-walk: 6.0.5 + npm-pick-manifest@10.0.0: + dependencies: + npm-install-checks: 7.1.0 + npm-normalize-package-bin: 4.0.0 + npm-package-arg: 12.0.0 + semver: 7.6.3 + npm-pick-manifest@9.1.0: dependencies: npm-install-checks: 6.3.0 @@ -4685,6 +4871,8 @@ snapshots: proc-log@4.2.0: {} + proc-log@5.0.0: {} + proggy@2.0.0: {} promise-all-reject-late@1.0.1: {} @@ -5110,6 +5298,8 @@ snapshots: validate-npm-package-name@5.0.1: {} + validate-npm-package-name@6.0.0: {} + vite-node@1.4.0(@types/node@22.1.0): dependencies: cac: 6.7.14 @@ -5187,6 +5377,10 @@ snapshots: dependencies: isexe: 3.1.1 + which@5.0.0: + dependencies: + isexe: 3.1.1 + why-is-node-running@2.2.2: dependencies: siginfo: 2.0.0 diff --git a/src/lib/lockfile/helpers/generate-npm-lockfile.ts b/src/lib/lockfile/helpers/generate-npm-lockfile.ts index f6634ab..11584c1 100644 --- a/src/lib/lockfile/helpers/generate-npm-lockfile.ts +++ b/src/lib/lockfile/helpers/generate-npm-lockfile.ts @@ -3,6 +3,7 @@ import fs from "fs-extra"; import path from "node:path"; import { useLogger } from "~/lib/logger"; import { getErrorMessage } from "~/lib/utils"; +import { loadNpmConfig } from "./load-npm-config"; /** * Generate an isolated / pruned lockfile, based on the contents of installed @@ -27,7 +28,12 @@ export async function generateNpmLockfile({ throw new Error(`Failed to find node_modules at ${nodeModulesPath}`); } - const arborist = new Arborist({ path: isolateDir }); + const config = await loadNpmConfig({ npmPath: workspaceRootDir }); + + const arborist = new Arborist({ + path: isolateDir, + ...config.flat, + }); const { meta } = await arborist.buildIdealTree(); diff --git a/src/lib/lockfile/helpers/load-npm-config.ts b/src/lib/lockfile/helpers/load-npm-config.ts new file mode 100644 index 0000000..a014ec1 --- /dev/null +++ b/src/lib/lockfile/helpers/load-npm-config.ts @@ -0,0 +1,15 @@ +import Config from "@npmcli/config"; +import defaults from "@npmcli/config/lib/definitions/index.js"; + +export async function loadNpmConfig({ npmPath }: { npmPath: string }) { + const config = new Config({ + npmPath, + definitions: defaults.definitions, + shorthands: defaults.shorthands, + flatten: defaults.flatten, + }); + + await config.load(); + + return config; +} diff --git a/src/vendor.d.ts b/src/vendor.d.ts index 1c42e2b..78d3b73 100644 --- a/src/vendor.d.ts +++ b/src/vendor.d.ts @@ -1 +1,3 @@ declare module "@npmcli/arborist"; + +declare module "@npmcli/config/lib/definitions/index.js";